CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
null
null
null
https://github.com/chromium/chromium/commit/4fdb2b3ebb31e39852fb1bc20fcdf3b5e4de382e
4fdb2b3ebb31e39852fb1bc20fcdf3b5e4de382e
ur_ls -> urls in ResourceFetcher Blink Reformat miss? fix BUG=675877 Review-Url: https://codereview.chromium.org/2809103002 Cr-Commit-Position: refs/heads/master@{#463599}
void ResourceFetcher::UpdateAllImageResourcePriorities() { TRACE_EVENT0( "blink", "ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities"); for (const auto& document_resource : document_resources_) { Resource* resource = document_resource.value.Get(); if (!resource || !resource->IsImage() || !resource->IsLoading()) continue; ResourcePriority resource_priority = resource->PriorityFromObservers(); ResourceLoadPriority resource_load_priority = ComputeLoadPriority(Resource::kImage, resource->GetResourceRequest(), resource_priority.visibility); if (resource_load_priority == resource->GetResourceRequest().Priority()) continue; resource->DidChangePriority(resource_load_priority, resource_priority.intra_priority_value); network_instrumentation::resourcePrioritySet(resource->Identifier(), resource_load_priority); Context().DispatchDidChangeResourcePriority( resource->Identifier(), resource_load_priority, resource_priority.intra_priority_value); } }
void ResourceFetcher::UpdateAllImageResourcePriorities() { TRACE_EVENT0( "blink", "ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities"); for (const auto& document_resource : document_resources_) { Resource* resource = document_resource.value.Get(); if (!resource || !resource->IsImage() || !resource->IsLoading()) continue; ResourcePriority resource_priority = resource->PriorityFromObservers(); ResourceLoadPriority resource_load_priority = ComputeLoadPriority(Resource::kImage, resource->GetResourceRequest(), resource_priority.visibility); if (resource_load_priority == resource->GetResourceRequest().Priority()) continue; resource->DidChangePriority(resource_load_priority, resource_priority.intra_priority_value); network_instrumentation::resourcePrioritySet(resource->Identifier(), resource_load_priority); Context().DispatchDidChangeResourcePriority( resource->Identifier(), resource_load_priority, resource_priority.intra_priority_value); } }
C
Chrome
0
CVE-2016-3751
https://www.cvedetails.com/cve/CVE-2016-3751/
null
https://android.googlesource.com/platform/external/libpng/+/9d4853418ab2f754c2b63e091c29c5529b8b86ca
9d4853418ab2f754c2b63e091c29c5529b8b86ca
DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b63bc0bf46084833 (cherry picked from commit bbe98b40cda082024b669fa508931042eed18f82)
standard_palette_validate(standard_display *dp, png_const_structp pp, png_infop pi) { int npalette; store_palette palette; if (read_palette(palette, &npalette, pp, pi) != dp->is_transparent) png_error(pp, "validate: palette transparency changed"); if (npalette != dp->npalette) { size_t pos = 0; char msg[64]; pos = safecat(msg, sizeof msg, pos, "validate: palette size changed: "); pos = safecatn(msg, sizeof msg, pos, dp->npalette); pos = safecat(msg, sizeof msg, pos, " -> "); pos = safecatn(msg, sizeof msg, pos, npalette); png_error(pp, msg); } { int i = npalette; /* npalette is aliased */ while (--i >= 0) if (palette[i].red != dp->palette[i].red || palette[i].green != dp->palette[i].green || palette[i].blue != dp->palette[i].blue || palette[i].alpha != dp->palette[i].alpha) png_error(pp, "validate: PLTE or tRNS chunk changed"); } }
standard_palette_validate(standard_display *dp, png_const_structp pp, png_infop pi) { int npalette; store_palette palette; if (read_palette(palette, &npalette, pp, pi) != dp->is_transparent) png_error(pp, "validate: palette transparency changed"); if (npalette != dp->npalette) { size_t pos = 0; char msg[64]; pos = safecat(msg, sizeof msg, pos, "validate: palette size changed: "); pos = safecatn(msg, sizeof msg, pos, dp->npalette); pos = safecat(msg, sizeof msg, pos, " -> "); pos = safecatn(msg, sizeof msg, pos, npalette); png_error(pp, msg); } { int i = npalette; /* npalette is aliased */ while (--i >= 0) if (palette[i].red != dp->palette[i].red || palette[i].green != dp->palette[i].green || palette[i].blue != dp->palette[i].blue || palette[i].alpha != dp->palette[i].alpha) png_error(pp, "validate: PLTE or tRNS chunk changed"); } }
C
Android
0
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}
void PDFiumEngine::GetRegion(const pp::Point& location, pp::ImageData* image_data, void** region, int* stride) const { if (image_data->is_null()) { DCHECK(plugin_size_.IsEmpty()); *stride = 0; *region = nullptr; return; } char* buffer = static_cast<char*>(image_data->data()); *stride = image_data->stride(); pp::Point offset_location = location + page_offset_; if (!buffer || !pp::Rect(page_offset_, plugin_size_).Contains(offset_location)) { *region = nullptr; return; } buffer += location.y() * (*stride); buffer += (location.x() + page_offset_.x()) * 4; *region = buffer; }
void PDFiumEngine::GetRegion(const pp::Point& location, pp::ImageData* image_data, void** region, int* stride) const { if (image_data->is_null()) { DCHECK(plugin_size_.IsEmpty()); *stride = 0; *region = nullptr; return; } char* buffer = static_cast<char*>(image_data->data()); *stride = image_data->stride(); pp::Point offset_location = location + page_offset_; if (!buffer || !pp::Rect(page_offset_, plugin_size_).Contains(offset_location)) { *region = nullptr; return; } buffer += location.y() * (*stride); buffer += (location.x() + page_offset_.x()) * 4; *region = buffer; }
C
Chrome
0
CVE-2014-1713
https://www.cvedetails.com/cve/CVE-2014-1713/
CWE-399
https://github.com/chromium/chromium/commit/f85a87ec670ad0fce9d98d90c9a705b72a288154
f85a87ec670ad0fce9d98d90c9a705b72a288154
document.location bindings fix BUG=352374 R=jochen@chromium.org Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void overloadedMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(TestObject*, objArg, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), info[0])); imp->overloadedMethod(objArg); }
static void overloadedMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(TestObject*, objArg, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), info[0])); imp->overloadedMethod(objArg); }
C
Chrome
0
CVE-2018-16540
https://www.cvedetails.com/cve/CVE-2018-16540/
CWE-416
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=c432131c3fdb2143e148e8ba88555f7f7a63b25e
c432131c3fdb2143e148e8ba88555f7f7a63b25e
null
pdf14_transform_color_buffer(gs_gstate *pgs, pdf14_ctx *ctx, gx_device *dev, pdf14_buf *src_buf, byte *src_data, cmm_profile_t *src_profile, cmm_profile_t *des_profile, int x0, int y0, int width, int height, bool *did_alloc) { gsicc_rendering_param_t rendering_params; gsicc_link_t *icc_link; gsicc_bufferdesc_t src_buff_desc; gsicc_bufferdesc_t des_buff_desc; int src_planestride = src_buf->planestride; int src_rowstride = src_buf->rowstride; int src_n_planes = src_buf->n_planes; int src_n_chan = src_buf->n_chan; int des_planestride = src_planestride; int des_rowstride = src_rowstride; int des_n_planes = src_n_planes; int des_n_chan = src_n_chan; int diff; int k, j; byte *des_data = NULL; pdf14_buf *output = src_buf; *did_alloc = false; /* Same profile */ if (gsicc_get_hash(src_profile) == gsicc_get_hash(des_profile)) return src_buf; /* Define the rendering intent get the link */ rendering_params.black_point_comp = gsBLACKPTCOMP_ON; rendering_params.graphics_type_tag = GS_IMAGE_TAG; rendering_params.override_icc = false; rendering_params.preserve_black = gsBKPRESNOTSPECIFIED; rendering_params.rendering_intent = gsPERCEPTUAL; rendering_params.cmm = gsCMM_DEFAULT; icc_link = gsicc_get_link_profile(pgs, dev, src_profile, des_profile, &rendering_params, pgs->memory, false); if (icc_link == NULL) return NULL; /* If different data sizes, we have to do an allocation */ diff = des_profile->num_comps - src_profile->num_comps; if (diff != 0) { byte *src_ptr; byte *des_ptr; *did_alloc = true; des_rowstride = (width + 3) & -4; des_planestride = height * des_rowstride; des_n_planes = src_n_planes + diff; des_n_chan = src_n_chan + diff; des_data = gs_alloc_bytes(ctx->memory, des_planestride * des_n_planes, "pdf14_transform_color_buffer"); if (des_data == NULL) return NULL; /* Copy over the noncolor planes. May only be a dirty part, so have to copy row by row */ src_ptr = src_data; des_ptr = des_data; for (j = 0; j < height; j++) { for (k = 0; k < (src_n_planes - src_profile->num_comps); k++) { memcpy(des_ptr + des_planestride * (k + des_profile->num_comps), src_ptr + src_planestride * (k + src_profile->num_comps), width); } src_ptr += src_rowstride; des_ptr += des_rowstride; } } else des_data = src_data; /* Set up the buffer descriptors. */ gsicc_init_buffer(&src_buff_desc, src_profile->num_comps, 1, false, false, true, src_planestride, src_rowstride, height, width); gsicc_init_buffer(&des_buff_desc, des_profile->num_comps, 1, false, false, true, des_planestride, des_rowstride, height, width); /* Transform the data. Since the pdf14 device should be using RGB, CMYK or Gray buffers, this transform does not need to worry about the cmap procs of the target device. */ (icc_link->procs.map_buffer)(dev, icc_link, &src_buff_desc, &des_buff_desc, src_data, des_data); gsicc_release_link(icc_link); output->planestride = des_planestride; output->rowstride = des_rowstride; output->n_planes = des_n_planes; output->n_chan = des_n_chan; /* If not in-place conversion, then release. */ if (des_data != src_data) { gs_free_object(ctx->memory, output->data, "pdf14_transform_color_buffer"); output->data = des_data; /* Note, this is needed for case where we did a put image, as the resulting transformed buffer may not be a full page. */ output->rect.p.x = x0; output->rect.p.y = y0; output->rect.q.x = x0 + width; output->rect.q.y = y0 + height; } return output; }
pdf14_transform_color_buffer(gs_gstate *pgs, pdf14_ctx *ctx, gx_device *dev, pdf14_buf *src_buf, byte *src_data, cmm_profile_t *src_profile, cmm_profile_t *des_profile, int x0, int y0, int width, int height, bool *did_alloc) { gsicc_rendering_param_t rendering_params; gsicc_link_t *icc_link; gsicc_bufferdesc_t src_buff_desc; gsicc_bufferdesc_t des_buff_desc; int src_planestride = src_buf->planestride; int src_rowstride = src_buf->rowstride; int src_n_planes = src_buf->n_planes; int src_n_chan = src_buf->n_chan; int des_planestride = src_planestride; int des_rowstride = src_rowstride; int des_n_planes = src_n_planes; int des_n_chan = src_n_chan; int diff; int k, j; byte *des_data = NULL; pdf14_buf *output = src_buf; *did_alloc = false; /* Same profile */ if (gsicc_get_hash(src_profile) == gsicc_get_hash(des_profile)) return src_buf; /* Define the rendering intent get the link */ rendering_params.black_point_comp = gsBLACKPTCOMP_ON; rendering_params.graphics_type_tag = GS_IMAGE_TAG; rendering_params.override_icc = false; rendering_params.preserve_black = gsBKPRESNOTSPECIFIED; rendering_params.rendering_intent = gsPERCEPTUAL; rendering_params.cmm = gsCMM_DEFAULT; icc_link = gsicc_get_link_profile(pgs, dev, src_profile, des_profile, &rendering_params, pgs->memory, false); if (icc_link == NULL) return NULL; /* If different data sizes, we have to do an allocation */ diff = des_profile->num_comps - src_profile->num_comps; if (diff != 0) { byte *src_ptr; byte *des_ptr; *did_alloc = true; des_rowstride = (width + 3) & -4; des_planestride = height * des_rowstride; des_n_planes = src_n_planes + diff; des_n_chan = src_n_chan + diff; des_data = gs_alloc_bytes(ctx->memory, des_planestride * des_n_planes, "pdf14_transform_color_buffer"); if (des_data == NULL) return NULL; /* Copy over the noncolor planes. May only be a dirty part, so have to copy row by row */ src_ptr = src_data; des_ptr = des_data; for (j = 0; j < height; j++) { for (k = 0; k < (src_n_planes - src_profile->num_comps); k++) { memcpy(des_ptr + des_planestride * (k + des_profile->num_comps), src_ptr + src_planestride * (k + src_profile->num_comps), width); } src_ptr += src_rowstride; des_ptr += des_rowstride; } } else des_data = src_data; /* Set up the buffer descriptors. */ gsicc_init_buffer(&src_buff_desc, src_profile->num_comps, 1, false, false, true, src_planestride, src_rowstride, height, width); gsicc_init_buffer(&des_buff_desc, des_profile->num_comps, 1, false, false, true, des_planestride, des_rowstride, height, width); /* Transform the data. Since the pdf14 device should be using RGB, CMYK or Gray buffers, this transform does not need to worry about the cmap procs of the target device. */ (icc_link->procs.map_buffer)(dev, icc_link, &src_buff_desc, &des_buff_desc, src_data, des_data); gsicc_release_link(icc_link); output->planestride = des_planestride; output->rowstride = des_rowstride; output->n_planes = des_n_planes; output->n_chan = des_n_chan; /* If not in-place conversion, then release. */ if (des_data != src_data) { gs_free_object(ctx->memory, output->data, "pdf14_transform_color_buffer"); output->data = des_data; /* Note, this is needed for case where we did a put image, as the resulting transformed buffer may not be a full page. */ output->rect.p.x = x0; output->rect.p.y = y0; output->rect.q.x = x0 + width; output->rect.q.y = y0 + height; } return output; }
C
ghostscript
0
CVE-2019-11487
https://www.cvedetails.com/cve/CVE-2019-11487/
CWE-416
https://github.com/torvalds/linux/commit/6b3a707736301c2128ca85ce85fb13f60b5e350a
6b3a707736301c2128ca85ce85fb13f60b5e350a
Merge branch 'page-refs' (page ref overflow) Merge page ref overflow branch. Jann Horn reported that he can overflow the page ref count with sufficient memory (and a filesystem that is intentionally extremely slow). Admittedly it's not exactly easy. To have more than four billion references to a page requires a minimum of 32GB of kernel memory just for the pointers to the pages, much less any metadata to keep track of those pointers. Jann needed a total of 140GB of memory and a specially crafted filesystem that leaves all reads pending (in order to not ever free the page references and just keep adding more). Still, we have a fairly straightforward way to limit the two obvious user-controllable sources of page references: direct-IO like page references gotten through get_user_pages(), and the splice pipe page duplication. So let's just do that. * branch page-refs: fs: prevent page refcount overflow in pipe_buf_get mm: prevent get_user_pages() from overflowing page refcount mm: add 'try_get_page()' helper function mm: make page ref count overflow check tighter and more explicit
int __alloc_bootmem_huge_page(struct hstate *h) { struct huge_bootmem_page *m; int nr_nodes, node; for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) { void *addr; addr = memblock_alloc_try_nid_raw( huge_page_size(h), huge_page_size(h), 0, MEMBLOCK_ALLOC_ACCESSIBLE, node); if (addr) { /* * Use the beginning of the huge page to store the * huge_bootmem_page struct (until gather_bootmem * puts them into the mem_map). */ m = addr; goto found; } } return 0; found: BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h))); /* Put them into a private list first because mem_map is not up yet */ INIT_LIST_HEAD(&m->list); list_add(&m->list, &huge_boot_pages); m->hstate = h; return 1; }
int __alloc_bootmem_huge_page(struct hstate *h) { struct huge_bootmem_page *m; int nr_nodes, node; for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) { void *addr; addr = memblock_alloc_try_nid_raw( huge_page_size(h), huge_page_size(h), 0, MEMBLOCK_ALLOC_ACCESSIBLE, node); if (addr) { /* * Use the beginning of the huge page to store the * huge_bootmem_page struct (until gather_bootmem * puts them into the mem_map). */ m = addr; goto found; } } return 0; found: BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h))); /* Put them into a private list first because mem_map is not up yet */ INIT_LIST_HEAD(&m->list); list_add(&m->list, &huge_boot_pages); m->hstate = h; return 1; }
C
linux
0
CVE-2018-11596
https://www.cvedetails.com/cve/CVE-2018-11596/
CWE-119
https://github.com/espruino/Espruino/commit/ce1924193862d58cb43d3d4d9dada710a8361b89
ce1924193862d58cb43d3d4d9dada710a8361b89
fix jsvGetString regression
bool jsvIsStringEqual(JsVar *var, const char *str) { return jsvIsStringEqualOrStartsWith(var, str, false); }
bool jsvIsStringEqual(JsVar *var, const char *str) { return jsvIsStringEqualOrStartsWith(var, str, false); }
C
Espruino
0
CVE-2009-3605
https://www.cvedetails.com/cve/CVE-2009-3605/
CWE-189
https://cgit.freedesktop.org/poppler/poppler/commit/?id=7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
null
void CairoOutputDev::updateFillColor(GfxState *state) { state->getFillRGB(&fill_color); cairo_pattern_destroy(fill_pattern); fill_pattern = cairo_pattern_create_rgba(fill_color.r / 65535.0, fill_color.g / 65535.0, fill_color.b / 65535.0, fill_opacity); LOG(printf ("fill color: %d %d %d\n", fill_color.r, fill_color.g, fill_color.b)); }
void CairoOutputDev::updateFillColor(GfxState *state) { state->getFillRGB(&fill_color); cairo_pattern_destroy(fill_pattern); fill_pattern = cairo_pattern_create_rgba(fill_color.r / 65535.0, fill_color.g / 65535.0, fill_color.b / 65535.0, fill_opacity); LOG(printf ("fill color: %d %d %d\n", fill_color.r, fill_color.g, fill_color.b)); }
CPP
poppler
0
CVE-2014-0203
https://www.cvedetails.com/cve/CVE-2014-0203/
CWE-20
https://github.com/torvalds/linux/commit/86acdca1b63e6890540fa19495cfc708beff3d8b
86acdca1b63e6890540fa19495cfc708beff3d8b
fix autofs/afs/etc. magic mountpoint breakage We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type is bogus here; we want LAST_BIND for everything of that kind and we get LAST_NORM left over from finding parent directory. So make sure that it *is* set properly; set to LAST_BIND before doing ->follow_link() - for normal symlinks it will be changed by __vfs_follow_link() and everything else needs it set that way. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
static ssize_t mem_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); char *page; unsigned long src = *ppos; int ret = -ESRCH; struct mm_struct *mm; if (!task) goto out_no_task; if (check_mem_permission(task)) goto out; ret = -ENOMEM; page = (char *)__get_free_page(GFP_TEMPORARY); if (!page) goto out; ret = 0; mm = get_task_mm(task); if (!mm) goto out_free; ret = -EIO; if (file->private_data != (void*)((long)current->self_exec_id)) goto out_put; ret = 0; while (count > 0) { int this_len, retval; this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; retval = access_process_vm(task, src, page, this_len, 0); if (!retval || check_mem_permission(task)) { if (!ret) ret = -EIO; break; } if (copy_to_user(buf, page, retval)) { ret = -EFAULT; break; } ret += retval; src += retval; buf += retval; count -= retval; } *ppos = src; out_put: mmput(mm); out_free: free_page((unsigned long) page); out: put_task_struct(task); out_no_task: return ret; }
static ssize_t mem_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); char *page; unsigned long src = *ppos; int ret = -ESRCH; struct mm_struct *mm; if (!task) goto out_no_task; if (check_mem_permission(task)) goto out; ret = -ENOMEM; page = (char *)__get_free_page(GFP_TEMPORARY); if (!page) goto out; ret = 0; mm = get_task_mm(task); if (!mm) goto out_free; ret = -EIO; if (file->private_data != (void*)((long)current->self_exec_id)) goto out_put; ret = 0; while (count > 0) { int this_len, retval; this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; retval = access_process_vm(task, src, page, this_len, 0); if (!retval || check_mem_permission(task)) { if (!ret) ret = -EIO; break; } if (copy_to_user(buf, page, retval)) { ret = -EFAULT; break; } ret += retval; src += retval; buf += retval; count -= retval; } *ppos = src; out_put: mmput(mm); out_free: free_page((unsigned long) page); out: put_task_struct(task); out_no_task: return ret; }
C
linux
0
CVE-2013-2017
https://www.cvedetails.com/cve/CVE-2013-2017/
CWE-399
https://github.com/torvalds/linux/commit/6ec82562ffc6f297d0de36d65776cff8e5704867
6ec82562ffc6f297d0de36d65776cff8e5704867
veth: Dont kfree_skb() after dev_forward_skb() In case of congestion, netif_rx() frees the skb, so we must assume dev_forward_skb() also consume skb. Bug introduced by commit 445409602c092 (veth: move loopback logic to common location) We must change dev_forward_skb() to always consume skb, and veth to not double free it. Bug report : http://marc.info/?l=linux-netdev&m=127310770900442&w=3 Reported-by: Martín Ferrari <martin.ferrari@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static int dev_gso_segment(struct sk_buff *skb) { struct net_device *dev = skb->dev; struct sk_buff *segs; int features = dev->features & ~(illegal_highdma(dev, skb) ? NETIF_F_SG : 0); segs = skb_gso_segment(skb, features); /* Verifying header integrity only. */ if (!segs) return 0; if (IS_ERR(segs)) return PTR_ERR(segs); skb->next = segs; DEV_GSO_CB(skb)->destructor = skb->destructor; skb->destructor = dev_gso_skb_destructor; return 0; }
static int dev_gso_segment(struct sk_buff *skb) { struct net_device *dev = skb->dev; struct sk_buff *segs; int features = dev->features & ~(illegal_highdma(dev, skb) ? NETIF_F_SG : 0); segs = skb_gso_segment(skb, features); /* Verifying header integrity only. */ if (!segs) return 0; if (IS_ERR(segs)) return PTR_ERR(segs); skb->next = segs; DEV_GSO_CB(skb)->destructor = skb->destructor; skb->destructor = dev_gso_skb_destructor; return 0; }
C
linux
0
CVE-2019-12818
https://www.cvedetails.com/cve/CVE-2019-12818/
CWE-476
https://github.com/torvalds/linux/commit/58bdd544e2933a21a51eecf17c3f5f94038261b5
58bdd544e2933a21a51eecf17c3f5f94038261b5
net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails KASAN report this: BUG: KASAN: null-ptr-deref in nfc_llcp_build_gb+0x37f/0x540 [nfc] Read of size 3 at addr 0000000000000000 by task syz-executor.0/5401 CPU: 0 PID: 5401 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xfa/0x1ce lib/dump_stack.c:113 kasan_report+0x171/0x18d mm/kasan/report.c:321 memcpy+0x1f/0x50 mm/kasan/common.c:130 nfc_llcp_build_gb+0x37f/0x540 [nfc] nfc_llcp_register_device+0x6eb/0xb50 [nfc] nfc_register_device+0x50/0x1d0 [nfc] nfcsim_device_new+0x394/0x67d [nfcsim] ? 0xffffffffc1080000 nfcsim_init+0x6b/0x1000 [nfcsim] do_one_initcall+0xfa/0x5ca init/main.c:887 do_init_module+0x204/0x5f6 kernel/module.c:3460 load_module+0x66b2/0x8570 kernel/module.c:3808 __do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9cb79dcc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000003 RBP: 00007f9cb79dcc70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9cb79dd6bc R13: 00000000004bcefb R14: 00000000006f7030 R15: 0000000000000004 nfc_llcp_build_tlv will return NULL on fails, caller should check it, otherwise will trigger a NULL dereference. Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: eda21f16a5ed ("NFC: Set MIU and RW values from CONNECT and CC LLCP frames") Fixes: d646960f7986 ("NFC: Initial LLCP support") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static void nfc_llcp_recv_snl(struct nfc_llcp_local *local, struct sk_buff *skb) { struct nfc_llcp_sock *llcp_sock; u8 dsap, ssap, *tlv, type, length, tid, sap; u16 tlv_len, offset; char *service_name; size_t service_name_len; struct nfc_llcp_sdp_tlv *sdp; HLIST_HEAD(llc_sdres_list); size_t sdres_tlvs_len; HLIST_HEAD(nl_sdres_list); dsap = nfc_llcp_dsap(skb); ssap = nfc_llcp_ssap(skb); pr_debug("%d %d\n", dsap, ssap); if (dsap != LLCP_SAP_SDP || ssap != LLCP_SAP_SDP) { pr_err("Wrong SNL SAP\n"); return; } tlv = &skb->data[LLCP_HEADER_SIZE]; tlv_len = skb->len - LLCP_HEADER_SIZE; offset = 0; sdres_tlvs_len = 0; while (offset < tlv_len) { type = tlv[0]; length = tlv[1]; switch (type) { case LLCP_TLV_SDREQ: tid = tlv[2]; service_name = (char *) &tlv[3]; service_name_len = length - 1; pr_debug("Looking for %.16s\n", service_name); if (service_name_len == strlen("urn:nfc:sn:sdp") && !strncmp(service_name, "urn:nfc:sn:sdp", service_name_len)) { sap = 1; goto add_snl; } llcp_sock = nfc_llcp_sock_from_sn(local, service_name, service_name_len); if (!llcp_sock) { sap = 0; goto add_snl; } /* * We found a socket but its ssap has not been reserved * yet. We need to assign it for good and send a reply. * The ssap will be freed when the socket is closed. */ if (llcp_sock->ssap == LLCP_SDP_UNBOUND) { atomic_t *client_count; sap = nfc_llcp_reserve_sdp_ssap(local); pr_debug("Reserving %d\n", sap); if (sap == LLCP_SAP_MAX) { sap = 0; goto add_snl; } client_count = &local->local_sdp_cnt[sap - LLCP_WKS_NUM_SAP]; atomic_inc(client_count); llcp_sock->ssap = sap; llcp_sock->reserved_ssap = sap; } else { sap = llcp_sock->ssap; } pr_debug("%p %d\n", llcp_sock, sap); add_snl: sdp = nfc_llcp_build_sdres_tlv(tid, sap); if (sdp == NULL) goto exit; sdres_tlvs_len += sdp->tlv_len; hlist_add_head(&sdp->node, &llc_sdres_list); break; case LLCP_TLV_SDRES: mutex_lock(&local->sdreq_lock); pr_debug("LLCP_TLV_SDRES: searching tid %d\n", tlv[2]); hlist_for_each_entry(sdp, &local->pending_sdreqs, node) { if (sdp->tid != tlv[2]) continue; sdp->sap = tlv[3]; pr_debug("Found: uri=%s, sap=%d\n", sdp->uri, sdp->sap); hlist_del(&sdp->node); hlist_add_head(&sdp->node, &nl_sdres_list); break; } mutex_unlock(&local->sdreq_lock); break; default: pr_err("Invalid SNL tlv value 0x%x\n", type); break; } offset += length + 2; tlv += length + 2; } exit: if (!hlist_empty(&nl_sdres_list)) nfc_genl_llc_send_sdres(local->dev, &nl_sdres_list); if (!hlist_empty(&llc_sdres_list)) nfc_llcp_send_snl_sdres(local, &llc_sdres_list, sdres_tlvs_len); }
static void nfc_llcp_recv_snl(struct nfc_llcp_local *local, struct sk_buff *skb) { struct nfc_llcp_sock *llcp_sock; u8 dsap, ssap, *tlv, type, length, tid, sap; u16 tlv_len, offset; char *service_name; size_t service_name_len; struct nfc_llcp_sdp_tlv *sdp; HLIST_HEAD(llc_sdres_list); size_t sdres_tlvs_len; HLIST_HEAD(nl_sdres_list); dsap = nfc_llcp_dsap(skb); ssap = nfc_llcp_ssap(skb); pr_debug("%d %d\n", dsap, ssap); if (dsap != LLCP_SAP_SDP || ssap != LLCP_SAP_SDP) { pr_err("Wrong SNL SAP\n"); return; } tlv = &skb->data[LLCP_HEADER_SIZE]; tlv_len = skb->len - LLCP_HEADER_SIZE; offset = 0; sdres_tlvs_len = 0; while (offset < tlv_len) { type = tlv[0]; length = tlv[1]; switch (type) { case LLCP_TLV_SDREQ: tid = tlv[2]; service_name = (char *) &tlv[3]; service_name_len = length - 1; pr_debug("Looking for %.16s\n", service_name); if (service_name_len == strlen("urn:nfc:sn:sdp") && !strncmp(service_name, "urn:nfc:sn:sdp", service_name_len)) { sap = 1; goto add_snl; } llcp_sock = nfc_llcp_sock_from_sn(local, service_name, service_name_len); if (!llcp_sock) { sap = 0; goto add_snl; } /* * We found a socket but its ssap has not been reserved * yet. We need to assign it for good and send a reply. * The ssap will be freed when the socket is closed. */ if (llcp_sock->ssap == LLCP_SDP_UNBOUND) { atomic_t *client_count; sap = nfc_llcp_reserve_sdp_ssap(local); pr_debug("Reserving %d\n", sap); if (sap == LLCP_SAP_MAX) { sap = 0; goto add_snl; } client_count = &local->local_sdp_cnt[sap - LLCP_WKS_NUM_SAP]; atomic_inc(client_count); llcp_sock->ssap = sap; llcp_sock->reserved_ssap = sap; } else { sap = llcp_sock->ssap; } pr_debug("%p %d\n", llcp_sock, sap); add_snl: sdp = nfc_llcp_build_sdres_tlv(tid, sap); if (sdp == NULL) goto exit; sdres_tlvs_len += sdp->tlv_len; hlist_add_head(&sdp->node, &llc_sdres_list); break; case LLCP_TLV_SDRES: mutex_lock(&local->sdreq_lock); pr_debug("LLCP_TLV_SDRES: searching tid %d\n", tlv[2]); hlist_for_each_entry(sdp, &local->pending_sdreqs, node) { if (sdp->tid != tlv[2]) continue; sdp->sap = tlv[3]; pr_debug("Found: uri=%s, sap=%d\n", sdp->uri, sdp->sap); hlist_del(&sdp->node); hlist_add_head(&sdp->node, &nl_sdres_list); break; } mutex_unlock(&local->sdreq_lock); break; default: pr_err("Invalid SNL tlv value 0x%x\n", type); break; } offset += length + 2; tlv += length + 2; } exit: if (!hlist_empty(&nl_sdres_list)) nfc_genl_llc_send_sdres(local->dev, &nl_sdres_list); if (!hlist_empty(&llc_sdres_list)) nfc_llcp_send_snl_sdres(local, &llc_sdres_list, sdres_tlvs_len); }
C
linux
0
CVE-2015-8325
https://www.cvedetails.com/cve/CVE-2015-8325/
CWE-264
https://anongit.mindrot.org/openssh.git/commit/?id=85bdcd7c92fe7ff133bbc4e10a65c91810f88755
85bdcd7c92fe7ff133bbc4e10a65c91810f88755
null
auth_sock_cleanup_proc(struct passwd *pw) { if (auth_sock_name != NULL) { temporarily_use_uid(pw); unlink(auth_sock_name); rmdir(auth_sock_dir); auth_sock_name = NULL; restore_uid(); } }
auth_sock_cleanup_proc(struct passwd *pw) { if (auth_sock_name != NULL) { temporarily_use_uid(pw); unlink(auth_sock_name); rmdir(auth_sock_dir); auth_sock_name = NULL; restore_uid(); } }
C
mindrot
0
CVE-2018-7752
https://www.cvedetails.com/cve/CVE-2018-7752/
CWE-119
https://github.com/gpac/gpac/commit/90dc7f853d31b0a4e9441cba97feccf36d8b69a4
90dc7f853d31b0a4e9441cba97feccf36d8b69a4
fix some exploitable overflows (#994, #997)
GF_Err hvcc_Read(GF_Box *s, GF_BitStream *bs) { u64 pos; GF_HEVCConfigurationBox *ptr = (GF_HEVCConfigurationBox *)s; if (ptr->config) gf_odf_hevc_cfg_del(ptr->config); pos = gf_bs_get_position(bs); ptr->config = gf_odf_hevc_cfg_read_bs(bs, (s->type == GF_ISOM_BOX_TYPE_HVCC) ? GF_FALSE : GF_TRUE); pos = gf_bs_get_position(bs) - pos ; if (pos < ptr->size) ptr->size -= (u32) pos; return ptr->config ? GF_OK : GF_ISOM_INVALID_FILE; }
GF_Err hvcc_Read(GF_Box *s, GF_BitStream *bs) { u64 pos; GF_HEVCConfigurationBox *ptr = (GF_HEVCConfigurationBox *)s; if (ptr->config) gf_odf_hevc_cfg_del(ptr->config); pos = gf_bs_get_position(bs); ptr->config = gf_odf_hevc_cfg_read_bs(bs, (s->type == GF_ISOM_BOX_TYPE_HVCC) ? GF_FALSE : GF_TRUE); pos = gf_bs_get_position(bs) - pos ; if (pos < ptr->size) ptr->size -= (u32) pos; return ptr->config ? GF_OK : GF_ISOM_INVALID_FILE; }
C
gpac
0
CVE-2017-11144
https://www.cvedetails.com/cve/CVE-2017-11144/
CWE-754
https://git.php.net/?p=php-src.git;a=commit;h=73cabfedf519298e1a11192699f44d53c529315e
73cabfedf519298e1a11192699f44d53c529315e
null
static void php_csr_free(zend_resource *rsrc) { X509_REQ * csr = (X509_REQ*)rsrc->ptr; X509_REQ_free(csr); }
static void php_csr_free(zend_resource *rsrc) { X509_REQ * csr = (X509_REQ*)rsrc->ptr; X509_REQ_free(csr); }
C
php
0
CVE-2018-6094
https://www.cvedetails.com/cve/CVE-2018-6094/
CWE-119
https://github.com/chromium/chromium/commit/0749ec24fae74ec32d0567eef0e5ec43c84dbcb9
0749ec24fae74ec32d0567eef0e5ec43c84dbcb9
Call HeapObjectHeader::checkHeader solely for its side-effect. This requires changing its signature. This is a preliminary stage to making it private. BUG=633030 Review-Url: https://codereview.chromium.org/2698673003 Cr-Commit-Position: refs/heads/master@{#460489}
Address BaseArena::lazySweep(size_t allocationSize, size_t gcInfoIndex) { if (!m_firstUnsweptPage) return nullptr; RELEASE_ASSERT(getThreadState()->isSweepingInProgress()); if (getThreadState()->sweepForbidden()) return nullptr; TRACE_EVENT0("blink_gc", "BaseArena::lazySweepPages"); ThreadState::SweepForbiddenScope sweepForbidden(getThreadState()); ScriptForbiddenIfMainThreadScope scriptForbidden; double startTime = WTF::currentTimeMS(); Address result = lazySweepPages(allocationSize, gcInfoIndex); getThreadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime); ThreadHeap::reportMemoryUsageForTracing(); return result; }
Address BaseArena::lazySweep(size_t allocationSize, size_t gcInfoIndex) { if (!m_firstUnsweptPage) return nullptr; RELEASE_ASSERT(getThreadState()->isSweepingInProgress()); if (getThreadState()->sweepForbidden()) return nullptr; TRACE_EVENT0("blink_gc", "BaseArena::lazySweepPages"); ThreadState::SweepForbiddenScope sweepForbidden(getThreadState()); ScriptForbiddenIfMainThreadScope scriptForbidden; double startTime = WTF::currentTimeMS(); Address result = lazySweepPages(allocationSize, gcInfoIndex); getThreadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime); ThreadHeap::reportMemoryUsageForTracing(); return result; }
C
Chrome
0
CVE-2017-15420
https://www.cvedetails.com/cve/CVE-2017-15420/
CWE-20
https://github.com/chromium/chromium/commit/56a84aa67bb071a33a48ac1481b555c48e0a9a59
56a84aa67bb071a33a48ac1481b555c48e0a9a59
Do not use NavigationEntry to block history navigations. This is no longer necessary after r477371. BUG=777419 TEST=See bug for repro steps. Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation Change-Id: I701e4d4853858281b43e3743b12274dbeadfbf18 Reviewed-on: https://chromium-review.googlesource.com/733959 Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Commit-Queue: Charlie Reis <creis@chromium.org> Cr-Commit-Position: refs/heads/master@{#511942}
WebContentsLoadFinishedWaiter(WebContents* web_contents, const GURL& expected_url) : WebContentsObserver(web_contents), expected_url_(expected_url), message_loop_runner_(new MessageLoopRunner) { EXPECT_TRUE(web_contents != NULL); }
WebContentsLoadFinishedWaiter(WebContents* web_contents, const GURL& expected_url) : WebContentsObserver(web_contents), expected_url_(expected_url), message_loop_runner_(new MessageLoopRunner) { EXPECT_TRUE(web_contents != NULL); }
C
Chrome
0
CVE-2017-0376
https://www.cvedetails.com/cve/CVE-2017-0376/
CWE-617
https://github.com/torproject/tor/commit/56a7c5bc15e0447203a491c1ee37de9939ad1dcd
56a7c5bc15e0447203a491c1ee37de9939ad1dcd
TROVE-2017-005: Fix assertion failure in connection_edge_process_relay_cell On an hidden service rendezvous circuit, a BEGIN_DIR could be sent (maliciously) which would trigger a tor_assert() because connection_edge_process_relay_cell() thought that the circuit is an or_circuit_t but is an origin circuit in reality. Fixes #22494 Reported-by: Roger Dingledine <arma@torproject.org> Signed-off-by: David Goulet <dgoulet@torproject.org>
circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, cell_direction_t cell_direction) { channel_t *chan = NULL; crypt_path_t *layer_hint=NULL; char recognized=0; int reason; tor_assert(cell); tor_assert(circ); tor_assert(cell_direction == CELL_DIRECTION_OUT || cell_direction == CELL_DIRECTION_IN); if (circ->marked_for_close) return 0; if (relay_crypt(circ, cell, cell_direction, &layer_hint, &recognized) < 0) { log_warn(LD_BUG,"relay crypt failed. Dropping connection."); return -END_CIRC_REASON_INTERNAL; } if (recognized) { edge_connection_t *conn = NULL; if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { pathbias_check_probe_response(circ, cell); /* We need to drop this cell no matter what to avoid code that expects * a certain purpose (such as the hidserv code). */ return 0; } conn = relay_lookup_conn(circ, cell, cell_direction, layer_hint); if (cell_direction == CELL_DIRECTION_OUT) { ++stats_n_relay_cells_delivered; log_debug(LD_OR,"Sending away from origin."); if ((reason=connection_edge_process_relay_cell(cell, circ, conn, NULL)) < 0) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "connection_edge_process_relay_cell (away from origin) " "failed."); return reason; } } if (cell_direction == CELL_DIRECTION_IN) { ++stats_n_relay_cells_delivered; log_debug(LD_OR,"Sending to origin."); if ((reason = connection_edge_process_relay_cell(cell, circ, conn, layer_hint)) < 0) { log_warn(LD_OR, "connection_edge_process_relay_cell (at origin) failed."); return reason; } } return 0; } /* not recognized. pass it on. */ if (cell_direction == CELL_DIRECTION_OUT) { cell->circ_id = circ->n_circ_id; /* switch it */ chan = circ->n_chan; } else if (! CIRCUIT_IS_ORIGIN(circ)) { cell->circ_id = TO_OR_CIRCUIT(circ)->p_circ_id; /* switch it */ chan = TO_OR_CIRCUIT(circ)->p_chan; } else { log_fn(LOG_PROTOCOL_WARN, LD_OR, "Dropping unrecognized inbound cell on origin circuit."); /* If we see unrecognized cells on path bias testing circs, * it's bad mojo. Those circuits need to die. * XXX: Shouldn't they always die? */ if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { TO_ORIGIN_CIRCUIT(circ)->path_state = PATH_STATE_USE_FAILED; return -END_CIRC_REASON_TORPROTOCOL; } else { return 0; } } if (!chan) { if (! CIRCUIT_IS_ORIGIN(circ) && TO_OR_CIRCUIT(circ)->rend_splice && cell_direction == CELL_DIRECTION_OUT) { or_circuit_t *splice = TO_OR_CIRCUIT(circ)->rend_splice; tor_assert(circ->purpose == CIRCUIT_PURPOSE_REND_ESTABLISHED); tor_assert(splice->base_.purpose == CIRCUIT_PURPOSE_REND_ESTABLISHED); cell->circ_id = splice->p_circ_id; cell->command = CELL_RELAY; /* can't be relay_early anyway */ if ((reason = circuit_receive_relay_cell(cell, TO_CIRCUIT(splice), CELL_DIRECTION_IN)) < 0) { log_warn(LD_REND, "Error relaying cell across rendezvous; closing " "circuits"); /* XXXX Do this here, or just return -1? */ circuit_mark_for_close(circ, -reason); return reason; } return 0; } log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Didn't recognize cell, but circ stops here! Closing circ."); return -END_CIRC_REASON_TORPROTOCOL; } log_debug(LD_OR,"Passing on unrecognized cell."); ++stats_n_relay_cells_relayed; /* XXXX no longer quite accurate {cells} * we might kill the circ before we relay * the cells. */ append_cell_to_circuit_queue(circ, chan, cell, cell_direction, 0); return 0; }
circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, cell_direction_t cell_direction) { channel_t *chan = NULL; crypt_path_t *layer_hint=NULL; char recognized=0; int reason; tor_assert(cell); tor_assert(circ); tor_assert(cell_direction == CELL_DIRECTION_OUT || cell_direction == CELL_DIRECTION_IN); if (circ->marked_for_close) return 0; if (relay_crypt(circ, cell, cell_direction, &layer_hint, &recognized) < 0) { log_warn(LD_BUG,"relay crypt failed. Dropping connection."); return -END_CIRC_REASON_INTERNAL; } if (recognized) { edge_connection_t *conn = NULL; if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { pathbias_check_probe_response(circ, cell); /* We need to drop this cell no matter what to avoid code that expects * a certain purpose (such as the hidserv code). */ return 0; } conn = relay_lookup_conn(circ, cell, cell_direction, layer_hint); if (cell_direction == CELL_DIRECTION_OUT) { ++stats_n_relay_cells_delivered; log_debug(LD_OR,"Sending away from origin."); if ((reason=connection_edge_process_relay_cell(cell, circ, conn, NULL)) < 0) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "connection_edge_process_relay_cell (away from origin) " "failed."); return reason; } } if (cell_direction == CELL_DIRECTION_IN) { ++stats_n_relay_cells_delivered; log_debug(LD_OR,"Sending to origin."); if ((reason = connection_edge_process_relay_cell(cell, circ, conn, layer_hint)) < 0) { log_warn(LD_OR, "connection_edge_process_relay_cell (at origin) failed."); return reason; } } return 0; } /* not recognized. pass it on. */ if (cell_direction == CELL_DIRECTION_OUT) { cell->circ_id = circ->n_circ_id; /* switch it */ chan = circ->n_chan; } else if (! CIRCUIT_IS_ORIGIN(circ)) { cell->circ_id = TO_OR_CIRCUIT(circ)->p_circ_id; /* switch it */ chan = TO_OR_CIRCUIT(circ)->p_chan; } else { log_fn(LOG_PROTOCOL_WARN, LD_OR, "Dropping unrecognized inbound cell on origin circuit."); /* If we see unrecognized cells on path bias testing circs, * it's bad mojo. Those circuits need to die. * XXX: Shouldn't they always die? */ if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { TO_ORIGIN_CIRCUIT(circ)->path_state = PATH_STATE_USE_FAILED; return -END_CIRC_REASON_TORPROTOCOL; } else { return 0; } } if (!chan) { if (! CIRCUIT_IS_ORIGIN(circ) && TO_OR_CIRCUIT(circ)->rend_splice && cell_direction == CELL_DIRECTION_OUT) { or_circuit_t *splice = TO_OR_CIRCUIT(circ)->rend_splice; tor_assert(circ->purpose == CIRCUIT_PURPOSE_REND_ESTABLISHED); tor_assert(splice->base_.purpose == CIRCUIT_PURPOSE_REND_ESTABLISHED); cell->circ_id = splice->p_circ_id; cell->command = CELL_RELAY; /* can't be relay_early anyway */ if ((reason = circuit_receive_relay_cell(cell, TO_CIRCUIT(splice), CELL_DIRECTION_IN)) < 0) { log_warn(LD_REND, "Error relaying cell across rendezvous; closing " "circuits"); /* XXXX Do this here, or just return -1? */ circuit_mark_for_close(circ, -reason); return reason; } return 0; } log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Didn't recognize cell, but circ stops here! Closing circ."); return -END_CIRC_REASON_TORPROTOCOL; } log_debug(LD_OR,"Passing on unrecognized cell."); ++stats_n_relay_cells_relayed; /* XXXX no longer quite accurate {cells} * we might kill the circ before we relay * the cells. */ append_cell_to_circuit_queue(circ, chan, cell, cell_direction, 0); return 0; }
C
tor
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 <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) { struct page *p = rq->pages; if (p) { rq->pages = (struct page *)p->private; /* clear private here, it is used to chain pages */ p->private = 0; } else p = alloc_page(gfp_mask); return p; }
static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) { struct page *p = rq->pages; if (p) { rq->pages = (struct page *)p->private; /* clear private here, it is used to chain pages */ p->private = 0; } else p = alloc_page(gfp_mask); return p; }
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 <keescook@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
static int sha1_export(struct shash_desc *desc, void *out) { struct sha1_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; }
static int sha1_export(struct shash_desc *desc, void *out) { struct sha1_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; }
C
linux
0
CVE-2016-10197
https://www.cvedetails.com/cve/CVE-2016-10197/
CWE-125
https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the _Tor bug bounty program_. Please credit Guido accordingly. ## Bug report The DNS code of Libevent contains this rather obvious OOB read: ```c static char * search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; ``` If the length of ```base_name``` is 0, then line 3125 reads 1 byte before the buffer. This will trigger a crash on ASAN-protected builds. To reproduce: Build libevent with ASAN: ``` $ CFLAGS='-fomit-frame-pointer -fsanitize=address' ./configure && make -j4 ``` Put the attached ```resolv.conf``` and ```poc.c``` in the source directory and then do: ``` $ gcc -fsanitize=address -fomit-frame-pointer poc.c .libs/libevent.a $ ./a.out ================================================================= ==22201== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060000efdf at pc 0x4429da bp 0x7ffe1ed47300 sp 0x7ffe1ed472f8 READ of size 1 at 0x60060000efdf thread T0 ``` P.S. we can add a check earlier, but since this is very uncommon, I didn't add it. Fixes: #332
int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr) { return evdns_base_resolve_ipv6(current_base, name, flags, callback, ptr) ? 0 : -1; }
int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr) { return evdns_base_resolve_ipv6(current_base, name, flags, callback, ptr) ? 0 : -1; }
C
libevent
0
CVE-2013-7262
https://www.cvedetails.com/cve/CVE-2013-7262/
CWE-89
https://github.com/mapserver/mapserver/commit/3a10f6b829297dae63492a8c63385044bc6953ed
3a10f6b829297dae63492a8c63385044bc6953ed
Fix potential SQL Injection with postgis TIME filters (#4834)
void msPostGISFreeLayerInfo(layerObj *layer) { msPostGISLayerInfo *layerinfo = NULL; layerinfo = (msPostGISLayerInfo*)layer->layerinfo; if ( layerinfo->sql ) free(layerinfo->sql); if ( layerinfo->uid ) free(layerinfo->uid); if ( layerinfo->srid ) free(layerinfo->srid); if ( layerinfo->geomcolumn ) free(layerinfo->geomcolumn); if ( layerinfo->fromsource ) free(layerinfo->fromsource); if ( layerinfo->pgresult ) PQclear(layerinfo->pgresult); if ( layerinfo->pgconn ) msConnPoolRelease(layer, layerinfo->pgconn); free(layerinfo); layer->layerinfo = NULL; }
void msPostGISFreeLayerInfo(layerObj *layer) { msPostGISLayerInfo *layerinfo = NULL; layerinfo = (msPostGISLayerInfo*)layer->layerinfo; if ( layerinfo->sql ) free(layerinfo->sql); if ( layerinfo->uid ) free(layerinfo->uid); if ( layerinfo->srid ) free(layerinfo->srid); if ( layerinfo->geomcolumn ) free(layerinfo->geomcolumn); if ( layerinfo->fromsource ) free(layerinfo->fromsource); if ( layerinfo->pgresult ) PQclear(layerinfo->pgresult); if ( layerinfo->pgconn ) msConnPoolRelease(layer, layerinfo->pgconn); free(layerinfo); layer->layerinfo = NULL; }
C
mapserver
0
null
null
null
https://github.com/chromium/chromium/commit/dc3857aac17be72c96f28d860d875235b3be349a
dc3857aac17be72c96f28d860d875235b3be349a
Unreviewed, rolling out r142736. http://trac.webkit.org/changeset/142736 https://bugs.webkit.org/show_bug.cgi?id=109716 Broke ABI, nightly builds crash on launch (Requested by ap on #webkit). Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-13 Source/WebKit2: * Shared/APIClientTraits.cpp: (WebKit): * Shared/APIClientTraits.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/gtk/WebKitLoaderClient.cpp: (attachLoaderClientToView): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/qt/QtBuiltinBundlePage.cpp: (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): Tools: * MiniBrowser/mac/WK2BrowserWindowController.m: (-[WK2BrowserWindowController awakeFromNib]): * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::InjectedBundlePage): * WebKitTestRunner/TestController.cpp: (WTR::TestController::createWebViewWithOptions): git-svn-id: svn://svn.chromium.org/blink/trunk@142762 bbb929c8-8fbe-4397-9dbb-9b2b20218538
TestCommand parseInputLine(const std::string& inputLine) { TestCommand result; CommandTokenizer tokenizer(inputLine); if (!tokenizer.hasNext()) die(inputLine); std::string arg = tokenizer.next(); result.pathOrURL = arg; while (tokenizer.hasNext()) { arg = tokenizer.next(); if (arg == std::string("--timeout")) { std::string timeoutToken = tokenizer.next(); result.timeout = atoi(timeoutToken.c_str()); } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) { result.shouldDumpPixels = true; if (tokenizer.hasNext()) result.expectedPixelHash = tokenizer.next(); } else die(inputLine); } return result; }
TestCommand parseInputLine(const std::string& inputLine) { TestCommand result; CommandTokenizer tokenizer(inputLine); if (!tokenizer.hasNext()) die(inputLine); std::string arg = tokenizer.next(); result.pathOrURL = arg; while (tokenizer.hasNext()) { arg = tokenizer.next(); if (arg == std::string("--timeout")) { std::string timeoutToken = tokenizer.next(); result.timeout = atoi(timeoutToken.c_str()); } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) { result.shouldDumpPixels = true; if (tokenizer.hasNext()) result.expectedPixelHash = tokenizer.next(); } else die(inputLine); } return result; }
C
Chrome
0
CVE-2012-2870
https://www.cvedetails.com/cve/CVE-2012-2870/
CWE-399
https://github.com/chromium/chromium/commit/9939d35f9827ed0929646607cbdb071af627ac38
9939d35f9827ed0929646607cbdb071af627ac38
Handle a bad XSLT expression better. BUG=138672 Review URL: https://chromiumcodereview.appspot.com/10830177 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150123 0039d316-1c4b-4281-b951-d872f2087c98
xsltCleanupTemplates(xsltStylesheetPtr style ATTRIBUTE_UNUSED) { }
xsltCleanupTemplates(xsltStylesheetPtr style ATTRIBUTE_UNUSED) { }
C
Chrome
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance R=kbr@chromium.org,bajones@chromium.org Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
void GLES2DecoderImpl::DoTexParameterfv( GLenum target, GLenum pname, const GLfloat* params) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); return; } texture_manager()->SetParameterf( "glTexParameterfv", GetErrorState(), texture, pname, *params); }
void GLES2DecoderImpl::DoTexParameterfv( GLenum target, GLenum pname, const GLfloat* params) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); return; } texture_manager()->SetParameterf( "glTexParameterfv", GetErrorState(), texture, pname, *params); }
C
Chrome
0
CVE-2011-3084
https://www.cvedetails.com/cve/CVE-2011-3084/
CWE-264
https://github.com/chromium/chromium/commit/744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
Allow browser to handle all WebUI navigations. BUG=113496 TEST="Google Dashboard" link in Sync settings loads in new process. Review URL: http://codereview.chromium.org/9663045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126949 0039d316-1c4b-4281-b951-d872f2087c98
virtual ~AudioRendererImplTest() {}
virtual ~AudioRendererImplTest() {}
C
Chrome
0
CVE-2018-16068
https://www.cvedetails.com/cve/CVE-2018-16068/
CWE-20
https://github.com/chromium/chromium/commit/66e24a8793615bd9d5c238b1745b093090e1f72d
66e24a8793615bd9d5c238b1745b093090e1f72d
[mojo-core] Validate data pipe endpoint metadata Ensures that we don't blindly trust specified buffer size and offset metadata when deserializing data pipe consumer and producer handles. Bug: 877182 Change-Id: I30f3eceafb5cee06284c2714d08357ef911d6fd9 Reviewed-on: https://chromium-review.googlesource.com/1192922 Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Ken Rockot <rockot@chromium.org> Cr-Commit-Position: refs/heads/master@{#586704}
MojoResult DataPipeConsumerDispatcher::RemoveWatcherRef( WatcherDispatcher* watcher, uintptr_t context) { base::AutoLock lock(lock_); if (is_closed_ || in_transit_) return MOJO_RESULT_INVALID_ARGUMENT; return watchers_.Remove(watcher, context); }
MojoResult DataPipeConsumerDispatcher::RemoveWatcherRef( WatcherDispatcher* watcher, uintptr_t context) { base::AutoLock lock(lock_); if (is_closed_ || in_transit_) return MOJO_RESULT_INVALID_ARGUMENT; return watchers_.Remove(watcher, context); }
C
Chrome
0
CVE-2018-11218
https://www.cvedetails.com/cve/CVE-2018-11218/
CWE-119
https://github.com/antirez/redis/commit/5ccb6f7a791bf3490357b00a898885759d98bab0
5ccb6f7a791bf3490357b00a898885759d98bab0
Security: more cmsgpack fixes by @soloestoy. @soloestoy sent me this additional fixes, after searching for similar problems to the one reported in mp_pack(). I'm committing the changes because it was not possible during to make a public PR to protect Redis users and give Redis providers some time to patch their systems.
void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) { assert(len <= UINT_MAX); int index = 1; lua_newtable(L); luaL_checkstack(L, 1, "in function mp_decode_to_lua_array"); while(len--) { lua_pushnumber(L,index++); mp_decode_to_lua_type(L,c); if (c->err) return; lua_settable(L,-3); } }
void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) { assert(len <= UINT_MAX); int index = 1; lua_newtable(L); while(len--) { lua_pushnumber(L,index++); mp_decode_to_lua_type(L,c); if (c->err) return; lua_settable(L,-3); } }
C
redis
1
CVE-2016-7134
https://www.cvedetails.com/cve/CVE-2016-7134/
CWE-119
https://github.com/php/php-src/commit/72dbb7f416160f490c4e9987040989a10ad431c7?w=1
72dbb7f416160f490c4e9987040989a10ad431c7?w=1
Fix bug #72674 - check both curl_escape and curl_unescape
static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx) { php_curl *ch = (php_curl *) ctx; php_curl_write *t = ch->handlers->write_header; size_t length = size * nmemb; switch (t->method) { case PHP_CURL_STDOUT: /* Handle special case write when we're returning the entire transfer */ if (ch->handlers->write->method == PHP_CURL_RETURN && length > 0) { smart_str_appendl(&ch->handlers->write->buf, data, (int) length); } else { PHPWRITE(data, length); } break; case PHP_CURL_FILE: return fwrite(data, size, nmemb, t->fp); case PHP_CURL_USER: { zval argv[2]; zval retval; int error; zend_fcall_info fci; ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRINGL(&argv[1], data, length); fci.size = sizeof(fci); fci.function_table = EG(function_table); ZVAL_COPY_VALUE(&fci.function_name, &t->func_name); fci.symbol_table = NULL; fci.object = NULL; fci.retval = &retval; fci.param_count = 2; fci.params = argv; fci.no_separation = 0; ch->in_callback = 1; error = zend_call_function(&fci, &t->fci_cache); ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { _php_curl_verify_handlers(ch, 1); length = zval_get_long(&retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); break; } case PHP_CURL_IGNORE: return length; default: return -1; } return length; }
static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx) { php_curl *ch = (php_curl *) ctx; php_curl_write *t = ch->handlers->write_header; size_t length = size * nmemb; switch (t->method) { case PHP_CURL_STDOUT: /* Handle special case write when we're returning the entire transfer */ if (ch->handlers->write->method == PHP_CURL_RETURN && length > 0) { smart_str_appendl(&ch->handlers->write->buf, data, (int) length); } else { PHPWRITE(data, length); } break; case PHP_CURL_FILE: return fwrite(data, size, nmemb, t->fp); case PHP_CURL_USER: { zval argv[2]; zval retval; int error; zend_fcall_info fci; ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRINGL(&argv[1], data, length); fci.size = sizeof(fci); fci.function_table = EG(function_table); ZVAL_COPY_VALUE(&fci.function_name, &t->func_name); fci.symbol_table = NULL; fci.object = NULL; fci.retval = &retval; fci.param_count = 2; fci.params = argv; fci.no_separation = 0; ch->in_callback = 1; error = zend_call_function(&fci, &t->fci_cache); ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { _php_curl_verify_handlers(ch, 1); length = zval_get_long(&retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); break; } case PHP_CURL_IGNORE: return length; default: return -1; } return length; }
C
php-src
0
CVE-2017-15397
https://www.cvedetails.com/cve/CVE-2017-15397/
CWE-311
https://github.com/chromium/chromium/commit/0579ed631fb37de5704b54ed2ee466bf29630ad0
0579ed631fb37de5704b54ed2ee466bf29630ad0
Replace base::MakeUnique with std::make_unique in net/. base/memory/ptr_util.h includes will be cleaned up later. Bug: 755727 Change-Id: Ibaf46f05c9b02b76f9a91e819984b087a8c0d434 Reviewed-on: https://chromium-review.googlesource.com/627300 Commit-Queue: Jeremy Roman <jbroman@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bence Béky <bnc@chromium.org> Cr-Commit-Position: refs/heads/master@{#498123}
void SetReadExpectation(int result) { read_result_ = result; EXPECT_CALL(*this, Read(_, _, _)) .WillOnce(Invoke(this, &MockUploadElementReader::OnRead)); }
void SetReadExpectation(int result) { read_result_ = result; EXPECT_CALL(*this, Read(_, _, _)) .WillOnce(Invoke(this, &MockUploadElementReader::OnRead)); }
C
Chrome
0
CVE-2017-14604
https://www.cvedetails.com/cve/CVE-2017-14604/
CWE-20
https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0
1630f53481f445ada0a455e9979236d31a8d3bb0
mime-actions: use file metadata for trusting desktop files Currently we only trust desktop files that have the executable bit set, and don't replace the displayed icon or the displayed name until it's trusted, which prevents for running random programs by a malicious desktop file. However, the executable permission is preserved if the desktop file comes from a compressed file. To prevent this, add a metadata::trusted metadata to the file once the user acknowledges the file as trusted. This adds metadata to the file, which cannot be added unless it has access to the computer. Also remove the SHEBANG "trusted" content we were putting inside the desktop file, since that doesn't add more security since it can come with the file itself. https://bugzilla.gnome.org/show_bug.cgi?id=777991
cancel_directory_count_for_file (NautilusDirectory *directory, NautilusFile *file) { if (directory->details->count_in_progress != NULL && directory->details->count_in_progress->count_file == file) { directory_count_cancel (directory); } }
cancel_directory_count_for_file (NautilusDirectory *directory, NautilusFile *file) { if (directory->details->count_in_progress != NULL && directory->details->count_in_progress->count_file == file) { directory_count_cancel (directory); } }
C
nautilus
0
CVE-2011-2347
https://www.cvedetails.com/cve/CVE-2011-2347/
CWE-119
https://github.com/chromium/chromium/commit/60cc89e8d2e761dea28bb9e4cf9ebbad516bff09
60cc89e8d2e761dea28bb9e4cf9ebbad516bff09
iwyu: Include callback_old.h where appropriate, final. BUG=82098 TEST=none Review URL: http://codereview.chromium.org/7003003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85003 0039d316-1c4b-4281-b951-d872f2087c98
STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress, ULONG status_code, LPCWSTR status_text) { DCHECK_EQ(thread_, base::PlatformThread::CurrentId()); if (status_.get_state() != Status::WORKING) return S_OK; if (pending_ && status_code != BINDSTATUS_REDIRECTING) return S_OK; if (!delegate_) { DVLOG(1) << "Invalid delegate"; return S_OK; } switch (status_code) { case BINDSTATUS_CONNECTING: { if (status_text) { socket_address_.set_host(WideToUTF8(status_text)); } break; } case BINDSTATUS_REDIRECTING: { base::win::ScopedComPtr<BindContextInfo> info; BindContextInfo::FromBindContext(bind_context_, info.Receive()); DCHECK(info); GURL previously_redirected(info ? info->GetUrl() : std::wstring()); if (GURL(status_text) != previously_redirected) { DVLOG(1) << __FUNCTION__ << me() << "redirect from " << url() << " to " << status_text; int http_code = GetHttpResponseStatusFromBinding(binding_); status_.SetRedirected(http_code, WideToUTF8(status_text)); binding_->Abort(); return E_ABORT; } break; } case BINDSTATUS_COOKIE_SENT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_READ); break; case BINDSTATUS_COOKIE_SUPPRESSED: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_SUPPRESS); break; case BINDSTATUS_COOKIE_STATE_ACCEPT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_ACCEPT); break; case BINDSTATUS_COOKIE_STATE_REJECT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_REJECT); break; case BINDSTATUS_COOKIE_STATE_LEASH: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_LEASH); break; case BINDSTATUS_COOKIE_STATE_DOWNGRADE: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_DOWNGRADE); break; case BINDSTATUS_COOKIE_STATE_UNKNOWN: NOTREACHED() << L"Unknown cookie state received"; break; default: DVLOG(1) << __FUNCTION__ << me() << base::StringPrintf(L"code: %i status: %ls", status_code, status_text); break; } return S_OK; }
STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress, ULONG status_code, LPCWSTR status_text) { DCHECK_EQ(thread_, base::PlatformThread::CurrentId()); if (status_.get_state() != Status::WORKING) return S_OK; if (pending_ && status_code != BINDSTATUS_REDIRECTING) return S_OK; if (!delegate_) { DVLOG(1) << "Invalid delegate"; return S_OK; } switch (status_code) { case BINDSTATUS_CONNECTING: { if (status_text) { socket_address_.set_host(WideToUTF8(status_text)); } break; } case BINDSTATUS_REDIRECTING: { base::win::ScopedComPtr<BindContextInfo> info; BindContextInfo::FromBindContext(bind_context_, info.Receive()); DCHECK(info); GURL previously_redirected(info ? info->GetUrl() : std::wstring()); if (GURL(status_text) != previously_redirected) { DVLOG(1) << __FUNCTION__ << me() << "redirect from " << url() << " to " << status_text; int http_code = GetHttpResponseStatusFromBinding(binding_); status_.SetRedirected(http_code, WideToUTF8(status_text)); binding_->Abort(); return E_ABORT; } break; } case BINDSTATUS_COOKIE_SENT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_READ); break; case BINDSTATUS_COOKIE_SUPPRESSED: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_SUPPRESS); break; case BINDSTATUS_COOKIE_STATE_ACCEPT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_ACCEPT); break; case BINDSTATUS_COOKIE_STATE_REJECT: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_REJECT); break; case BINDSTATUS_COOKIE_STATE_LEASH: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_LEASH); break; case BINDSTATUS_COOKIE_STATE_DOWNGRADE: delegate_->AddPrivacyDataForUrl(url(), "", COOKIEACTION_DOWNGRADE); break; case BINDSTATUS_COOKIE_STATE_UNKNOWN: NOTREACHED() << L"Unknown cookie state received"; break; default: DVLOG(1) << __FUNCTION__ << me() << base::StringPrintf(L"code: %i status: %ls", status_code, status_text); break; } return S_OK; }
C
Chrome
0
CVE-2017-5019
https://www.cvedetails.com/cve/CVE-2017-5019/
CWE-416
https://github.com/chromium/chromium/commit/f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <lowell@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Cr-Commit-Position: refs/heads/master@{#653137}
RenderFrameImpl::CreateWebSocketHandshakeThrottle() { WebLocalFrame* web_local_frame = GetWebFrame(); if (!web_local_frame) return nullptr; auto* render_frame = content::RenderFrame::FromWebFrame(web_local_frame); if (!render_frame) return nullptr; int render_frame_id = render_frame->GetRoutingID(); if (!websocket_handshake_throttle_provider_) { websocket_handshake_throttle_provider_ = GetContentClient() ->renderer() ->CreateWebSocketHandshakeThrottleProvider(); if (!websocket_handshake_throttle_provider_) return nullptr; } return websocket_handshake_throttle_provider_->CreateThrottle( render_frame_id, render_frame->GetTaskRunner(blink::TaskType::kInternalDefault)); }
RenderFrameImpl::CreateWebSocketHandshakeThrottle() { WebLocalFrame* web_local_frame = GetWebFrame(); if (!web_local_frame) return nullptr; auto* render_frame = content::RenderFrame::FromWebFrame(web_local_frame); if (!render_frame) return nullptr; int render_frame_id = render_frame->GetRoutingID(); if (!websocket_handshake_throttle_provider_) { websocket_handshake_throttle_provider_ = GetContentClient() ->renderer() ->CreateWebSocketHandshakeThrottleProvider(); if (!websocket_handshake_throttle_provider_) return nullptr; } return websocket_handshake_throttle_provider_->CreateThrottle( render_frame_id, render_frame->GetTaskRunner(blink::TaskType::kInternalDefault)); }
C
Chrome
0
CVE-2018-6053
https://www.cvedetails.com/cve/CVE-2018-6053/
CWE-200
https://github.com/chromium/chromium/commit/6c6888565ff1fde9ef21ef17c27ad4c8304643d2
6c6888565ff1fde9ef21ef17c27ad4c8304643d2
TopSites: Clear thumbnails from the cache when their URLs get removed We already cleared the thumbnails from persistent storage, but they remained in the in-memory cache, so they remained accessible (until the next Chrome restart) even after all browsing data was cleared. Bug: 758169 Change-Id: Id916d22358430a82e6d5043ac04fa463a32f824f Reviewed-on: https://chromium-review.googlesource.com/758640 Commit-Queue: Marc Treib <treib@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/master@{#514861}
GURL GetCanonicalURL(const GURL& url) { return top_sites()->cache_->GetCanonicalURL(url); }
GURL GetCanonicalURL(const GURL& url) { return top_sites()->cache_->GetCanonicalURL(url); }
C
Chrome
0
CVE-2018-18354
https://www.cvedetails.com/cve/CVE-2018-18354/
CWE-20
https://github.com/chromium/chromium/commit/d19a75fc26fd0ab1ce79ef3d1c1c9b3cc1fbd098
d19a75fc26fd0ab1ce79ef3d1c1c9b3cc1fbd098
Validate external protocols before launching on Windows Bug: 889459 Change-Id: Id33ca6444bff1e6dd71b6000823cf6fec09746ef Reviewed-on: https://chromium-review.googlesource.com/c/1256208 Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Mustafa Emre Acer <meacer@chromium.org> Cr-Commit-Position: refs/heads/master@{#597611}
static void Begin(const wchar_t* const protocols[], const base::Closure& on_finished_callback) { delete instance_; instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback); }
static void Begin(const wchar_t* const protocols[], const base::Closure& on_finished_callback) { delete instance_; instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback); }
C
Chrome
0
CVE-2016-3746
https://www.cvedetails.com/cve/CVE-2016-3746/
null
https://android.googlesource.com/platform/hardware/qcom/media/+/5b82f4f90c3d531313714df4b936f92fb0ff15cf
5b82f4f90c3d531313714df4b936f92fb0ff15cf
DO NOT MERGE mm-video-v4l2: vdec: Avoid processing ETBs/FTBs in invalid states (per the spec) ETB/FTB should not be handled in states other than Executing, Paused and Idle. This avoids accessing invalid buffers. Also add a lock to protect the private-buffers from being deleted while accessing from another thread. Bug: 27890802 Security Vulnerability - Heap Use-After-Free and Possible LPE in MediaServer (libOmxVdec problem #6) CRs-Fixed: 1008882 Change-Id: Iaac2e383cd53cf9cf8042c9ed93ddc76dba3907e
OMX_ERRORTYPE omx_vdec::get_extension_index(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_STRING paramName, OMX_OUT OMX_INDEXTYPE* indexType) { (void) hComp; if (m_state == OMX_StateInvalid) { DEBUG_PRINT_ERROR("Get Extension Index in Invalid State"); return OMX_ErrorInvalidState; } else if (extn_equals(paramName, "OMX.QCOM.index.param.video.SyncFrameDecodingMode")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoSyncFrameDecodingMode; } else if (extn_equals(paramName, "OMX.QCOM.index.param.IndexExtraData")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamIndexExtraDataType; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_FRAMEPACKING_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoFramePackingExtradata; } else if (extn_equals(paramName, OMX_QCOM_INDEX_CONFIG_VIDEO_FRAMEPACKING_INFO)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexConfigVideoFramePackingArrangement; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_QP_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoQPExtraData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_INPUTBITSINFO_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoInputBitsInfoExtraData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_EXTNUSER_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexEnableExtnUserData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_MPEG2SEQDISP_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamMpeg2SeqDispExtraData; } #if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_) else if (extn_equals(paramName, "OMX.google.android.index.enableAndroidNativeBuffers")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexEnableAndroidNativeBuffers; } else if (extn_equals(paramName, "OMX.google.android.index.useAndroidNativeBuffer2")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer2; } else if (extn_equals(paramName, "OMX.google.android.index.useAndroidNativeBuffer")) { DEBUG_PRINT_ERROR("Extension: %s is supported", paramName); *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer; } else if (extn_equals(paramName, "OMX.google.android.index.getAndroidNativeBufferUsage")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage; } #endif else if (extn_equals(paramName, "OMX.google.android.index.storeMetaDataInBuffers")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoMetaBufferMode; } #ifdef ADAPTIVE_PLAYBACK_SUPPORTED else if (extn_equals(paramName, "OMX.google.android.index.prepareForAdaptivePlayback")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoAdaptivePlaybackMode; } #endif #ifdef FLEXYUV_SUPPORTED else if (extn_equals(paramName,"OMX.google.android.index.describeColorFormat")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexFlexibleYUVDescription; } #endif else { DEBUG_PRINT_ERROR("Extension: %s not implemented", paramName); return OMX_ErrorNotImplemented; } return OMX_ErrorNone; }
OMX_ERRORTYPE omx_vdec::get_extension_index(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_STRING paramName, OMX_OUT OMX_INDEXTYPE* indexType) { (void) hComp; if (m_state == OMX_StateInvalid) { DEBUG_PRINT_ERROR("Get Extension Index in Invalid State"); return OMX_ErrorInvalidState; } else if (extn_equals(paramName, "OMX.QCOM.index.param.video.SyncFrameDecodingMode")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoSyncFrameDecodingMode; } else if (extn_equals(paramName, "OMX.QCOM.index.param.IndexExtraData")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamIndexExtraDataType; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_FRAMEPACKING_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoFramePackingExtradata; } else if (extn_equals(paramName, OMX_QCOM_INDEX_CONFIG_VIDEO_FRAMEPACKING_INFO)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexConfigVideoFramePackingArrangement; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_QP_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoQPExtraData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_INPUTBITSINFO_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoInputBitsInfoExtraData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_EXTNUSER_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexEnableExtnUserData; } else if (extn_equals(paramName, OMX_QCOM_INDEX_PARAM_VIDEO_MPEG2SEQDISP_EXTRADATA)) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamMpeg2SeqDispExtraData; } #if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_) else if (extn_equals(paramName, "OMX.google.android.index.enableAndroidNativeBuffers")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexEnableAndroidNativeBuffers; } else if (extn_equals(paramName, "OMX.google.android.index.useAndroidNativeBuffer2")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer2; } else if (extn_equals(paramName, "OMX.google.android.index.useAndroidNativeBuffer")) { DEBUG_PRINT_ERROR("Extension: %s is supported", paramName); *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer; } else if (extn_equals(paramName, "OMX.google.android.index.getAndroidNativeBufferUsage")) { *indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage; } #endif else if (extn_equals(paramName, "OMX.google.android.index.storeMetaDataInBuffers")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoMetaBufferMode; } #ifdef ADAPTIVE_PLAYBACK_SUPPORTED else if (extn_equals(paramName, "OMX.google.android.index.prepareForAdaptivePlayback")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoAdaptivePlaybackMode; } #endif #ifdef FLEXYUV_SUPPORTED else if (extn_equals(paramName,"OMX.google.android.index.describeColorFormat")) { *indexType = (OMX_INDEXTYPE)OMX_QcomIndexFlexibleYUVDescription; } #endif else { DEBUG_PRINT_ERROR("Extension: %s not implemented", paramName); return OMX_ErrorNotImplemented; } return OMX_ErrorNone; }
C
Android
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Karsten Keil <isdn@linux-pingi.de> CC: "David S. Miller" <davem@davemloft.net> CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: Patrick McHardy <kaber@trash.net> CC: Krzysztof Halasa <khc@pm.waw.pl> CC: "John W. Linville" <linville@tuxdriver.com> CC: Greg Kroah-Hartman <gregkh@suse.de> CC: Marcel Holtmann <marcel@holtmann.org> CC: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
static int airo_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rthr = vwrq->value; if(vwrq->disabled) rthr = AIRO_DEF_MTU; if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { return -EINVAL; } readConfigRid(local, 1); local->config.rtsThres = cpu_to_le16(rthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
static int airo_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rthr = vwrq->value; if(vwrq->disabled) rthr = AIRO_DEF_MTU; if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { return -EINVAL; } readConfigRid(local, 1); local->config.rtsThres = cpu_to_le16(rthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
C
linux
0
CVE-2016-3138
https://www.cvedetails.com/cve/CVE-2016-3138/
null
https://github.com/torvalds/linux/commit/8835ba4a39cf53f705417b3b3a94eb067673f2c9
8835ba4a39cf53f705417b3b3a94eb067673f2c9
USB: cdc-acm: more sanity checking An attack has become available which pretends to be a quirky device circumventing normal sanity checks and crashes the kernel by an insufficient number of interfaces. This patch adds a check to the code path for quirky devices. Signed-off-by: Oliver Neukum <ONeukum@suse.com> CC: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
static void acm_port_destruct(struct tty_port *port) { struct acm *acm = container_of(port, struct acm, port); dev_dbg(&acm->control->dev, "%s\n", __func__); acm_release_minor(acm); usb_put_intf(acm->control); kfree(acm->country_codes); kfree(acm); }
static void acm_port_destruct(struct tty_port *port) { struct acm *acm = container_of(port, struct acm, port); dev_dbg(&acm->control->dev, "%s\n", __func__); acm_release_minor(acm); usb_put_intf(acm->control); kfree(acm->country_codes); kfree(acm); }
C
linux
0
CVE-2019-5822
https://www.cvedetails.com/cve/CVE-2019-5822/
CWE-284
https://github.com/chromium/chromium/commit/2f81d000fdb5331121cba7ff81dfaaec25b520a5
2f81d000fdb5331121cba7ff81dfaaec25b520a5
When turning a download into a navigation, navigate the right frame Code changes from Nate Chapin <japhet@chromium.org> Bug: 926105 Change-Id: I098599394e6ebe7d2fce5af838014297a337d294 Reviewed-on: https://chromium-review.googlesource.com/c/1454962 Reviewed-by: Camille Lamy <clamy@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#629547}
base::FilePath DestinationFile(Browser* browser, const base::FilePath& file) { return GetDownloadDirectory(browser).Append(file.BaseName()); }
base::FilePath DestinationFile(Browser* browser, const base::FilePath& file) { return GetDownloadDirectory(browser).Append(file.BaseName()); }
C
Chrome
0
CVE-2013-0921
https://www.cvedetails.com/cve/CVE-2013-0921/
CWE-264
https://github.com/chromium/chromium/commit/e9841fbdaf41b4a2baaa413f94d5c0197f9261f4
e9841fbdaf41b4a2baaa413f94d5c0197f9261f4
Ensure extensions and the Chrome Web Store are loaded in new BrowsingInstances. BUG=174943 TEST=Can't post message to CWS. See bug for repro steps. Review URL: https://chromiumcodereview.appspot.com/12301013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184208 0039d316-1c4b-4281-b951-d872f2087c98
WebContentsView* ContentBrowserClient::OverrideCreateWebContentsView( WebContents* web_contents, RenderViewHostDelegateView** render_view_host_delegate_view) { return NULL; }
WebContentsView* ContentBrowserClient::OverrideCreateWebContentsView( WebContents* web_contents, RenderViewHostDelegateView** render_view_host_delegate_view) { return NULL; }
C
Chrome
0
CVE-2018-15910
https://www.cvedetails.com/cve/CVE-2018-15910/
CWE-704
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=c3476dde7743761a4e1d39a631716199b696b880
c3476dde7743761a4e1d39a631716199b696b880
null
ref_param_read_typed(gs_param_list * plist, gs_param_name pkey, gs_param_typed_value * pvalue) { iparam_list *const iplist = (iparam_list *) plist; iparam_loc loc; ref elt; int code = ref_param_read(iplist, pkey, &loc, -1); if (code != 0) return code; switch (r_type(loc.pvalue)) { case t_array: case t_mixedarray: case t_shortarray: iparam_check_read(loc); if (r_size(loc.pvalue) <= 0) { /* 0-length array; can't get type info */ pvalue->type = gs_param_type_array; pvalue->value.d.list = 0; pvalue->value.d.size = 0; return 0; } /* * We have to guess at the array type. First we guess based * on the type of the first element of the array. If that * fails, we try again with more general types. */ array_get(plist->memory, loc.pvalue, 0, &elt); switch (r_type(&elt)) { case t_integer: pvalue->type = gs_param_type_int_array; code = ref_param_read_int_array(plist, pkey, &pvalue->value.ia); if (code != gs_error_typecheck) return code; /* This might be a float array. Fall through. */ *loc.presult = 0; /* reset error */ case t_real: pvalue->type = gs_param_type_float_array; return ref_param_read_float_array(plist, pkey, &pvalue->value.fa); case t_string: pvalue->type = gs_param_type_string_array; return ref_param_read_string_array(plist, pkey, &pvalue->value.sa); case t_name: pvalue->type = gs_param_type_name_array; return ref_param_read_string_array(plist, pkey, &pvalue->value.na); default: break; } return gs_note_error(gs_error_typecheck); case t_boolean: pvalue->type = gs_param_type_bool; pvalue->value.b = loc.pvalue->value.boolval; return 0; case t_dictionary: code = ref_param_begin_read_collection(plist, pkey, &pvalue->value.d, gs_param_collection_dict_any); if (code < 0) return code; pvalue->type = gs_param_type_dict; /* fixup new dict's type & int_keys field if contents have int keys */ { gs_param_enumerator_t enumr; gs_param_key_t key; ref_type keytype; dict_param_list *dlist = (dict_param_list *) pvalue->value.d.list; param_init_enumerator(&enumr); if (!(*(dlist->enumerate)) ((iparam_list *) dlist, &enumr, &key, &keytype) && keytype == t_integer) { dlist->int_keys = 1; pvalue->type = gs_param_type_dict_int_keys; } } return 0; case t_integer: pvalue->type = gs_param_type_long; pvalue->value.l = loc.pvalue->value.intval; return 0; case t_name: pvalue->type = gs_param_type_name; return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.n); case t_null: pvalue->type = gs_param_type_null; return 0; case t_real: pvalue->value.f = loc.pvalue->value.realval; pvalue->type = gs_param_type_float; return 0; case t_string: case t_astruct: pvalue->type = gs_param_type_string; return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.s); default: break; } return gs_note_error(gs_error_typecheck); }
ref_param_read_typed(gs_param_list * plist, gs_param_name pkey, gs_param_typed_value * pvalue) { iparam_list *const iplist = (iparam_list *) plist; iparam_loc loc; ref elt; int code = ref_param_read(iplist, pkey, &loc, -1); if (code != 0) return code; switch (r_type(loc.pvalue)) { case t_array: case t_mixedarray: case t_shortarray: iparam_check_read(loc); if (r_size(loc.pvalue) <= 0) { /* 0-length array; can't get type info */ pvalue->type = gs_param_type_array; pvalue->value.d.list = 0; pvalue->value.d.size = 0; return 0; } /* * We have to guess at the array type. First we guess based * on the type of the first element of the array. If that * fails, we try again with more general types. */ array_get(plist->memory, loc.pvalue, 0, &elt); switch (r_type(&elt)) { case t_integer: pvalue->type = gs_param_type_int_array; code = ref_param_read_int_array(plist, pkey, &pvalue->value.ia); if (code != gs_error_typecheck) return code; /* This might be a float array. Fall through. */ *loc.presult = 0; /* reset error */ case t_real: pvalue->type = gs_param_type_float_array; return ref_param_read_float_array(plist, pkey, &pvalue->value.fa); case t_string: pvalue->type = gs_param_type_string_array; return ref_param_read_string_array(plist, pkey, &pvalue->value.sa); case t_name: pvalue->type = gs_param_type_name_array; return ref_param_read_string_array(plist, pkey, &pvalue->value.na); default: break; } return gs_note_error(gs_error_typecheck); case t_boolean: pvalue->type = gs_param_type_bool; pvalue->value.b = loc.pvalue->value.boolval; return 0; case t_dictionary: code = ref_param_begin_read_collection(plist, pkey, &pvalue->value.d, gs_param_collection_dict_any); if (code < 0) return code; pvalue->type = gs_param_type_dict; /* fixup new dict's type & int_keys field if contents have int keys */ { gs_param_enumerator_t enumr; gs_param_key_t key; ref_type keytype; dict_param_list *dlist = (dict_param_list *) pvalue->value.d.list; param_init_enumerator(&enumr); if (!(*(dlist->enumerate)) ((iparam_list *) dlist, &enumr, &key, &keytype) && keytype == t_integer) { dlist->int_keys = 1; pvalue->type = gs_param_type_dict_int_keys; } } return 0; case t_integer: pvalue->type = gs_param_type_long; pvalue->value.l = loc.pvalue->value.intval; return 0; case t_name: pvalue->type = gs_param_type_name; return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.n); case t_null: pvalue->type = gs_param_type_null; return 0; case t_real: pvalue->value.f = loc.pvalue->value.realval; pvalue->type = gs_param_type_float; return 0; case t_string: case t_astruct: pvalue->type = gs_param_type_string; return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.s); default: break; } return gs_note_error(gs_error_typecheck); }
C
ghostscript
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 <jannh@google.com>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top
static void put_prev_task_fake(struct rq *rq, struct task_struct *prev) { }
static void put_prev_task_fake(struct rq *rq, struct task_struct *prev) { }
C
linux
0
CVE-2017-10661
https://www.cvedetails.com/cve/CVE-2017-10661/
CWE-416
https://github.com/torvalds/linux/commit/1e38da300e1e395a15048b0af1e5305bd91402f6
1e38da300e1e395a15048b0af1e5305bd91402f6
timerfd: Protect the might cancel mechanism proper The handling of the might_cancel queueing is not properly protected, so parallel operations on the file descriptor can race with each other and lead to list corruptions or use after free. Protect the context for these operations with a seperate lock. The wait queue lock cannot be reused for this because that would create a lock inversion scenario vs. the cancel lock. Replacing might_cancel with an atomic (atomic_t or atomic bit) does not help either because it still can race vs. the actual list operation. Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: "linux-fsdevel@vger.kernel.org" Cc: syzkaller <syzkaller@googlegroups.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311521430.3457@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct compat_itimerspec __user *, otmr) { struct itimerspec kotmr; int ret = do_timerfd_gettime(ufd, &kotmr); if (ret) return ret; return put_compat_itimerspec(otmr, &kotmr) ? -EFAULT: 0; }
COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct compat_itimerspec __user *, otmr) { struct itimerspec kotmr; int ret = do_timerfd_gettime(ufd, &kotmr); if (ret) return ret; return put_compat_itimerspec(otmr, &kotmr) ? -EFAULT: 0; }
C
linux
0
CVE-2019-15538
https://www.cvedetails.com/cve/CVE-2019-15538/
CWE-399
https://github.com/torvalds/linux/commit/1fb254aa983bf190cfd685d40c64a480a9bafaee
1fb254aa983bf190cfd685d40c64a480a9bafaee
xfs: fix missing ILOCK unlock when xfs_setattr_nonsize fails due to EDQUOT Benjamin Moody reported to Debian that XFS partially wedges when a chgrp fails on account of being out of disk quota. I ran his reproducer script: # adduser dummy # adduser dummy plugdev # dd if=/dev/zero bs=1M count=100 of=test.img # mkfs.xfs test.img # mount -t xfs -o gquota test.img /mnt # mkdir -p /mnt/dummy # chown -c dummy /mnt/dummy # xfs_quota -xc 'limit -g bsoft=100k bhard=100k plugdev' /mnt (and then as user dummy) $ dd if=/dev/urandom bs=1M count=50 of=/mnt/dummy/foo $ chgrp plugdev /mnt/dummy/foo and saw: ================================================ WARNING: lock held when returning to user space! 5.3.0-rc5 #rc5 Tainted: G W ------------------------------------------------ chgrp/47006 is leaving the kernel with locks still held! 1 lock held by chgrp/47006: #0: 000000006664ea2d (&xfs_nondir_ilock_class){++++}, at: xfs_ilock+0xd2/0x290 [xfs] ...which is clearly caused by xfs_setattr_nonsize failing to unlock the ILOCK after the xfs_qm_vop_chown_reserve call fails. Add the missing unlock. Reported-by: benjamin.moody@gmail.com Fixes: 253f4911f297 ("xfs: better xfs_trans_alloc interface") Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org>
xfs_vn_lookup( struct inode *dir, struct dentry *dentry, unsigned int flags) { struct inode *inode; struct xfs_inode *cip; struct xfs_name name; int error; if (dentry->d_name.len >= MAXNAMELEN) return ERR_PTR(-ENAMETOOLONG); xfs_dentry_to_name(&name, dentry); error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); if (likely(!error)) inode = VFS_I(cip); else if (likely(error == -ENOENT)) inode = NULL; else inode = ERR_PTR(error); return d_splice_alias(inode, dentry); }
xfs_vn_lookup( struct inode *dir, struct dentry *dentry, unsigned int flags) { struct inode *inode; struct xfs_inode *cip; struct xfs_name name; int error; if (dentry->d_name.len >= MAXNAMELEN) return ERR_PTR(-ENAMETOOLONG); xfs_dentry_to_name(&name, dentry); error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); if (likely(!error)) inode = VFS_I(cip); else if (likely(error == -ENOENT)) inode = NULL; else inode = ERR_PTR(error); return d_splice_alias(inode, dentry); }
C
linux
0
CVE-2013-6635
https://www.cvedetails.com/cve/CVE-2013-6635/
CWE-399
https://github.com/chromium/chromium/commit/6b96dd532af164a73f2aac757bafff58211aca2c
6b96dd532af164a73f2aac757bafff58211aca2c
Revert "Load web contents after tab is created." This reverts commit 4c55f398def3214369aefa9f2f2e8f5940d3799d. BUG=432562 TBR=tedchoc@chromium.org,jbudorick@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/894003005 Cr-Commit-Position: refs/heads/master@{#314469}
WebContentsAndroid::GetJavaObject() { return base::android::ScopedJavaLocalRef<jobject>(obj_); }
WebContentsAndroid::GetJavaObject() { return base::android::ScopedJavaLocalRef<jobject>(obj_); }
C
Chrome
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
BrowserLauncherItemController::BrowserLauncherItemController( Type type, aura::Window* window, TabStripModel* tab_model, ChromeLauncherController* launcher_controller, const std::string& app_id) : LauncherItemController(type, app_id, launcher_controller), window_(window), tab_model_(tab_model), is_incognito_(tab_model->profile()->GetOriginalProfile() != tab_model->profile() && !Profile::IsGuestSession()) { DCHECK(window_); window_->AddObserver(this); }
BrowserLauncherItemController::BrowserLauncherItemController( Type type, aura::Window* window, TabStripModel* tab_model, ChromeLauncherController* launcher_controller, const std::string& app_id) : LauncherItemController(type, app_id, launcher_controller), window_(window), tab_model_(tab_model), is_incognito_(tab_model->profile()->GetOriginalProfile() != tab_model->profile() && !Profile::IsGuestSession()) { DCHECK(window_); window_->AddObserver(this); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/befb46ae3385fa13975521e9a2281e35805b339e
befb46ae3385fa13975521e9a2281e35805b339e
2009-10-23 Chris Evans <cevans@chromium.org> Reviewed by Adam Barth. Added test for bug 27239 (ignore Refresh for view source mode). https://bugs.webkit.org/show_bug.cgi?id=27239 * http/tests/security/view-source-no-refresh.html: Added * http/tests/security/view-source-no-refresh-expected.txt: Added * http/tests/security/resources/view-source-no-refresh.php: Added 2009-10-23 Chris Evans <cevans@chromium.org> Reviewed by Adam Barth. Ignore the Refresh header if we're in view source mode. https://bugs.webkit.org/show_bug.cgi?id=27239 Test: http/tests/security/view-source-no-refresh.html * loader/FrameLoader.cpp: ignore Refresh in view-source mode. git-svn-id: svn://svn.chromium.org/blink/trunk@50018 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void FrameLoader::revertToProvisional(DocumentLoader* loader) { m_client->revertToProvisionalState(loader); }
void FrameLoader::revertToProvisional(DocumentLoader* loader) { m_client->revertToProvisionalState(loader); }
C
Chrome
0
CVE-2014-4014
https://www.cvedetails.com/cve/CVE-2014-4014/
CWE-264
https://github.com/torvalds/linux/commit/23adbe12ef7d3d4195e80800ab36b37bee28cd03
23adbe12ef7d3d4195e80800ab36b37bee28cd03
fs,userns: Change inode_capable to capable_wrt_inode_uidgid The kernel has no concept of capabilities with respect to inodes; inodes exist independently of namespaces. For example, inode_capable(inode, CAP_LINUX_IMMUTABLE) would be nonsense. This patch changes inode_capable to check for uid and gid mappings and renames it to capable_wrt_inode_uidgid, which should make it more obvious what it does. Fixes CVE-2014-4014. Cc: Theodore Ts'o <tytso@mit.edu> Cc: Serge Hallyn <serge.hallyn@ubuntu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Dave Chinner <david@fromorbit.com> Cc: stable@vger.kernel.org Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static void inode_lru_list_del(struct inode *inode) { if (list_lru_del(&inode->i_sb->s_inode_lru, &inode->i_lru)) this_cpu_dec(nr_unused); }
static void inode_lru_list_del(struct inode *inode) { if (list_lru_del(&inode->i_sb->s_inode_lru, &inode->i_lru)) this_cpu_dec(nr_unused); }
C
linux
0
CVE-2018-17205
https://www.cvedetails.com/cve/CVE-2018-17205/
CWE-617
https://github.com/openvswitch/ovs/commit/0befd1f3745055c32940f5faf9559be6a14395e6
0befd1f3745055c32940f5faf9559be6a14395e6
ofproto: Fix OVS crash when reverting old flows in bundle commit During bundle commit flows which are added in bundle are applied to ofproto in-order. In case if a flow cannot be added (e.g. flow action is go-to group id which does not exist), OVS tries to revert back all previous flows which were successfully applied from the same bundle. This is possible since OVS maintains list of old flows which were replaced by flows from the bundle. While reinserting old flows ovs asserts due to check on rule state != RULE_INITIALIZED. This will work only for new flows, but for old flow the rule state will be RULE_REMOVED. This is causing an assert and OVS crash. The ovs assert check should be modified to != RULE_INSERTED to prevent any existing rule being re-inserted and allow new rules and old rules (in case of revert) to get inserted. Here is an example to trigger the assert: $ ovs-vsctl add-br br-test -- set Bridge br-test datapath_type=netdev $ cat flows.txt flow add table=1,priority=0,in_port=2,actions=NORMAL flow add table=1,priority=0,in_port=3,actions=NORMAL $ ovs-ofctl dump-flows -OOpenflow13 br-test cookie=0x0, duration=2.465s, table=1, n_packets=0, n_bytes=0, priority=0,in_port=2 actions=NORMAL cookie=0x0, duration=2.465s, table=1, n_packets=0, n_bytes=0, priority=0,in_port=3 actions=NORMAL $ cat flow-modify.txt flow modify table=1,priority=0,in_port=2,actions=drop flow modify table=1,priority=0,in_port=3,actions=group:10 $ ovs-ofctl bundle br-test flow-modify.txt -OOpenflow13 First flow rule will be modified since it is a valid rule. However second rule is invalid since no group with id 10 exists. Bundle commit tries to revert (insert) the first rule to old flow which results in ovs_assert at ofproto_rule_insert__() since old rule->state = RULE_REMOVED. Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
handle_barrier_request(struct ofconn *ofconn, const struct ofp_header *oh) { struct ofpbuf *buf; buf = ofpraw_alloc_reply((oh->version == OFP10_VERSION ? OFPRAW_OFPT10_BARRIER_REPLY : OFPRAW_OFPT11_BARRIER_REPLY), oh, 0); ofconn_send_reply(ofconn, buf); return 0; }
handle_barrier_request(struct ofconn *ofconn, const struct ofp_header *oh) { struct ofpbuf *buf; buf = ofpraw_alloc_reply((oh->version == OFP10_VERSION ? OFPRAW_OFPT10_BARRIER_REPLY : OFPRAW_OFPT11_BARRIER_REPLY), oh, 0); ofconn_send_reply(ofconn, buf); return 0; }
C
ovs
0
CVE-2018-16427
https://www.cvedetails.com/cve/CVE-2018-16427/
CWE-125
https://github.com/OpenSC/OpenSC/pull/1447/commits/8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
fixed out of bounds reads Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting and suggesting security fixes.
static coolkey_private_data_t *coolkey_new_private_data(void) { coolkey_private_data_t *priv; /* allocate priv and zero all the fields */ priv = calloc(1, sizeof(coolkey_private_data_t)); if (!priv) return NULL; /* set other fields as appropriate */ priv->key_id = COOLKEY_INVALID_KEY; list_init(&priv->objects_list); list_attributes_comparator(&priv->objects_list, coolkey_compare_id); list_attributes_copy(&priv->objects_list, coolkey_list_meter, 1); return priv; }
static coolkey_private_data_t *coolkey_new_private_data(void) { coolkey_private_data_t *priv; /* allocate priv and zero all the fields */ priv = calloc(1, sizeof(coolkey_private_data_t)); if (!priv) return NULL; /* set other fields as appropriate */ priv->key_id = COOLKEY_INVALID_KEY; list_init(&priv->objects_list); list_attributes_comparator(&priv->objects_list, coolkey_compare_id); list_attributes_copy(&priv->objects_list, coolkey_list_meter, 1); return priv; }
C
OpenSC
0
CVE-2011-4930
https://www.cvedetails.com/cve/CVE-2011-4930/
CWE-134
https://htcondor-git.cs.wisc.edu/?p=condor.git;a=commitdiff;h=5e5571d1a431eb3c61977b6dd6ec90186ef79867
5e5571d1a431eb3c61977b6dd6ec90186ef79867
null
get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) { char * name = NULL; int rtnVal = FALSE; bool found_cred=false; CredentialWrapper * cred = NULL; char * owner = NULL; const char * user = NULL; void * data = NULL; ReliSock * socket = (ReliSock*)stream; if (!socket->triedAuthentication()) { CondorError errstack; if( ! SecMan::authenticate_sock(socket, READ, &errstack) ) { dprintf (D_ALWAYS, "Unable to authenticate, qutting\n"); goto EXIT; } } socket->decode(); if (!socket->code(name)) { dprintf (D_ALWAYS, "Error receiving credential name\n"); goto EXIT; } user = socket->getFullyQualifiedUser(); dprintf (D_ALWAYS, "Authenticated as %s\n", user); if (strchr (name, ':')) { owner = strdup (name); char * pColon = strchr (owner, ':'); *pColon = '\0'; sprintf (name, "%s", (char*)(pColon+sizeof(char))); if (strcmp (owner, user) != 0) { dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); if (!isSuperUser (user)) { dprintf (D_ALWAYS, "User %s is NOT super user, request DENIED\n", user); goto EXIT; } else { dprintf (D_FULLDEBUG, "User %s is super user, request GRANTED\n", user); } } } else { owner = strdup (user); } dprintf (D_ALWAYS, "sending cred %s for user %s\n", name, owner); credentials.Rewind(); while (credentials.Next(cred)) { if (cred->cred->GetType() == X509_CREDENTIAL_TYPE) { if ((strcmp(cred->cred->GetName(), name) == 0) && (strcmp(cred->cred->GetOwner(), owner) == 0)) { found_cred=true; break; // found it } } } socket->encode(); if (found_cred) { dprintf (D_FULLDEBUG, "Found cred %s\n", cred->GetStorageName()); int data_size; int rc = LoadData (cred->GetStorageName(), data, data_size); dprintf (D_FULLDEBUG, "Credential::LoadData returned %d\n", rc); if (rc == 0) { goto EXIT; } socket->code (data_size); socket->code_bytes (data, data_size); dprintf (D_ALWAYS, "Credential name %s for owner %s returned to user %s\n", name, owner, user); } else { dprintf (D_ALWAYS, "Cannot find cred %s\n", name); int rc = CREDD_CREDENTIAL_NOT_FOUND; socket->code (rc); } rtnVal = TRUE; EXIT: if ( name != NULL) { free (name); } if ( owner != NULL) { free (owner); } if ( data != NULL) { free (data); } return rtnVal; }
get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) { char * name = NULL; int rtnVal = FALSE; bool found_cred=false; CredentialWrapper * cred = NULL; char * owner = NULL; const char * user = NULL; void * data = NULL; ReliSock * socket = (ReliSock*)stream; if (!socket->triedAuthentication()) { CondorError errstack; if( ! SecMan::authenticate_sock(socket, READ, &errstack) ) { dprintf (D_ALWAYS, "Unable to authenticate, qutting\n"); goto EXIT; } } socket->decode(); if (!socket->code(name)) { dprintf (D_ALWAYS, "Error receiving credential name\n"); goto EXIT; } user = socket->getFullyQualifiedUser(); dprintf (D_ALWAYS, "Authenticated as %s\n", user); if (strchr (name, ':')) { owner = strdup (name); char * pColon = strchr (owner, ':'); *pColon = '\0'; sprintf (name, (char*)(pColon+sizeof(char))); if (strcmp (owner, user) != 0) { dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); if (!isSuperUser (user)) { dprintf (D_ALWAYS, "User %s is NOT super user, request DENIED\n", user); goto EXIT; } else { dprintf (D_FULLDEBUG, "User %s is super user, request GRANTED\n", user); } } } else { owner = strdup (user); } dprintf (D_ALWAYS, "sending cred %s for user %s\n", name, owner); credentials.Rewind(); while (credentials.Next(cred)) { if (cred->cred->GetType() == X509_CREDENTIAL_TYPE) { if ((strcmp(cred->cred->GetName(), name) == 0) && (strcmp(cred->cred->GetOwner(), owner) == 0)) { found_cred=true; break; // found it } } } socket->encode(); if (found_cred) { dprintf (D_FULLDEBUG, "Found cred %s\n", cred->GetStorageName()); int data_size; int rc = LoadData (cred->GetStorageName(), data, data_size); dprintf (D_FULLDEBUG, "Credential::LoadData returned %d\n", rc); if (rc == 0) { goto EXIT; } socket->code (data_size); socket->code_bytes (data, data_size); dprintf (D_ALWAYS, "Credential name %s for owner %s returned to user %s\n", name, owner, user); } else { dprintf (D_ALWAYS, "Cannot find cred %s\n", name); int rc = CREDD_CREDENTIAL_NOT_FOUND; socket->code (rc); } rtnVal = TRUE; EXIT: if ( name != NULL) { free (name); } if ( owner != NULL) { free (owner); } if ( data != NULL) { free (data); } return rtnVal; }
CPP
htcondor
1
CVE-2018-1066
https://www.cvedetails.com/cve/CVE-2018-1066/
CWE-476
https://github.com/torvalds/linux/commit/cabfb3680f78981d26c078a26e5c748531257ebb
cabfb3680f78981d26c078a26e5c748531257ebb
CIFS: Enable encryption during session setup phase In order to allow encryption on SMB connection we need to exchange a session key and generate encryption and decryption keys. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 opcode, bool is_fsctl, char *in_data, u32 indatalen, char **out_data, u32 *plen /* returned data len */) { struct smb2_ioctl_req *req; struct smb2_ioctl_rsp *rsp; struct smb2_sync_hdr *shdr; struct TCP_Server_Info *server; struct cifs_ses *ses; struct kvec iov[2]; struct kvec rsp_iov; int resp_buftype; int n_iov; int rc = 0; int flags = 0; cifs_dbg(FYI, "SMB2 IOCTL\n"); if (out_data != NULL) *out_data = NULL; /* zero out returned data len, in case of error */ if (plen) *plen = 0; if (tcon) ses = tcon->ses; else return -EIO; if (ses && (ses->server)) server = ses->server; else return -EIO; rc = small_smb2_init(SMB2_IOCTL, tcon, (void **) &req); if (rc) return rc; if (encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; req->CtlCode = cpu_to_le32(opcode); req->PersistentFileId = persistent_fid; req->VolatileFileId = volatile_fid; if (indatalen) { req->InputCount = cpu_to_le32(indatalen); /* do not set InputOffset if no input data */ req->InputOffset = cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer) - 4); iov[1].iov_base = in_data; iov[1].iov_len = indatalen; n_iov = 2; } else n_iov = 1; req->OutputOffset = 0; req->OutputCount = 0; /* MBZ */ /* * Could increase MaxOutputResponse, but that would require more * than one credit. Windows typically sets this smaller, but for some * ioctls it may be useful to allow server to send more. No point * limiting what the server can send as long as fits in one credit */ req->MaxOutputResponse = cpu_to_le32(0xFF00); /* < 64K uses 1 credit */ if (is_fsctl) req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); else req->Flags = 0; iov[0].iov_base = (char *)req; /* * If no input data, the size of ioctl struct in * protocol spec still includes a 1 byte data buffer, * but if input data passed to ioctl, we do not * want to double count this, so we do not send * the dummy one byte of data in iovec[0] if sending * input data (in iovec[1]). We also must add 4 bytes * in first iovec to allow for rfc1002 length field. */ if (indatalen) { iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; inc_rfc1001_len(req, indatalen - 1); } else iov[0].iov_len = get_rfc1002_length(req) + 4; rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov); cifs_small_buf_release(req); rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base; if ((rc != 0) && (rc != -EINVAL)) { cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE); goto ioctl_exit; } else if (rc == -EINVAL) { if ((opcode != FSCTL_SRV_COPYCHUNK_WRITE) && (opcode != FSCTL_SRV_COPYCHUNK)) { cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE); goto ioctl_exit; } } /* check if caller wants to look at return data or just return rc */ if ((plen == NULL) || (out_data == NULL)) goto ioctl_exit; *plen = le32_to_cpu(rsp->OutputCount); /* We check for obvious errors in the output buffer length and offset */ if (*plen == 0) goto ioctl_exit; /* server returned no data */ else if (*plen > 0xFF00) { cifs_dbg(VFS, "srv returned invalid ioctl length: %d\n", *plen); *plen = 0; rc = -EIO; goto ioctl_exit; } if (get_rfc1002_length(rsp) < le32_to_cpu(rsp->OutputOffset) + *plen) { cifs_dbg(VFS, "Malformed ioctl resp: len %d offset %d\n", *plen, le32_to_cpu(rsp->OutputOffset)); *plen = 0; rc = -EIO; goto ioctl_exit; } *out_data = kmalloc(*plen, GFP_KERNEL); if (*out_data == NULL) { rc = -ENOMEM; goto ioctl_exit; } shdr = get_sync_hdr(rsp); memcpy(*out_data, (char *)shdr + le32_to_cpu(rsp->OutputOffset), *plen); ioctl_exit: free_rsp_buf(resp_buftype, rsp); return rc; }
SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 opcode, bool is_fsctl, char *in_data, u32 indatalen, char **out_data, u32 *plen /* returned data len */) { struct smb2_ioctl_req *req; struct smb2_ioctl_rsp *rsp; struct smb2_sync_hdr *shdr; struct TCP_Server_Info *server; struct cifs_ses *ses; struct kvec iov[2]; struct kvec rsp_iov; int resp_buftype; int n_iov; int rc = 0; int flags = 0; cifs_dbg(FYI, "SMB2 IOCTL\n"); if (out_data != NULL) *out_data = NULL; /* zero out returned data len, in case of error */ if (plen) *plen = 0; if (tcon) ses = tcon->ses; else return -EIO; if (ses && (ses->server)) server = ses->server; else return -EIO; rc = small_smb2_init(SMB2_IOCTL, tcon, (void **) &req); if (rc) return rc; if (encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; req->CtlCode = cpu_to_le32(opcode); req->PersistentFileId = persistent_fid; req->VolatileFileId = volatile_fid; if (indatalen) { req->InputCount = cpu_to_le32(indatalen); /* do not set InputOffset if no input data */ req->InputOffset = cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer) - 4); iov[1].iov_base = in_data; iov[1].iov_len = indatalen; n_iov = 2; } else n_iov = 1; req->OutputOffset = 0; req->OutputCount = 0; /* MBZ */ /* * Could increase MaxOutputResponse, but that would require more * than one credit. Windows typically sets this smaller, but for some * ioctls it may be useful to allow server to send more. No point * limiting what the server can send as long as fits in one credit */ req->MaxOutputResponse = cpu_to_le32(0xFF00); /* < 64K uses 1 credit */ if (is_fsctl) req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); else req->Flags = 0; iov[0].iov_base = (char *)req; /* * If no input data, the size of ioctl struct in * protocol spec still includes a 1 byte data buffer, * but if input data passed to ioctl, we do not * want to double count this, so we do not send * the dummy one byte of data in iovec[0] if sending * input data (in iovec[1]). We also must add 4 bytes * in first iovec to allow for rfc1002 length field. */ if (indatalen) { iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; inc_rfc1001_len(req, indatalen - 1); } else iov[0].iov_len = get_rfc1002_length(req) + 4; rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov); cifs_small_buf_release(req); rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base; if ((rc != 0) && (rc != -EINVAL)) { cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE); goto ioctl_exit; } else if (rc == -EINVAL) { if ((opcode != FSCTL_SRV_COPYCHUNK_WRITE) && (opcode != FSCTL_SRV_COPYCHUNK)) { cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE); goto ioctl_exit; } } /* check if caller wants to look at return data or just return rc */ if ((plen == NULL) || (out_data == NULL)) goto ioctl_exit; *plen = le32_to_cpu(rsp->OutputCount); /* We check for obvious errors in the output buffer length and offset */ if (*plen == 0) goto ioctl_exit; /* server returned no data */ else if (*plen > 0xFF00) { cifs_dbg(VFS, "srv returned invalid ioctl length: %d\n", *plen); *plen = 0; rc = -EIO; goto ioctl_exit; } if (get_rfc1002_length(rsp) < le32_to_cpu(rsp->OutputOffset) + *plen) { cifs_dbg(VFS, "Malformed ioctl resp: len %d offset %d\n", *plen, le32_to_cpu(rsp->OutputOffset)); *plen = 0; rc = -EIO; goto ioctl_exit; } *out_data = kmalloc(*plen, GFP_KERNEL); if (*out_data == NULL) { rc = -ENOMEM; goto ioctl_exit; } shdr = get_sync_hdr(rsp); memcpy(*out_data, (char *)shdr + le32_to_cpu(rsp->OutputOffset), *plen); ioctl_exit: free_rsp_buf(resp_buftype, rsp); return rc; }
C
linux
0
CVE-2012-1601
https://www.cvedetails.com/cve/CVE-2012-1601/
CWE-399
https://github.com/torvalds/linux/commit/9c895160d25a76c21b65bad141b08e8d4f99afef
9c895160d25a76c21b65bad141b08e8d4f99afef
KVM: Ensure all vcpus are consistent with in-kernel irqchip settings (cherry picked from commit 3e515705a1f46beb1c942bb8043c16f8ac7b1e9e) If some vcpus are created before KVM_CREATE_IRQCHIP, then irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading to potential NULL pointer dereferences. Fix by: - ensuring that no vcpus are installed when KVM_CREATE_IRQCHIP is called - ensuring that a vcpu has an apic if it is installed after KVM_CREATE_IRQCHIP This is somewhat long winded because vcpu->arch.apic is created without kvm->lock held. Based on earlier patch by Michael Ellerman. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) { vcpu->arch.emulate_regs_need_sync_from_vcpu = true; vcpu->arch.emulate_regs_need_sync_to_vcpu = false; kvm_register_write(vcpu, VCPU_REGS_RAX, regs->rax); kvm_register_write(vcpu, VCPU_REGS_RBX, regs->rbx); kvm_register_write(vcpu, VCPU_REGS_RCX, regs->rcx); kvm_register_write(vcpu, VCPU_REGS_RDX, regs->rdx); kvm_register_write(vcpu, VCPU_REGS_RSI, regs->rsi); kvm_register_write(vcpu, VCPU_REGS_RDI, regs->rdi); kvm_register_write(vcpu, VCPU_REGS_RSP, regs->rsp); kvm_register_write(vcpu, VCPU_REGS_RBP, regs->rbp); #ifdef CONFIG_X86_64 kvm_register_write(vcpu, VCPU_REGS_R8, regs->r8); kvm_register_write(vcpu, VCPU_REGS_R9, regs->r9); kvm_register_write(vcpu, VCPU_REGS_R10, regs->r10); kvm_register_write(vcpu, VCPU_REGS_R11, regs->r11); kvm_register_write(vcpu, VCPU_REGS_R12, regs->r12); kvm_register_write(vcpu, VCPU_REGS_R13, regs->r13); kvm_register_write(vcpu, VCPU_REGS_R14, regs->r14); kvm_register_write(vcpu, VCPU_REGS_R15, regs->r15); #endif kvm_rip_write(vcpu, regs->rip); kvm_set_rflags(vcpu, regs->rflags); vcpu->arch.exception.pending = false; kvm_make_request(KVM_REQ_EVENT, vcpu); return 0; }
int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) { vcpu->arch.emulate_regs_need_sync_from_vcpu = true; vcpu->arch.emulate_regs_need_sync_to_vcpu = false; kvm_register_write(vcpu, VCPU_REGS_RAX, regs->rax); kvm_register_write(vcpu, VCPU_REGS_RBX, regs->rbx); kvm_register_write(vcpu, VCPU_REGS_RCX, regs->rcx); kvm_register_write(vcpu, VCPU_REGS_RDX, regs->rdx); kvm_register_write(vcpu, VCPU_REGS_RSI, regs->rsi); kvm_register_write(vcpu, VCPU_REGS_RDI, regs->rdi); kvm_register_write(vcpu, VCPU_REGS_RSP, regs->rsp); kvm_register_write(vcpu, VCPU_REGS_RBP, regs->rbp); #ifdef CONFIG_X86_64 kvm_register_write(vcpu, VCPU_REGS_R8, regs->r8); kvm_register_write(vcpu, VCPU_REGS_R9, regs->r9); kvm_register_write(vcpu, VCPU_REGS_R10, regs->r10); kvm_register_write(vcpu, VCPU_REGS_R11, regs->r11); kvm_register_write(vcpu, VCPU_REGS_R12, regs->r12); kvm_register_write(vcpu, VCPU_REGS_R13, regs->r13); kvm_register_write(vcpu, VCPU_REGS_R14, regs->r14); kvm_register_write(vcpu, VCPU_REGS_R15, regs->r15); #endif kvm_rip_write(vcpu, regs->rip); kvm_set_rflags(vcpu, regs->rflags); vcpu->arch.exception.pending = false; kvm_make_request(KVM_REQ_EVENT, vcpu); return 0; }
C
linux
0
CVE-2012-5139
https://www.cvedetails.com/cve/CVE-2012-5139/
CWE-416
https://github.com/chromium/chromium/commit/9e417dae2833230a651989bb4e56b835355dda39
9e417dae2833230a651989bb4e56b835355dda39
Tests were marked as Flaky. BUG=151811,151810 TBR=droger@chromium.org,shalev@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/10968052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158204 0039d316-1c4b-4281-b951-d872f2087c98
~CancelThenRestartTestJob() {}
~CancelThenRestartTestJob() {}
C
Chrome
0
CVE-2012-2900
https://www.cvedetails.com/cve/CVE-2012-2900/
null
https://github.com/chromium/chromium/commit/9597042cad54926f50d58f5ada39205eb734d7be
9597042cad54926f50d58f5ada39205eb734d7be
Revert 137988 - VAVDA is the hardware video decode accelerator for Chrome on Linux and ChromeOS for Intel CPUs (Sandy Bridge and newer). This CL enables VAVDA acceleration for ChromeOS, both for HTML5 video and Flash. The feature is currently hidden behind a command line flag and can be enabled by adding the --enable-vaapi parameter to command line. BUG=117062 TEST=Manual runs of test streams. Change-Id: I386e16739e2ef2230f52a0a434971b33d8654699 Review URL: https://chromiumcodereview.appspot.com/9814001 This is causing crbug.com/129103 TBR=posciak@chromium.org Review URL: https://chromiumcodereview.appspot.com/10411066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138208 0039d316-1c4b-4281-b951-d872f2087c98
GpuProcessHost* GpuProcessHost::FromID(int host_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { GpuProcessHost* host = g_gpu_process_hosts[i]; if (host && host->host_id_ == host_id && HostIsValid(host)) return host; } return NULL; }
GpuProcessHost* GpuProcessHost::FromID(int host_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { GpuProcessHost* host = g_gpu_process_hosts[i]; if (host && host->host_id_ == host_id && HostIsValid(host)) return host; } return NULL; }
C
Chrome
0
CVE-2015-1536
https://www.cvedetails.com/cve/CVE-2015-1536/
CWE-189
https://android.googlesource.com/platform/frameworks/base/+/d44e5bde18a41beda39d49189bef7f2ba7c8f3cb
d44e5bde18a41beda39d49189bef7f2ba7c8f3cb
Make Bitmap_createFromParcel check the color count. DO NOT MERGE When reading from the parcel, if the number of colors is invalid, early exit. Add two more checks: setInfo must return true, and Parcel::readInplace must return non-NULL. The former ensures that the previously read values (width, height, etc) were valid, and the latter checks that the Parcel had enough data even if the number of colors was reasonable. Also use an auto-deleter to handle deletion of the SkBitmap. Cherry pick from change-Id: Icbd562d6d1f131a723724883fd31822d337cf5a6 BUG=19666945 Change-Id: Iab0d218c41ae0c39606e333e44cda078eef32291
bool GraphicsJNI::SetPixels(JNIEnv* env, jintArray srcColors, int srcOffset, int srcStride, int x, int y, int width, int height, const SkBitmap& dstBitmap) { SkAutoLockPixels alp(dstBitmap); void* dst = dstBitmap.getPixels(); FromColorProc proc = ChooseFromColorProc(dstBitmap); if (NULL == dst || NULL == proc) { return false; } const jint* array = env->GetIntArrayElements(srcColors, NULL); const SkColor* src = (const SkColor*)array + srcOffset; dst = dstBitmap.getAddr(x, y); for (int y = 0; y < height; y++) { proc(dst, src, width, x, y); src += srcStride; dst = (char*)dst + dstBitmap.rowBytes(); } dstBitmap.notifyPixelsChanged(); env->ReleaseIntArrayElements(srcColors, const_cast<jint*>(array), JNI_ABORT); return true; }
bool GraphicsJNI::SetPixels(JNIEnv* env, jintArray srcColors, int srcOffset, int srcStride, int x, int y, int width, int height, const SkBitmap& dstBitmap) { SkAutoLockPixels alp(dstBitmap); void* dst = dstBitmap.getPixels(); FromColorProc proc = ChooseFromColorProc(dstBitmap); if (NULL == dst || NULL == proc) { return false; } const jint* array = env->GetIntArrayElements(srcColors, NULL); const SkColor* src = (const SkColor*)array + srcOffset; dst = dstBitmap.getAddr(x, y); for (int y = 0; y < height; y++) { proc(dst, src, width, x, y); src += srcStride; dst = (char*)dst + dstBitmap.rowBytes(); } dstBitmap.notifyPixelsChanged(); env->ReleaseIntArrayElements(srcColors, const_cast<jint*>(array), JNI_ABORT); return true; }
C
Android
0
CVE-2016-0723
https://www.cvedetails.com/cve/CVE-2016-0723/
CWE-362
https://github.com/torvalds/linux/commit/5c17c861a357e9458001f021a7afa7aab9937439
5c17c861a357e9458001f021a7afa7aab9937439
tty: Fix unsafe ldisc reference via ioctl(TIOCGETD) ioctl(TIOCGETD) retrieves the line discipline id directly from the ldisc because the line discipline id (c_line) in termios is untrustworthy; userspace may have set termios via ioctl(TCSETS*) without actually changing the line discipline via ioctl(TIOCSETD). However, directly accessing the current ldisc via tty->ldisc is unsafe; the ldisc ptr dereferenced may be stale if the line discipline is changing via ioctl(TIOCSETD) or hangup. Wait for the line discipline reference (just like read() or write()) to retrieve the "current" line discipline id. Cc: <stable@vger.kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
static ssize_t tty_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct tty_struct *tty = file_tty(file); struct tty_ldisc *ld; ssize_t ret; if (tty_paranoia_check(tty, file_inode(file), "tty_write")) return -EIO; if (!tty || !tty->ops->write || (test_bit(TTY_IO_ERROR, &tty->flags))) return -EIO; /* Short term debug to catch buggy drivers */ if (tty->ops->write_room == NULL) tty_err(tty, "missing write_room method\n"); ld = tty_ldisc_ref_wait(tty); if (!ld->ops->write) ret = -EIO; else ret = do_tty_write(ld->ops->write, tty, file, buf, count); tty_ldisc_deref(ld); return ret; }
static ssize_t tty_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct tty_struct *tty = file_tty(file); struct tty_ldisc *ld; ssize_t ret; if (tty_paranoia_check(tty, file_inode(file), "tty_write")) return -EIO; if (!tty || !tty->ops->write || (test_bit(TTY_IO_ERROR, &tty->flags))) return -EIO; /* Short term debug to catch buggy drivers */ if (tty->ops->write_room == NULL) tty_err(tty, "missing write_room method\n"); ld = tty_ldisc_ref_wait(tty); if (!ld->ops->write) ret = -EIO; else ret = do_tty_write(ld->ops->write, tty, file, buf, count); tty_ldisc_deref(ld); return ret; }
C
linux
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test R=kbr@chromium.org,piman@chromium.org Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <piman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGL2RenderingContextBase::uniformMatrix4fv( const WebGLUniformLocation* location, GLboolean transpose, MaybeShared<DOMFloat32Array> v) { WebGLRenderingContextBase::uniformMatrix4fv(location, transpose, v); }
void WebGL2RenderingContextBase::uniformMatrix4fv( const WebGLUniformLocation* location, GLboolean transpose, MaybeShared<DOMFloat32Array> v) { WebGLRenderingContextBase::uniformMatrix4fv(location, transpose, v); }
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 <avekceeb@gmail.com> Cc: Jason Wang <jasowang@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static void tun_net_init(struct net_device *dev) { struct tun_struct *tun = netdev_priv(dev); switch (tun->flags & TUN_TYPE_MASK) { case IFF_TUN: dev->netdev_ops = &tun_netdev_ops; /* Point-to-Point TUN Device */ dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = 1500; /* Zero header length */ dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; break; case IFF_TAP: dev->netdev_ops = &tap_netdev_ops; /* Ethernet TAP Device */ ether_setup(dev); dev->priv_flags &= ~IFF_TX_SKB_SHARING; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; eth_hw_addr_random(dev); break; } dev->min_mtu = MIN_MTU; dev->max_mtu = MAX_MTU - dev->hard_header_len; }
static void tun_net_init(struct net_device *dev) { struct tun_struct *tun = netdev_priv(dev); switch (tun->flags & TUN_TYPE_MASK) { case IFF_TUN: dev->netdev_ops = &tun_netdev_ops; /* Point-to-Point TUN Device */ dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = 1500; /* Zero header length */ dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; break; case IFF_TAP: dev->netdev_ops = &tap_netdev_ops; /* Ethernet TAP Device */ ether_setup(dev); dev->priv_flags &= ~IFF_TX_SKB_SHARING; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; eth_hw_addr_random(dev); break; } dev->min_mtu = MIN_MTU; dev->max_mtu = MAX_MTU - dev->hard_header_len; }
C
linux
0
CVE-2014-3200
https://www.cvedetails.com/cve/CVE-2014-3200/
null
https://github.com/chromium/chromium/commit/c0947dabeaa10da67798c1bbc668dca4b280cad5
c0947dabeaa10da67798c1bbc668dca4b280cad5
[Contextual Search] Change "Now on Tap" to "Contextual Cards" BUG=644934 Review-Url: https://codereview.chromium.org/2361163003 Cr-Commit-Position: refs/heads/master@{#420899}
void ContextualSearchDelegate::StartSearchTermRequestFromSelection( const base::string16& surrounding_text, int start_offset, int end_offset) { if (context_.get()) { SaveSurroundingText(surrounding_text, start_offset, end_offset); SendSurroundingText(kSurroundingSizeForUI); ContinueSearchTermResolutionRequest(); } else { DVLOG(1) << "ctxs: Null context, ignored!"; } }
void ContextualSearchDelegate::StartSearchTermRequestFromSelection( const base::string16& surrounding_text, int start_offset, int end_offset) { if (context_.get()) { SaveSurroundingText(surrounding_text, start_offset, end_offset); SendSurroundingText(kSurroundingSizeForUI); ContinueSearchTermResolutionRequest(); } else { DVLOG(1) << "ctxs: Null context, ignored!"; } }
C
Chrome
0
CVE-2015-6787
https://www.cvedetails.com/cve/CVE-2015-6787/
null
https://github.com/chromium/chromium/commit/f911e11e7f6b5c0d6f5ee694a9871de6619889f7
f911e11e7f6b5c0d6f5ee694a9871de6619889f7
Reland "[CI] Make paint property nodes non-ref-counted" This reverts commit 887383b30842d9d9006e11bb6932660a3cb5b1b7. Reason for revert: Retry in M69. Original change's description: > Revert "[CI] Make paint property nodes non-ref-counted" > > This reverts commit 70fc0b018c9517558b7aa2be00edf2debb449123. > > Reason for revert: Caused bugs found by clusterfuzz > > Original change's description: > > [CI] Make paint property nodes non-ref-counted > > > > Now all paint property nodes are owned by ObjectPaintProperties > > (and LocalFrameView temporarily before removing non-RLS mode). > > Others just use raw pointers or references. > > > > Bug: 833496 > > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > > Change-Id: I2d544fe153bb94698623248748df63c8aa2081ae > > Reviewed-on: https://chromium-review.googlesource.com/1031101 > > Reviewed-by: Tien-Ren Chen <trchen@chromium.org> > > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#554626} > > TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org > > Change-Id: I02bb50d6744cb81a797246a0116b677e80a3c69f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 833496,837932,837943 > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > Reviewed-on: https://chromium-review.googlesource.com/1034292 > Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > Cr-Commit-Position: refs/heads/master@{#554653} TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 833496, 837932, 837943 Change-Id: I0b4ef70db1f1f211ba97c30d617225355c750992 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Reviewed-on: https://chromium-review.googlesource.com/1083491 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/master@{#563930}
void TestLessDrawing() { FakeDisplayItemClient first("first"); GraphicsContext context(GetPaintController()); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); DrawRect(context, first, kForegroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); }
void TestLessDrawing() { FakeDisplayItemClient first("first"); GraphicsContext context(GetPaintController()); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); DrawRect(context, first, kForegroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#657568}
void WebGLRenderingContextBase::OnBeforeDrawCall() { ClearIfComposited(); MarkContextChanged(kCanvasChanged); }
void WebGLRenderingContextBase::OnBeforeDrawCall() { ClearIfComposited(); MarkContextChanged(kCanvasChanged); }
C
Chrome
0
CVE-2019-5787
https://www.cvedetails.com/cve/CVE-2019-5787/
CWE-416
https://github.com/chromium/chromium/commit/6a7063ae61cf031630b48bdcdb09863ffc199962
6a7063ae61cf031630b48bdcdb09863ffc199962
Clean up CanvasResourceDispatcher on finalizer We may have pending mojo messages after GC, so we want to drop the dispatcher as soon as possible. Bug: 929757,913964 Change-Id: I5789bcbb55aada4a74c67a28758f07686f8911c0 Reviewed-on: https://chromium-review.googlesource.com/c/1489175 Reviewed-by: Ken Rockot <rockot@google.com> Commit-Queue: Ken Rockot <rockot@google.com> Commit-Queue: Fernando Serboncini <fserb@chromium.org> Auto-Submit: Fernando Serboncini <fserb@chromium.org> Cr-Commit-Position: refs/heads/master@{#635833}
ScriptPromise OffscreenCanvas::CreateImageBitmap( ScriptState* script_state, EventTarget&, base::Optional<IntRect> crop_rect, const ImageBitmapOptions* options) { return ImageBitmapSource::FulfillImageBitmap( script_state, IsPaintable() ? ImageBitmap::Create(this, crop_rect, options) : nullptr); }
ScriptPromise OffscreenCanvas::CreateImageBitmap( ScriptState* script_state, EventTarget&, base::Optional<IntRect> crop_rect, const ImageBitmapOptions* options) { return ImageBitmapSource::FulfillImageBitmap( script_state, IsPaintable() ? ImageBitmap::Create(this, crop_rect, options) : nullptr); }
C
Chrome
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
static int sha384_final(struct shash_desc *desc, u8 *hash) { u8 D[64]; sha512_final(desc, D); memcpy(hash, D, 48); memzero_explicit(D, 64); return 0; }
static int sha384_final(struct shash_desc *desc, u8 *hash) { u8 D[64]; sha512_final(desc, D); memcpy(hash, D, 48); memzero_explicit(D, 64); return 0; }
C
linux
0
CVE-2011-1080
https://www.cvedetails.com/cve/CVE-2011-1080/
CWE-20
https://github.com/torvalds/linux/commit/d846f71195d57b0bbb143382647c2c6638b04c5a
d846f71195d57b0bbb143382647c2c6638b04c5a
bridge: netfilter: fix information leak Struct tmp is copied from userspace. It is not checked whether the "name" field is NULL terminated. This may lead to buffer overflow and passing contents of kernel stack as a module name to try_then_request_module() and, consequently, to modprobe commandline. It would be seen by all userspace processes. Signed-off-by: Vasiliy Kulikov <segoon@openwall.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
static int translate_table(struct net *net, const char *name, struct ebt_table_info *newinfo) { unsigned int i, j, k, udc_cnt; int ret; struct ebt_cl_stack *cl_s = NULL; /* used in the checking for chain loops */ i = 0; while (i < NF_BR_NUMHOOKS && !newinfo->hook_entry[i]) i++; if (i == NF_BR_NUMHOOKS) { BUGPRINT("No valid hooks specified\n"); return -EINVAL; } if (newinfo->hook_entry[i] != (struct ebt_entries *)newinfo->entries) { BUGPRINT("Chains don't start at beginning\n"); return -EINVAL; } /* make sure chains are ordered after each other in same order as their corresponding hooks */ for (j = i + 1; j < NF_BR_NUMHOOKS; j++) { if (!newinfo->hook_entry[j]) continue; if (newinfo->hook_entry[j] <= newinfo->hook_entry[i]) { BUGPRINT("Hook order must be followed\n"); return -EINVAL; } i = j; } /* do some early checkings and initialize some things */ i = 0; /* holds the expected nr. of entries for the chain */ j = 0; /* holds the up to now counted entries for the chain */ k = 0; /* holds the total nr. of entries, should equal newinfo->nentries afterwards */ udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */ ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_check_entry_size_and_hooks, newinfo, &i, &j, &k, &udc_cnt); if (ret != 0) return ret; if (i != j) { BUGPRINT("nentries does not equal the nr of entries in the " "(last) chain\n"); return -EINVAL; } if (k != newinfo->nentries) { BUGPRINT("Total nentries is wrong\n"); return -EINVAL; } /* get the location of the udc, put them in an array while we're at it, allocate the chainstack */ if (udc_cnt) { /* this will get free'd in do_replace()/ebt_register_table() if an error occurs */ newinfo->chainstack = vmalloc(nr_cpu_ids * sizeof(*(newinfo->chainstack))); if (!newinfo->chainstack) return -ENOMEM; for_each_possible_cpu(i) { newinfo->chainstack[i] = vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0]))); if (!newinfo->chainstack[i]) { while (i) vfree(newinfo->chainstack[--i]); vfree(newinfo->chainstack); newinfo->chainstack = NULL; return -ENOMEM; } } cl_s = vmalloc(udc_cnt * sizeof(*cl_s)); if (!cl_s) return -ENOMEM; i = 0; /* the i'th udc */ EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_get_udc_positions, newinfo, &i, cl_s); /* sanity check */ if (i != udc_cnt) { BUGPRINT("i != udc_cnt\n"); vfree(cl_s); return -EFAULT; } } /* Check for loops */ for (i = 0; i < NF_BR_NUMHOOKS; i++) if (newinfo->hook_entry[i]) if (check_chainloops(newinfo->hook_entry[i], cl_s, udc_cnt, i, newinfo->entries)) { vfree(cl_s); return -EINVAL; } /* we now know the following (along with E=mc²): - the nr of entries in each chain is right - the size of the allocated space is right - all valid hooks have a corresponding chain - there are no loops - wrong data can still be on the level of a single entry - could be there are jumps to places that are not the beginning of a chain. This can only occur in chains that are not accessible from any base chains, so we don't care. */ /* used to know what we need to clean up if something goes wrong */ i = 0; ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_check_entry, net, newinfo, name, &i, cl_s, udc_cnt); if (ret != 0) { EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_cleanup_entry, net, &i); } vfree(cl_s); return ret; }
static int translate_table(struct net *net, const char *name, struct ebt_table_info *newinfo) { unsigned int i, j, k, udc_cnt; int ret; struct ebt_cl_stack *cl_s = NULL; /* used in the checking for chain loops */ i = 0; while (i < NF_BR_NUMHOOKS && !newinfo->hook_entry[i]) i++; if (i == NF_BR_NUMHOOKS) { BUGPRINT("No valid hooks specified\n"); return -EINVAL; } if (newinfo->hook_entry[i] != (struct ebt_entries *)newinfo->entries) { BUGPRINT("Chains don't start at beginning\n"); return -EINVAL; } /* make sure chains are ordered after each other in same order as their corresponding hooks */ for (j = i + 1; j < NF_BR_NUMHOOKS; j++) { if (!newinfo->hook_entry[j]) continue; if (newinfo->hook_entry[j] <= newinfo->hook_entry[i]) { BUGPRINT("Hook order must be followed\n"); return -EINVAL; } i = j; } /* do some early checkings and initialize some things */ i = 0; /* holds the expected nr. of entries for the chain */ j = 0; /* holds the up to now counted entries for the chain */ k = 0; /* holds the total nr. of entries, should equal newinfo->nentries afterwards */ udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */ ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_check_entry_size_and_hooks, newinfo, &i, &j, &k, &udc_cnt); if (ret != 0) return ret; if (i != j) { BUGPRINT("nentries does not equal the nr of entries in the " "(last) chain\n"); return -EINVAL; } if (k != newinfo->nentries) { BUGPRINT("Total nentries is wrong\n"); return -EINVAL; } /* get the location of the udc, put them in an array while we're at it, allocate the chainstack */ if (udc_cnt) { /* this will get free'd in do_replace()/ebt_register_table() if an error occurs */ newinfo->chainstack = vmalloc(nr_cpu_ids * sizeof(*(newinfo->chainstack))); if (!newinfo->chainstack) return -ENOMEM; for_each_possible_cpu(i) { newinfo->chainstack[i] = vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0]))); if (!newinfo->chainstack[i]) { while (i) vfree(newinfo->chainstack[--i]); vfree(newinfo->chainstack); newinfo->chainstack = NULL; return -ENOMEM; } } cl_s = vmalloc(udc_cnt * sizeof(*cl_s)); if (!cl_s) return -ENOMEM; i = 0; /* the i'th udc */ EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_get_udc_positions, newinfo, &i, cl_s); /* sanity check */ if (i != udc_cnt) { BUGPRINT("i != udc_cnt\n"); vfree(cl_s); return -EFAULT; } } /* Check for loops */ for (i = 0; i < NF_BR_NUMHOOKS; i++) if (newinfo->hook_entry[i]) if (check_chainloops(newinfo->hook_entry[i], cl_s, udc_cnt, i, newinfo->entries)) { vfree(cl_s); return -EINVAL; } /* we now know the following (along with E=mc²): - the nr of entries in each chain is right - the size of the allocated space is right - all valid hooks have a corresponding chain - there are no loops - wrong data can still be on the level of a single entry - could be there are jumps to places that are not the beginning of a chain. This can only occur in chains that are not accessible from any base chains, so we don't care. */ /* used to know what we need to clean up if something goes wrong */ i = 0; ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_check_entry, net, newinfo, name, &i, cl_s, udc_cnt); if (ret != 0) { EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_cleanup_entry, net, &i); } vfree(cl_s); return ret; }
C
linux
0
CVE-2019-17178
https://www.cvedetails.com/cve/CVE-2019-17178/
CWE-772
https://github.com/akallabeth/FreeRDP/commit/fc80ab45621bd966f70594c0b7393ec005a94007
fc80ab45621bd966f70594c0b7393ec005a94007
Fixed #5645: realloc return handling
static int addBitToStream(size_t* bitpointer, ucvector* bitstream, unsigned char bit) { /*add a new byte at the end*/ if(((*bitpointer) & 7) == 0) { if (!ucvector_push_back(bitstream, (unsigned char)0)) return 83; } /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/ (bitstream->data[bitstream->size - 1]) |= (bit << ((*bitpointer) & 0x7)); (*bitpointer)++; return 0; }
static int addBitToStream(size_t* bitpointer, ucvector* bitstream, unsigned char bit) { /*add a new byte at the end*/ if(((*bitpointer) & 7) == 0) { if (!ucvector_push_back(bitstream, (unsigned char)0)) return 83; } /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/ (bitstream->data[bitstream->size - 1]) |= (bit << ((*bitpointer) & 0x7)); (*bitpointer)++; return 0; }
C
FreeRDP
0
CVE-2016-5199
https://www.cvedetails.com/cve/CVE-2016-5199/
CWE-119
https://github.com/chromium/chromium/commit/c995d4fe5e96f4d6d4a88b7867279b08e72d2579
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
Move IsDataSaverEnabledByUser to be a static method and use it This method now officially becomes the source of truth that everything in the code base eventually calls into to determine whether or not DataSaver is enabled. Bug: 934399 Change-Id: Iae837b710ace8cc3101188f79d02cbc2d4f0fd93 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1537242 Reviewed-by: Joshua Pawlicki <waffles@chromium.org> Reviewed-by: Tarun Bansal <tbansal@chromium.org> Commit-Queue: Robert Ogden <robertogden@chromium.org> Cr-Commit-Position: refs/heads/master@{#643948}
OptimizationHintsComponentInstallerPolicy() : ruleset_format_version_( base::Version(optimization_guide::kRulesetFormatVersionString)) { DCHECK(ruleset_format_version_.IsValid()); }
OptimizationHintsComponentInstallerPolicy() : ruleset_format_version_( base::Version(optimization_guide::kRulesetFormatVersionString)) { DCHECK(ruleset_format_version_.IsValid()); }
C
Chrome
0
CVE-2016-8860
https://www.cvedetails.com/cve/CVE-2016-8860/
CWE-119
https://github.com/torproject/tor/commit/3cea86eb2fbb65949673eb4ba8ebb695c87a57ce
3cea86eb2fbb65949673eb4ba8ebb695c87a57ce
Add a one-word sentinel value of 0x0 at the end of each buf_t chunk This helps protect against bugs where any part of a buf_t's memory is passed to a function that expects a NUL-terminated input. It also closes TROVE-2016-10-001 (aka bug 20384).
chunk_copy(const chunk_t *in_chunk) { chunk_t *newch = tor_memdup(in_chunk, CHUNK_ALLOC_SIZE(in_chunk->memlen)); total_bytes_allocated_in_chunks += CHUNK_ALLOC_SIZE(in_chunk->memlen); #ifdef DEBUG_CHUNK_ALLOC newch->DBG_alloc = CHUNK_ALLOC_SIZE(in_chunk->memlen); #endif newch->next = NULL; if (in_chunk->data) { off_t offset = in_chunk->data - in_chunk->mem; newch->data = newch->mem + offset; } return newch; }
chunk_copy(const chunk_t *in_chunk) { chunk_t *newch = tor_memdup(in_chunk, CHUNK_ALLOC_SIZE(in_chunk->memlen)); total_bytes_allocated_in_chunks += CHUNK_ALLOC_SIZE(in_chunk->memlen); #ifdef DEBUG_CHUNK_ALLOC newch->DBG_alloc = CHUNK_ALLOC_SIZE(in_chunk->memlen); #endif newch->next = NULL; if (in_chunk->data) { off_t offset = in_chunk->data - in_chunk->mem; newch->data = newch->mem + offset; } return newch; }
C
tor
0
CVE-2012-1179
https://www.cvedetails.com/cve/CVE-2012-1179/
CWE-264
https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850
4a1d704194a441bf83c636004a479e01360ec850
mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [akpm@linux-foundation.org: checkpatch fixes] Reported-by: Ulrich Obergfell <uobergfe@redhat.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: Dave Jones <davej@redhat.com> Acked-by: Larry Woodman <lwoodman@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: Mark Salter <msalter@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
unsigned int count_swap_pages(int type, int free) { unsigned int n = 0; spin_lock(&swap_lock); if ((unsigned int)type < nr_swapfiles) { struct swap_info_struct *sis = swap_info[type]; if (sis->flags & SWP_WRITEOK) { n = sis->pages; if (free) n -= sis->inuse_pages; } } spin_unlock(&swap_lock); return n; }
unsigned int count_swap_pages(int type, int free) { unsigned int n = 0; spin_lock(&swap_lock); if ((unsigned int)type < nr_swapfiles) { struct swap_info_struct *sis = swap_info[type]; if (sis->flags & SWP_WRITEOK) { n = sis->pages; if (free) n -= sis->inuse_pages; } } spin_unlock(&swap_lock); return n; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/283fb25624bf253d120708152e23cf9143519198
283fb25624bf253d120708152e23cf9143519198
Coverity; Fixing pass by value bugs. CID=101466, 101464, 101494, 101495, 101496, 101497 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/8956046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115399 0039d316-1c4b-4281-b951-d872f2087c98
string16 ExtensionInstallUI::Prompt::GetHeading(std::string extension_name) string16 ExtensionInstallUI::Prompt::GetHeading( const std::string& extension_name) const { if (type_ == INLINE_INSTALL_PROMPT) { return UTF8ToUTF16(extension_name); } else { return l10n_util::GetStringFUTF16( kHeadingIds[type_], UTF8ToUTF16(extension_name)); } }
string16 ExtensionInstallUI::Prompt::GetHeading(std::string extension_name) const { if (type_ == INLINE_INSTALL_PROMPT) { return UTF8ToUTF16(extension_name); } else { return l10n_util::GetStringFUTF16( kHeadingIds[type_], UTF8ToUTF16(extension_name)); } }
C
Chrome
1
CVE-2018-13304
https://www.cvedetails.com/cve/CVE-2018-13304/
CWE-617
https://github.com/FFmpeg/FFmpeg/commit/bd27a9364ca274ca97f1df6d984e88a0700fb235
bd27a9364ca274ca97f1df6d984e88a0700fb235
avcodec/mpeg4videodec: Remove use of FF_PROFILE_MPEG4_SIMPLE_STUDIO as indicator of studio profile The profile field is changed by code inside and outside the decoder, its not a reliable indicator of the internal codec state. Maintaining it consistency with studio_profile is messy. Its easier to just avoid it and use only studio_profile Fixes: assertion failure Fixes: ffmpeg_crash_9.avi Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
av_cold int ff_h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int ret; s->out_format = FMT_H263; ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->quant_precision = 5; s->decode_mb = ff_h263_decode_mb; s->low_delay = 1; s->unrestricted_mv = 1; /* select sub codec */ switch (avctx->codec->id) { case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: s->unrestricted_mv = 0; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; break; case AV_CODEC_ID_MPEG4: break; case AV_CODEC_ID_MSMPEG4V1: s->h263_pred = 1; s->msmpeg4_version = 1; break; case AV_CODEC_ID_MSMPEG4V2: s->h263_pred = 1; s->msmpeg4_version = 2; break; case AV_CODEC_ID_MSMPEG4V3: s->h263_pred = 1; s->msmpeg4_version = 3; break; case AV_CODEC_ID_WMV1: s->h263_pred = 1; s->msmpeg4_version = 4; break; case AV_CODEC_ID_WMV2: s->h263_pred = 1; s->msmpeg4_version = 5; break; case AV_CODEC_ID_VC1: case AV_CODEC_ID_WMV3: case AV_CODEC_ID_VC1IMAGE: case AV_CODEC_ID_WMV3IMAGE: case AV_CODEC_ID_MSS2: s->h263_pred = 1; s->msmpeg4_version = 6; avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case AV_CODEC_ID_H263I: break; case AV_CODEC_ID_FLV1: s->h263_flv = 1; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n", avctx->codec->id); return AVERROR(ENOSYS); } s->codec_id = avctx->codec->id; if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263")) if (avctx->extradata_size == 56 && avctx->extradata[0] == 1) s->ehc_mode = 1; /* for H.263, we allocate the images after having read the header */ if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_H263P && avctx->codec->id != AV_CODEC_ID_MPEG4) { avctx->pix_fmt = h263_get_format(avctx); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; } ff_h263dsp_init(&s->h263dsp); ff_qpeldsp_init(&s->qdsp); ff_h263_decode_init_vlc(); return 0; }
av_cold int ff_h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int ret; s->out_format = FMT_H263; ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->quant_precision = 5; s->decode_mb = ff_h263_decode_mb; s->low_delay = 1; s->unrestricted_mv = 1; /* select sub codec */ switch (avctx->codec->id) { case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: s->unrestricted_mv = 0; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; break; case AV_CODEC_ID_MPEG4: break; case AV_CODEC_ID_MSMPEG4V1: s->h263_pred = 1; s->msmpeg4_version = 1; break; case AV_CODEC_ID_MSMPEG4V2: s->h263_pred = 1; s->msmpeg4_version = 2; break; case AV_CODEC_ID_MSMPEG4V3: s->h263_pred = 1; s->msmpeg4_version = 3; break; case AV_CODEC_ID_WMV1: s->h263_pred = 1; s->msmpeg4_version = 4; break; case AV_CODEC_ID_WMV2: s->h263_pred = 1; s->msmpeg4_version = 5; break; case AV_CODEC_ID_VC1: case AV_CODEC_ID_WMV3: case AV_CODEC_ID_VC1IMAGE: case AV_CODEC_ID_WMV3IMAGE: case AV_CODEC_ID_MSS2: s->h263_pred = 1; s->msmpeg4_version = 6; avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case AV_CODEC_ID_H263I: break; case AV_CODEC_ID_FLV1: s->h263_flv = 1; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n", avctx->codec->id); return AVERROR(ENOSYS); } s->codec_id = avctx->codec->id; if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263")) if (avctx->extradata_size == 56 && avctx->extradata[0] == 1) s->ehc_mode = 1; /* for H.263, we allocate the images after having read the header */ if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_H263P && avctx->codec->id != AV_CODEC_ID_MPEG4) { avctx->pix_fmt = h263_get_format(avctx); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; } ff_h263dsp_init(&s->h263dsp); ff_qpeldsp_init(&s->qdsp); ff_h263_decode_init_vlc(); return 0; }
C
FFmpeg
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test R=kbr@chromium.org,piman@chromium.org Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <piman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org> Cr-Commit-Position: refs/heads/master@{#486518}
GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) { if (isContextLost()) return GL_FRAMEBUFFER_UNSUPPORTED; if (!ValidateFramebufferTarget(target)) { SynthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid target"); return 0; } WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); if (framebuffer_binding) { const char* reason = "framebuffer incomplete"; GLenum status = framebuffer_binding->CheckDepthStencilStatus(&reason); if (status != GL_FRAMEBUFFER_COMPLETE) { EmitGLWarning("checkFramebufferStatus", reason); return status; } } return ContextGL()->CheckFramebufferStatus(target); }
GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) { if (isContextLost()) return GL_FRAMEBUFFER_UNSUPPORTED; if (!ValidateFramebufferTarget(target)) { SynthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid target"); return 0; } WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); if (framebuffer_binding) { const char* reason = "framebuffer incomplete"; GLenum status = framebuffer_binding->CheckDepthStencilStatus(&reason); if (status != GL_FRAMEBUFFER_COMPLETE) { EmitGLWarning("checkFramebufferStatus", reason); return status; } } return ContextGL()->CheckFramebufferStatus(target); }
C
Chrome
0
CVE-2013-4591
https://www.cvedetails.com/cve/CVE-2013-4591/
CWE-119
https://github.com/torvalds/linux/commit/7d3e91a89b7adbc2831334def9e494dd9892f9af
7d3e91a89b7adbc2831334def9e494dd9892f9af
NFSv4: Check for buffer length in __nfs4_get_acl_uncached Commit 1f1ea6c "NFSv4: Fix buffer overflow checking in __nfs4_get_acl_uncached" accidently dropped the checking for too small result buffer length. If someone uses getxattr on "system.nfs4_acl" on an NFSv4 mount supporting ACLs, the ACL has not been cached and the buffer suplied is too short, we still copy the complete ACL, resulting in kernel and user space memory corruption. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Cc: stable@kernel.org Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request) { int status = NFS_OK; if (test_bit(LK_STATE_IN_USE, &state->flags)) status = nfs41_check_expired_locks(state); if (status != NFS_OK) status = nfs4_lock_expired(state, request); return status; }
static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request) { int status = NFS_OK; if (test_bit(LK_STATE_IN_USE, &state->flags)) status = nfs41_check_expired_locks(state); if (status != NFS_OK) status = nfs4_lock_expired(state, request); return status; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/eb7971fdb0c3b76bacfb77c1ecc76459ef481f17
eb7971fdb0c3b76bacfb77c1ecc76459ef481f17
Implement delegation to Metro file pickers. R=cpu@chromium.org,robertshield@chromium.org BUG=None TEST=None Review URL: https://chromiumcodereview.appspot.com/10310103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136624 0039d316-1c4b-4281-b951-d872f2087c98
std::wstring AppendExtensionIfNeeded(const std::wstring& filename, const std::wstring& filter_selected, const std::wstring& suggested_ext) { DCHECK(!filename.empty()); std::wstring return_value = filename; std::wstring file_extension( GetExtensionWithoutLeadingDot(FilePath(filename).Extension())); std::wstring key(L"." + file_extension); if (!(filter_selected.empty() || filter_selected == L"*.*") && !base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() && file_extension != suggested_ext) { if (return_value[return_value.length() - 1] != L'.') return_value.append(L"."); return_value.append(suggested_ext); } size_t index = return_value.find_last_not_of(L'.'); if (index < return_value.size() - 1) return_value.resize(index + 1); return return_value; }
std::wstring AppendExtensionIfNeeded(const std::wstring& filename, const std::wstring& filter_selected, const std::wstring& suggested_ext) { DCHECK(!filename.empty()); std::wstring return_value = filename; std::wstring file_extension( GetExtensionWithoutLeadingDot(FilePath(filename).Extension())); std::wstring key(L"." + file_extension); if (!(filter_selected.empty() || filter_selected == L"*.*") && !base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() && file_extension != suggested_ext) { if (return_value[return_value.length() - 1] != L'.') return_value.append(L"."); return_value.append(suggested_ext); } size_t index = return_value.find_last_not_of(L'.'); if (index < return_value.size() - 1) return_value.resize(index + 1); return return_value; }
C
Chrome
0
CVE-2016-8602
https://www.cvedetails.com/cve/CVE-2016-8602/
CWE-704
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f5c7555c303
f5c7555c30393e64ec1f5ab0dfae5b55b3b3fc78
null
gs_get_colorname_string(const gs_memory_t *mem, gs_separation_name colorname_index, unsigned char **ppstr, unsigned int *pname_size) { ref nref; name_index_ref(mem, colorname_index, &nref); name_string_ref(mem, &nref, &nref); return obj_string_data(mem, &nref, (const unsigned char**) ppstr, pname_size); }
gs_get_colorname_string(const gs_memory_t *mem, gs_separation_name colorname_index, unsigned char **ppstr, unsigned int *pname_size) { ref nref; name_index_ref(mem, colorname_index, &nref); name_string_ref(mem, &nref, &nref); return obj_string_data(mem, &nref, (const unsigned char**) ppstr, pname_size); }
C
ghostscript
0
CVE-2013-6401
https://www.cvedetails.com/cve/CVE-2013-6401/
CWE-310
https://github.com/akheron/jansson/commit/8f80c2d83808150724d31793e6ade92749b1faa4
8f80c2d83808150724d31793e6ade92749b1faa4
CVE-2013-6401: Change hash function, randomize hashes Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing and testing.
void hashtable_close(hashtable_t *hashtable) { hashtable_do_clear(hashtable); jsonp_free(hashtable->buckets); }
void hashtable_close(hashtable_t *hashtable) { hashtable_do_clear(hashtable); jsonp_free(hashtable->buckets); }
C
jansson
0
CVE-2016-5165
https://www.cvedetails.com/cve/CVE-2016-5165/
CWE-79
https://github.com/chromium/chromium/commit/19b8593007150b9a78da7d13f6e5f8feb10881a7
19b8593007150b9a78da7d13f6e5f8feb10881a7
Add CPU metrics provider and Add CPU/GPU provider for UKM. Bug: 907674 Change-Id: I61b88aeac8d2a7ff81d812fa5a267f48203ec7e2 Reviewed-on: https://chromium-review.googlesource.com/c/1381376 Commit-Queue: Nik Bhagat <nikunjb@chromium.org> Reviewed-by: Robert Kaplow <rkaplow@chromium.org> Cr-Commit-Position: refs/heads/master@{#618037}
ChromeMetricsServiceClient::GetMetricsReportingDefaultState() { return metrics::GetMetricsReportingDefaultState( g_browser_process->local_state()); }
ChromeMetricsServiceClient::GetMetricsReportingDefaultState() { return metrics::GetMetricsReportingDefaultState( g_browser_process->local_state()); }
C
Chrome
0
CVE-2013-1415
https://www.cvedetails.com/cve/CVE-2013-1415/
null
https://github.com/krb5/krb5/commit/f249555301940c6df3a2cdda13b56b5674eebc2e
f249555301940c6df3a2cdda13b56b5674eebc2e
PKINIT null pointer deref [CVE-2013-1415] Don't dereference a null pointer when cleaning up. The KDC plugin for PKINIT can dereference a null pointer when a malformed packet causes processing to terminate early, leading to a crash of the KDC process. An attacker would need to have a valid PKINIT certificate or have observed a successful PKINIT authentication, or an unauthenticated attacker could execute the attack if anonymous PKINIT is enabled. CVSSv2 vector: AV:N/AC:M/Au:N/C:N/I:N/A:C/E:P/RL:O/RC:C This is a minimal commit for pullup; style fixes in a followup. [kaduk@mit.edu: reformat and edit commit message] (cherry picked from commit c773d3c775e9b2d88bcdff5f8a8ba88d7ec4e8ed) ticket: 7570 version_fixed: 1.11.1 status: resolved
X509_NAME_oneline_ex(X509_NAME * a, char *buf, unsigned int *size, unsigned long flag) { BIO *out = NULL; out = BIO_new(BIO_s_mem ()); if (X509_NAME_print_ex(out, a, 0, flag) > 0) { if (buf != NULL && (*size) > (unsigned int) BIO_number_written(out)) { memset(buf, 0, *size); BIO_read(out, buf, (int) BIO_number_written(out)); } else { *size = BIO_number_written(out); } } BIO_free(out); return (buf); }
X509_NAME_oneline_ex(X509_NAME * a, char *buf, unsigned int *size, unsigned long flag) { BIO *out = NULL; out = BIO_new(BIO_s_mem ()); if (X509_NAME_print_ex(out, a, 0, flag) > 0) { if (buf != NULL && (*size) > (unsigned int) BIO_number_written(out)) { memset(buf, 0, *size); BIO_read(out, buf, (int) BIO_number_written(out)); } else { *size = BIO_number_written(out); } } BIO_free(out); return (buf); }
C
krb5
0
CVE-2018-6051
https://www.cvedetails.com/cve/CVE-2018-6051/
CWE-79
https://github.com/chromium/chromium/commit/0da6dcdbe8e34740133773d20cc466b89d399d0a
0da6dcdbe8e34740133773d20cc466b89d399d0a
Restrict the xss audit report URL to same origin BUG=441275 R=tsepez@chromium.org,mkwst@chromium.org Change-Id: I27bc8e251b9ad962c3b4fdebf084a2b9152f915d Reviewed-on: https://chromium-review.googlesource.com/768367 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#516666}
void XSSAuditor::InitForFragment() { DCHECK(IsMainThread()); DCHECK_EQ(state_, kUninitialized); state_ = kFilteringTokens; DCHECK(!is_enabled_); }
void XSSAuditor::InitForFragment() { DCHECK(IsMainThread()); DCHECK_EQ(state_, kUninitialized); state_ = kFilteringTokens; DCHECK(!is_enabled_); }
C
Chrome
0
CVE-2016-4301
https://www.cvedetails.com/cve/CVE-2016-4301/
CWE-119
https://github.com/libarchive/libarchive/commit/a550daeecf6bc689ade371349892ea17b5b97c77
a550daeecf6bc689ade371349892ea17b5b97c77
Fix libarchive/archive_read_support_format_mtree.c:1388:11: error: array subscript is above array bounds
parse_keyword(struct archive_read *a, struct mtree *mtree, struct archive_entry *entry, struct mtree_option *opt, int *parsed_kws) { char *val, *key; key = opt->value; if (*key == '\0') return (ARCHIVE_OK); if (strcmp(key, "nochange") == 0) { *parsed_kws |= MTREE_HAS_NOCHANGE; return (ARCHIVE_OK); } if (strcmp(key, "optional") == 0) { *parsed_kws |= MTREE_HAS_OPTIONAL; return (ARCHIVE_OK); } if (strcmp(key, "ignore") == 0) { /* * The mtree processing is not recursive, so * recursion will only happen for explicitly listed * entries. */ return (ARCHIVE_OK); } val = strchr(key, '='); if (val == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Malformed attribute \"%s\" (%d)", key, key[0]); return (ARCHIVE_WARN); } *val = '\0'; ++val; switch (key[0]) { case 'c': if (strcmp(key, "content") == 0 || strcmp(key, "contents") == 0) { parse_escapes(val, NULL); archive_strcpy(&mtree->contents_name, val); break; } if (strcmp(key, "cksum") == 0) break; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs * of a char/block special file */ int r; dev_t dev; *parsed_kws |= MTREE_HAS_DEVICE; r = parse_device(&dev, &a->archive, val); if (r == ARCHIVE_OK) archive_entry_set_rdev(entry, dev); return r; } case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; archive_entry_set_gid(entry, mtree_atol10(&val)); break; } if (strcmp(key, "gname") == 0) { *parsed_kws |= MTREE_HAS_GNAME; archive_entry_copy_gname(entry, val); break; } case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol10(&val)); break; } case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; if (strcmp(key, "mode") == 0) { if (val[0] >= '0' && val[0] <= '9') { *parsed_kws |= MTREE_HAS_PERM; archive_entry_set_perm(entry, (mode_t)mtree_atol8(&val)); } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Symbolic mode \"%s\" unsupported", val); return ARCHIVE_WARN; } break; } case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; archive_entry_set_nlink(entry, (unsigned int)mtree_atol10(&val)); break; } case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the * inode resides */ int r; dev_t dev; r = parse_device(&dev, &a->archive, val); if (r == ARCHIVE_OK) archive_entry_set_dev(entry, dev); return r; } if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; if (strcmp(key, "sha256") == 0 || strcmp(key, "sha256digest") == 0) break; if (strcmp(key, "sha384") == 0 || strcmp(key, "sha384digest") == 0) break; if (strcmp(key, "sha512") == 0 || strcmp(key, "sha512digest") == 0) break; if (strcmp(key, "size") == 0) { archive_entry_set_size(entry, mtree_atol10(&val)); break; } case 't': if (strcmp(key, "tags") == 0) { /* * Comma delimited list of tags. * Ignore the tags for now, but the interface * should be extended to allow inclusion/exclusion. */ break; } if (strcmp(key, "time") == 0) { int64_t m; int64_t my_time_t_max = get_time_t_max(); int64_t my_time_t_min = get_time_t_min(); long ns = 0; *parsed_kws |= MTREE_HAS_MTIME; m = mtree_atol10(&val); /* Replicate an old mtree bug: * 123456789.1 represents 123456789 * seconds and 1 nanosecond. */ if (*val == '.') { ++val; ns = (long)mtree_atol10(&val); } else ns = 0; if (m > my_time_t_max) m = my_time_t_max; else if (m < my_time_t_min) m = my_time_t_min; archive_entry_set_mtime(entry, (time_t)m, ns); break; } if (strcmp(key, "type") == 0) { switch (val[0]) { case 'b': if (strcmp(val, "block") == 0) { archive_entry_set_filetype(entry, AE_IFBLK); break; } case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, AE_IFIFO); break; } if (strcmp(val, "file") == 0) { archive_entry_set_filetype(entry, AE_IFREG); break; } case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized file type \"%s\"; " "assuming \"file\"", val); archive_entry_set_filetype(entry, AE_IFREG); return (ARCHIVE_WARN); } *parsed_kws |= MTREE_HAS_TYPE; break; } case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; archive_entry_set_uid(entry, mtree_atol10(&val)); break; } if (strcmp(key, "uname") == 0) { *parsed_kws |= MTREE_HAS_UNAME; archive_entry_copy_uname(entry, val); break; } default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); return (ARCHIVE_WARN); } return (ARCHIVE_OK); }
parse_keyword(struct archive_read *a, struct mtree *mtree, struct archive_entry *entry, struct mtree_option *opt, int *parsed_kws) { char *val, *key; key = opt->value; if (*key == '\0') return (ARCHIVE_OK); if (strcmp(key, "nochange") == 0) { *parsed_kws |= MTREE_HAS_NOCHANGE; return (ARCHIVE_OK); } if (strcmp(key, "optional") == 0) { *parsed_kws |= MTREE_HAS_OPTIONAL; return (ARCHIVE_OK); } if (strcmp(key, "ignore") == 0) { /* * The mtree processing is not recursive, so * recursion will only happen for explicitly listed * entries. */ return (ARCHIVE_OK); } val = strchr(key, '='); if (val == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Malformed attribute \"%s\" (%d)", key, key[0]); return (ARCHIVE_WARN); } *val = '\0'; ++val; switch (key[0]) { case 'c': if (strcmp(key, "content") == 0 || strcmp(key, "contents") == 0) { parse_escapes(val, NULL); archive_strcpy(&mtree->contents_name, val); break; } if (strcmp(key, "cksum") == 0) break; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs * of a char/block special file */ int r; dev_t dev; *parsed_kws |= MTREE_HAS_DEVICE; r = parse_device(&dev, &a->archive, val); if (r == ARCHIVE_OK) archive_entry_set_rdev(entry, dev); return r; } case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; archive_entry_set_gid(entry, mtree_atol10(&val)); break; } if (strcmp(key, "gname") == 0) { *parsed_kws |= MTREE_HAS_GNAME; archive_entry_copy_gname(entry, val); break; } case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol10(&val)); break; } case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; if (strcmp(key, "mode") == 0) { if (val[0] >= '0' && val[0] <= '9') { *parsed_kws |= MTREE_HAS_PERM; archive_entry_set_perm(entry, (mode_t)mtree_atol8(&val)); } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Symbolic mode \"%s\" unsupported", val); return ARCHIVE_WARN; } break; } case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; archive_entry_set_nlink(entry, (unsigned int)mtree_atol10(&val)); break; } case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the * inode resides */ int r; dev_t dev; r = parse_device(&dev, &a->archive, val); if (r == ARCHIVE_OK) archive_entry_set_dev(entry, dev); return r; } if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; if (strcmp(key, "sha256") == 0 || strcmp(key, "sha256digest") == 0) break; if (strcmp(key, "sha384") == 0 || strcmp(key, "sha384digest") == 0) break; if (strcmp(key, "sha512") == 0 || strcmp(key, "sha512digest") == 0) break; if (strcmp(key, "size") == 0) { archive_entry_set_size(entry, mtree_atol10(&val)); break; } case 't': if (strcmp(key, "tags") == 0) { /* * Comma delimited list of tags. * Ignore the tags for now, but the interface * should be extended to allow inclusion/exclusion. */ break; } if (strcmp(key, "time") == 0) { int64_t m; int64_t my_time_t_max = get_time_t_max(); int64_t my_time_t_min = get_time_t_min(); long ns = 0; *parsed_kws |= MTREE_HAS_MTIME; m = mtree_atol10(&val); /* Replicate an old mtree bug: * 123456789.1 represents 123456789 * seconds and 1 nanosecond. */ if (*val == '.') { ++val; ns = (long)mtree_atol10(&val); } else ns = 0; if (m > my_time_t_max) m = my_time_t_max; else if (m < my_time_t_min) m = my_time_t_min; archive_entry_set_mtime(entry, (time_t)m, ns); break; } if (strcmp(key, "type") == 0) { switch (val[0]) { case 'b': if (strcmp(val, "block") == 0) { archive_entry_set_filetype(entry, AE_IFBLK); break; } case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, AE_IFIFO); break; } if (strcmp(val, "file") == 0) { archive_entry_set_filetype(entry, AE_IFREG); break; } case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized file type \"%s\"; " "assuming \"file\"", val); archive_entry_set_filetype(entry, AE_IFREG); return (ARCHIVE_WARN); } *parsed_kws |= MTREE_HAS_TYPE; break; } case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; archive_entry_set_uid(entry, mtree_atol10(&val)); break; } if (strcmp(key, "uname") == 0) { *parsed_kws |= MTREE_HAS_UNAME; archive_entry_copy_uname(entry, val); break; } default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); return (ARCHIVE_WARN); } return (ARCHIVE_OK); }
C
libarchive
0
CVE-2011-3053
https://www.cvedetails.com/cve/CVE-2011-3053/
CWE-399
https://github.com/chromium/chromium/commit/c442b3eda2f1fdd4d1d4864c34c43cbaf223acae
c442b3eda2f1fdd4d1d4864c34c43cbaf223acae
chromeos: Move audio, power, and UI files into subdirs. This moves more files from chrome/browser/chromeos/ into subdirectories. BUG=chromium-os:22896 TEST=did chrome os builds both with and without aura TBR=sky Review URL: http://codereview.chromium.org/9125006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116746 0039d316-1c4b-4281-b951-d872f2087c98
AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() { if (!action_taken_) { auto_launch_trial::UpdateInfobarResponseMetric( auto_launch_trial::INFOBAR_IGNORE); } }
AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() { if (!action_taken_) { auto_launch_trial::UpdateInfobarResponseMetric( auto_launch_trial::INFOBAR_IGNORE); } }
C
Chrome
0
CVE-2013-1929
https://www.cvedetails.com/cve/CVE-2013-1929/
CWE-119
https://github.com/torvalds/linux/commit/715230a44310a8cf66fbfb5a46f9a62a9b2de424
715230a44310a8cf66fbfb5a46f9a62a9b2de424
tg3: fix length overflow in VPD firmware parsing Commit 184b89044fb6e2a74611dafa69b1dce0d98612c6 ("tg3: Use VPD fw version when present") introduced VPD parsing that contained a potential length overflow. Limit the hardware's reported firmware string length (max 255 bytes) to stay inside the driver's firmware string length (32 bytes). On overflow, truncate the formatted firmware string instead of potentially overwriting portions of the tg3 struct. http://cansecwest.com/slides/2013/PrivateCore%20CSW%202013.pdf Signed-off-by: Kees Cook <keescook@chromium.org> Reported-by: Oded Horovitz <oded@privatecore.com> Reported-by: Brad Spengler <spender@grsecurity.net> Cc: stable@vger.kernel.org Cc: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static void tg3_ints_fini(struct tg3 *tp) { if (tg3_flag(tp, USING_MSIX)) pci_disable_msix(tp->pdev); else if (tg3_flag(tp, USING_MSI)) pci_disable_msi(tp->pdev); tg3_flag_clear(tp, USING_MSI); tg3_flag_clear(tp, USING_MSIX); tg3_flag_clear(tp, ENABLE_RSS); tg3_flag_clear(tp, ENABLE_TSS); }
static void tg3_ints_fini(struct tg3 *tp) { if (tg3_flag(tp, USING_MSIX)) pci_disable_msix(tp->pdev); else if (tg3_flag(tp, USING_MSI)) pci_disable_msi(tp->pdev); tg3_flag_clear(tp, USING_MSI); tg3_flag_clear(tp, USING_MSIX); tg3_flag_clear(tp, ENABLE_RSS); tg3_flag_clear(tp, ENABLE_TSS); }
C
linux
0
CVE-2016-2464
https://www.cvedetails.com/cve/CVE-2016-2464/
CWE-20
https://android.googlesource.com/platform/external/libvpx/+/65c49d5b382de4085ee5668732bcb0f6ecaf7148
65c49d5b382de4085ee5668732bcb0f6ecaf7148
Fix ParseElementHeader to support 0 payload elements Cherry-pick'ing Change 5c83bbec9a5f6f00a349674ddad85b753d2ea219 from upstream. This fixes regression in some edge cases for mkv playback. BUG=26499283 Change-Id: I88de03219a3d941b6b2f251d384e29c36bdd4d9b
long Segment::Load() { assert(m_clusters == NULL); assert(m_clusterSize == 0); assert(m_clusterCount == 0); const long long header_status = ParseHeaders(); if (header_status < 0) // error return static_cast<long>(header_status); if (header_status > 0) // underflow return E_BUFFER_NOT_FULL; if (m_pInfo == NULL || m_pTracks == NULL) return E_FILE_FORMAT_INVALID; for (;;) { const int status = LoadCluster(); if (status < 0) // error return status; if (status >= 1) // no more clusters return 0; } }
long Segment::Load() { assert(m_clusters == NULL); assert(m_clusterSize == 0); assert(m_clusterCount == 0); const long long header_status = ParseHeaders(); if (header_status < 0) // error return static_cast<long>(header_status); if (header_status > 0) // underflow return E_BUFFER_NOT_FULL; if (m_pInfo == NULL || m_pTracks == NULL) return E_FILE_FORMAT_INVALID; for (;;) { const int status = LoadCluster(); if (status < 0) // error return status; if (status >= 1) // no more clusters return 0; } }
C
Android
0
CVE-2017-12877
https://www.cvedetails.com/cve/CVE-2017-12877/
CWE-416
https://github.com/ImageMagick/ImageMagick/commit/04178de2247e353fc095846784b9a10fefdbf890
04178de2247e353fc095846784b9a10fefdbf890
https://github.com/ImageMagick/ImageMagick/issues/662
static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { typedef struct { unsigned char Type[4]; unsigned int nRows; unsigned int nCols; unsigned int imagf; unsigned int nameLen; } MAT4_HDR; long ldblk; EndianType endian; Image *rotate_image; MagickBooleanType status; MAT4_HDR HDR; QuantumInfo *quantum_info; QuantumFormatType format_type; register ssize_t i; ssize_t count, y; unsigned char *pixels; unsigned int depth; quantum_info=(QuantumInfo *) NULL; (void) SeekBlob(image,0,SEEK_SET); while (EOFBlob(image) != MagickFalse) { /* Object parser loop. */ ldblk=ReadBlobLSBLong(image); if ((ldblk > 9999) || (ldblk < 0)) break; HDR.Type[3]=ldblk % 10; ldblk /= 10; /* T digit */ HDR.Type[2]=ldblk % 10; ldblk /= 10; /* P digit */ HDR.Type[1]=ldblk % 10; ldblk /= 10; /* O digit */ HDR.Type[0]=ldblk; /* M digit */ if (HDR.Type[3] != 0) break; /* Data format */ if (HDR.Type[2] != 0) break; /* Always 0 */ if (HDR.Type[0] == 0) { HDR.nRows=ReadBlobLSBLong(image); HDR.nCols=ReadBlobLSBLong(image); HDR.imagf=ReadBlobLSBLong(image); HDR.nameLen=ReadBlobLSBLong(image); endian=LSBEndian; } else { HDR.nRows=ReadBlobMSBLong(image); HDR.nCols=ReadBlobMSBLong(image); HDR.imagf=ReadBlobMSBLong(image); HDR.nameLen=ReadBlobMSBLong(image); endian=MSBEndian; } if ((HDR.imagf != 0) && (HDR.imagf != 1)) break; if (HDR.nameLen > 0xFFFF) return((Image *) NULL); for (i=0; i < (ssize_t) HDR.nameLen; i++) { int byte; /* Skip matrix name. */ byte=ReadBlobByte(image); if (byte == EOF) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } } image->columns=(size_t) HDR.nRows; image->rows=(size_t) HDR.nCols; SetImageColorspace(image,GRAYColorspace,exception); if (image_info->ping != MagickFalse) { Swap(image->columns,image->rows); return(image); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return((Image *) NULL); quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) return((Image *) NULL); switch(HDR.Type[1]) { case 0: format_type=FloatingPointQuantumFormat; depth=64; break; case 1: format_type=FloatingPointQuantumFormat; depth=32; break; case 2: format_type=UnsignedQuantumFormat; depth=16; break; case 3: format_type=SignedQuantumFormat; depth=16; break; case 4: format_type=UnsignedQuantumFormat; depth=8; break; default: format_type=UnsignedQuantumFormat; depth=8; break; } image->depth=depth; if (HDR.Type[0] != 0) SetQuantumEndian(image,quantum_info,MSBEndian); status=SetQuantumFormat(image,quantum_info,format_type); status=SetQuantumDepth(image,quantum_info,depth); status=SetQuantumEndian(image,quantum_info,endian); SetQuantumScale(quantum_info,1.0); pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; q=QueueAuthenticPixels(image,0,image->rows-y-1,image->columns,1, exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, GrayQuantum,pixels,exception); if ((HDR.Type[1] == 2) || (HDR.Type[1] == 3)) FixSignedValues(image,q,(int) image->columns); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (HDR.imagf == 1) for (y=0; y < (ssize_t) image->rows; y++) { /* Read complex pixels. */ count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; if (HDR.Type[1] == 0) InsertComplexDoubleRow(image,(double *) pixels,y,0,0,exception); else InsertComplexFloatRow(image,(float *) pixels,y,0,0,exception); } if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); rotate_image=RotateImage(image,90.0,exception); if (rotate_image != (Image *) NULL) { image=DestroyImage(image); image=rotate_image; } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } (void) CloseBlob(image); return(GetFirstImageInList(image)); }
static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { typedef struct { unsigned char Type[4]; unsigned int nRows; unsigned int nCols; unsigned int imagf; unsigned int nameLen; } MAT4_HDR; long ldblk; EndianType endian; Image *rotate_image; MagickBooleanType status; MAT4_HDR HDR; QuantumInfo *quantum_info; QuantumFormatType format_type; register ssize_t i; ssize_t count, y; unsigned char *pixels; unsigned int depth; quantum_info=(QuantumInfo *) NULL; (void) SeekBlob(image,0,SEEK_SET); while (EOFBlob(image) != MagickFalse) { /* Object parser loop. */ ldblk=ReadBlobLSBLong(image); if ((ldblk > 9999) || (ldblk < 0)) break; HDR.Type[3]=ldblk % 10; ldblk /= 10; /* T digit */ HDR.Type[2]=ldblk % 10; ldblk /= 10; /* P digit */ HDR.Type[1]=ldblk % 10; ldblk /= 10; /* O digit */ HDR.Type[0]=ldblk; /* M digit */ if (HDR.Type[3] != 0) break; /* Data format */ if (HDR.Type[2] != 0) break; /* Always 0 */ if (HDR.Type[0] == 0) { HDR.nRows=ReadBlobLSBLong(image); HDR.nCols=ReadBlobLSBLong(image); HDR.imagf=ReadBlobLSBLong(image); HDR.nameLen=ReadBlobLSBLong(image); endian=LSBEndian; } else { HDR.nRows=ReadBlobMSBLong(image); HDR.nCols=ReadBlobMSBLong(image); HDR.imagf=ReadBlobMSBLong(image); HDR.nameLen=ReadBlobMSBLong(image); endian=MSBEndian; } if ((HDR.imagf != 0) && (HDR.imagf != 1)) break; if (HDR.nameLen > 0xFFFF) return((Image *) NULL); for (i=0; i < (ssize_t) HDR.nameLen; i++) { int byte; /* Skip matrix name. */ byte=ReadBlobByte(image); if (byte == EOF) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } } image->columns=(size_t) HDR.nRows; image->rows=(size_t) HDR.nCols; SetImageColorspace(image,GRAYColorspace,exception); if (image_info->ping != MagickFalse) { Swap(image->columns,image->rows); return(image); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return((Image *) NULL); quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) return((Image *) NULL); switch(HDR.Type[1]) { case 0: format_type=FloatingPointQuantumFormat; depth=64; break; case 1: format_type=FloatingPointQuantumFormat; depth=32; break; case 2: format_type=UnsignedQuantumFormat; depth=16; break; case 3: format_type=SignedQuantumFormat; depth=16; break; case 4: format_type=UnsignedQuantumFormat; depth=8; break; default: format_type=UnsignedQuantumFormat; depth=8; break; } image->depth=depth; if (HDR.Type[0] != 0) SetQuantumEndian(image,quantum_info,MSBEndian); status=SetQuantumFormat(image,quantum_info,format_type); status=SetQuantumDepth(image,quantum_info,depth); status=SetQuantumEndian(image,quantum_info,endian); SetQuantumScale(quantum_info,1.0); pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; q=QueueAuthenticPixels(image,0,image->rows-y-1,image->columns,1, exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, GrayQuantum,pixels,exception); if ((HDR.Type[1] == 2) || (HDR.Type[1] == 3)) FixSignedValues(image,q,(int) image->columns); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (HDR.imagf == 1) for (y=0; y < (ssize_t) image->rows; y++) { /* Read complex pixels. */ count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; if (HDR.Type[1] == 0) InsertComplexDoubleRow(image,(double *) pixels,y,0,0,exception); else InsertComplexFloatRow(image,(float *) pixels,y,0,0,exception); } if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); rotate_image=RotateImage(image,90.0,exception); if (rotate_image != (Image *) NULL) { image=DestroyImage(image); image=rotate_image; } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } (void) CloseBlob(image); return(GetFirstImageInList(image)); }
C
ImageMagick
0
CVE-2016-4303
https://www.cvedetails.com/cve/CVE-2016-4303/
CWE-119
https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a
91f2fa59e8ed80dfbf400add0164ee0e508e412a
Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed here in iperf3 by importing a newer version of cJSON (plus local ESnet modifications). Discovered and reported by Dave McDaniel, Cisco Talos. Based on a patch by @dopheide-esnet, with input from @DaveGamble. Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001, CVE-2016-4303 (cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40) Signed-off-by: Bruce A. Mah <bmah@es.net>
int cJSON_GetArraySize( cJSON *array )
int cJSON_GetArraySize( cJSON *array ) { cJSON *c = array->child; int i = 0; while ( c ) { ++i; c = c->next; } return i; }
C
iperf
1
CVE-2013-2858
https://www.cvedetails.com/cve/CVE-2013-2858/
CWE-416
https://github.com/chromium/chromium/commit/828eab2216a765dea92575c290421c115b8ad028
828eab2216a765dea92575c290421c115b8ad028
Added daily UMA for non-data-reduction-proxy data usage when the proxy is enabled. BUG=325325 Review URL: https://codereview.chromium.org/106113002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239897 0039d316-1c4b-4281-b951-d872f2087c98
base::Time FakeNow() const { return now_ + now_delta_; }
base::Time FakeNow() const { return now_ + now_delta_; }
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 <jannh@google.com>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top
static int migration_cpu_stop(void *data) { struct migration_arg *arg = data; struct task_struct *p = arg->task; struct rq *rq = this_rq(); /* * The original target cpu might have gone down and we might * be on another cpu but it doesn't matter. */ local_irq_disable(); /* * We need to explicitly wake pending tasks before running * __migrate_task() such that we will not miss enforcing cpus_allowed * during wakeups, see set_cpus_allowed_ptr()'s TASK_WAKING test. */ sched_ttwu_pending(); raw_spin_lock(&p->pi_lock); raw_spin_lock(&rq->lock); /* * If task_rq(p) != rq, it cannot be migrated here, because we're * holding rq->lock, if p->on_rq == 0 it cannot get enqueued because * we're holding p->pi_lock. */ if (task_rq(p) == rq && task_on_rq_queued(p)) rq = __migrate_task(rq, p, arg->dest_cpu); raw_spin_unlock(&rq->lock); raw_spin_unlock(&p->pi_lock); local_irq_enable(); return 0; }
static int migration_cpu_stop(void *data) { struct migration_arg *arg = data; struct task_struct *p = arg->task; struct rq *rq = this_rq(); /* * The original target cpu might have gone down and we might * be on another cpu but it doesn't matter. */ local_irq_disable(); /* * We need to explicitly wake pending tasks before running * __migrate_task() such that we will not miss enforcing cpus_allowed * during wakeups, see set_cpus_allowed_ptr()'s TASK_WAKING test. */ sched_ttwu_pending(); raw_spin_lock(&p->pi_lock); raw_spin_lock(&rq->lock); /* * If task_rq(p) != rq, it cannot be migrated here, because we're * holding rq->lock, if p->on_rq == 0 it cannot get enqueued because * we're holding p->pi_lock. */ if (task_rq(p) == rq && task_on_rq_queued(p)) rq = __migrate_task(rq, p, arg->dest_cpu); raw_spin_unlock(&rq->lock); raw_spin_unlock(&p->pi_lock); local_irq_enable(); return 0; }
C
linux
0
CVE-2017-12664
https://www.cvedetails.com/cve/CVE-2017-12664/
CWE-772
https://github.com/ImageMagick/ImageMagick/commit/db1ffb6cf44bcfe5c4d5fcf9d9109ded5617387f
db1ffb6cf44bcfe5c4d5fcf9d9109ded5617387f
https://github.com/ImageMagick/ImageMagick/issues/574
static MagickBooleanType WritePALMImage(const ImageInfo *image_info, Image *image) { ExceptionInfo *exception; MagickBooleanType status; MagickOffsetType currentOffset, offset, scene; MagickSizeType cc; PixelPacket transpix; QuantizeInfo *quantize_info; register IndexPacket *indexes; register ssize_t x; register PixelPacket *p; ssize_t y; size_t count, bits_per_pixel, bytes_per_row, nextDepthOffset, one; unsigned char bit, byte, color, *last_row, *one_row, *ptr, version; unsigned int transparentIndex; unsigned short color16, flags; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); exception=AcquireExceptionInfo(); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); quantize_info=AcquireQuantizeInfo(image_info); flags=0; currentOffset=0; transparentIndex=0; transpix.red=0; transpix.green=0; transpix.blue=0; transpix.opacity=0; one=1; version=0; scene=0; do { (void) TransformImageColorspace(image,sRGBColorspace); count=GetNumberColors(image,NULL,exception); for (bits_per_pixel=1; (one << bits_per_pixel) < count; bits_per_pixel*=2) ; if (bits_per_pixel > 16) bits_per_pixel=16; else if (bits_per_pixel < 16) (void) TransformImageColorspace(image,image->colorspace); if (bits_per_pixel < 8) { (void) TransformImageColorspace(image,GRAYColorspace); (void) SetImageType(image,PaletteType); (void) SortColormapByIntensity(image); } if ((image->storage_class == PseudoClass) && (image->colors > 256)) (void) SetImageStorageClass(image,DirectClass); if (image->storage_class == PseudoClass) flags|=PALM_HAS_COLORMAP_FLAG; else flags|=PALM_IS_DIRECT_COLOR; (void) WriteBlobMSBShort(image,(unsigned short) image->columns); /* width */ (void) WriteBlobMSBShort(image,(unsigned short) image->rows); /* height */ bytes_per_row=((image->columns+(16/bits_per_pixel-1))/(16/ bits_per_pixel))*2; (void) WriteBlobMSBShort(image,(unsigned short) bytes_per_row); if ((image_info->compression == RLECompression) || (image_info->compression == FaxCompression)) flags|=PALM_IS_COMPRESSED_FLAG; (void) WriteBlobMSBShort(image, flags); (void) WriteBlobByte(image,(unsigned char) bits_per_pixel); if (bits_per_pixel > 1) version=1; if ((image_info->compression == RLECompression) || (image_info->compression == FaxCompression)) version=2; (void) WriteBlobByte(image,version); (void) WriteBlobMSBShort(image,0); /* nextDepthOffset */ (void) WriteBlobByte(image,(unsigned char) transparentIndex); if (image_info->compression == RLECompression) (void) WriteBlobByte(image,PALM_COMPRESSION_RLE); else if (image_info->compression == FaxCompression) (void) WriteBlobByte(image,PALM_COMPRESSION_SCANLINE); else (void) WriteBlobByte(image,PALM_COMPRESSION_NONE); (void) WriteBlobMSBShort(image,0); /* reserved */ offset=16; if (bits_per_pixel == 16) { (void) WriteBlobByte(image,5); /* # of bits of red */ (void) WriteBlobByte(image,6); /* # of bits of green */ (void) WriteBlobByte(image,5); /* # of bits of blue */ (void) WriteBlobByte(image,0); /* reserved by Palm */ (void) WriteBlobMSBLong(image,0); /* no transparent color, YET */ offset+=8; } if (bits_per_pixel == 8) { if (flags & PALM_HAS_COLORMAP_FLAG) /* Write out colormap */ { quantize_info->dither=IsPaletteImage(image,&image->exception); quantize_info->number_colors=image->colors; (void) QuantizeImage(quantize_info,image); (void) WriteBlobMSBShort(image,(unsigned short) image->colors); for (count = 0; count < image->colors; count++) { (void) WriteBlobByte(image,(unsigned char) count); (void) WriteBlobByte(image,ScaleQuantumToChar( image->colormap[count].red)); (void) WriteBlobByte(image, ScaleQuantumToChar(image->colormap[count].green)); (void) WriteBlobByte(image, ScaleQuantumToChar(image->colormap[count].blue)); } offset+=2+count*4; } else /* Map colors to Palm standard colormap */ { Image *affinity_image; affinity_image=ConstituteImage(256,1,"RGB",CharPixel,&PalmPalette, exception); (void) TransformImageColorspace(affinity_image, affinity_image->colorspace); (void) RemapImage(quantize_info,image,affinity_image); for (y=0; y < (ssize_t) image->rows; y++) { p=GetAuthenticPixels(image,0,y,image->columns,1,exception); indexes=GetAuthenticIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) SetPixelIndex(indexes+x,FindColor(&image->colormap[ (ssize_t) GetPixelIndex(indexes+x)])); } affinity_image=DestroyImage(affinity_image); } } if (flags & PALM_IS_COMPRESSED_FLAG) (void) WriteBlobMSBShort(image,0); /* fill in size later */ last_row=(unsigned char *) NULL; if (image_info->compression == FaxCompression) { last_row=(unsigned char *) AcquireQuantumMemory(bytes_per_row, sizeof(*last_row)); if (last_row == (unsigned char *) NULL) { quantize_info=DestroyQuantizeInfo(quantize_info); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } } one_row=(unsigned char *) AcquireQuantumMemory(bytes_per_row, sizeof(*one_row)); if (one_row == (unsigned char *) NULL) { quantize_info=DestroyQuantizeInfo(quantize_info); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } for (y=0; y < (ssize_t) image->rows; y++) { ptr=one_row; (void) ResetMagickMemory(ptr,0,bytes_per_row); p=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (p == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); if (bits_per_pixel == 16) { for (x=0; x < (ssize_t) image->columns; x++) { color16=(unsigned short) ((((31*(size_t) GetPixelRed(p))/ (size_t) QuantumRange) << 11) | (((63*(size_t) GetPixelGreen(p))/(size_t) QuantumRange) << 5) | ((31*(size_t) GetPixelBlue(p))/(size_t) QuantumRange)); if (GetPixelOpacity(p) == (Quantum) TransparentOpacity) { transpix.red=GetPixelRed(p); transpix.green=GetPixelGreen(p); transpix.blue=GetPixelBlue(p); transpix.opacity=GetPixelOpacity(p); flags|=PALM_HAS_TRANSPARENCY_FLAG; } *ptr++=(unsigned char) ((color16 >> 8) & 0xff); *ptr++=(unsigned char) (color16 & 0xff); p++; } } else { byte=0x00; bit=(unsigned char) (8-bits_per_pixel); for (x=0; x < (ssize_t) image->columns; x++) { if (bits_per_pixel >= 8) color=(unsigned char) GetPixelIndex(indexes+x); else color=(unsigned char) (GetPixelIndex(indexes+x)* ((one << bits_per_pixel)-1)/MagickMax(1*image->colors-1,1)); byte|=color << bit; if (bit != 0) bit-=(unsigned char) bits_per_pixel; else { *ptr++=byte; byte=0x00; bit=(unsigned char) (8-bits_per_pixel); } } if ((image->columns % (8/bits_per_pixel)) != 0) *ptr++=byte; } if (image_info->compression == RLECompression) { x=0; while (x < (ssize_t) bytes_per_row) { byte=one_row[x]; count=1; while ((one_row[++x] == byte) && (count < 255) && (x < (ssize_t) bytes_per_row)) count++; (void) WriteBlobByte(image,(unsigned char) count); (void) WriteBlobByte(image,(unsigned char) byte); } } else if (image_info->compression == FaxCompression) { char tmpbuf[8], *tptr; for (x = 0; x < (ssize_t) bytes_per_row; x += 8) { tptr = tmpbuf; for (bit=0, byte=0; bit < (unsigned char) MagickMin(8,(ssize_t) bytes_per_row-x); bit++) { if ((y == 0) || (last_row[x + bit] != one_row[x + bit])) { byte |= (1 << (7 - bit)); *tptr++ = (char) one_row[x + bit]; } } (void) WriteBlobByte(image, byte); (void) WriteBlob(image,tptr-tmpbuf,(unsigned char *) tmpbuf); } (void) CopyMagickMemory(last_row,one_row,bytes_per_row); } else (void) WriteBlob(image,bytes_per_row,one_row); } if (flags & PALM_HAS_TRANSPARENCY_FLAG) { offset=SeekBlob(image,currentOffset+6,SEEK_SET); (void) WriteBlobMSBShort(image,flags); offset=SeekBlob(image,currentOffset+12,SEEK_SET); (void) WriteBlobByte(image,(unsigned char) transparentIndex); /* trans index */ } if (bits_per_pixel == 16) { offset=SeekBlob(image,currentOffset+20,SEEK_SET); (void) WriteBlobByte(image,0); /* reserved by Palm */ (void) WriteBlobByte(image,(unsigned char) ((31*transpix.red)/ QuantumRange)); (void) WriteBlobByte(image,(unsigned char) ((63*transpix.green)/ QuantumRange)); (void) WriteBlobByte(image,(unsigned char) ((31*transpix.blue)/ QuantumRange)); } if (flags & PALM_IS_COMPRESSED_FLAG) /* fill in size now */ { offset=SeekBlob(image,currentOffset+offset,SEEK_SET); (void) WriteBlobMSBShort(image,(unsigned short) (GetBlobSize(image)- currentOffset-offset)); } if (one_row != (unsigned char *) NULL) one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (last_row != (unsigned char *) NULL) last_row=(unsigned char *) RelinquishMagickMemory(last_row); if (GetNextImageInList(image) == (Image *) NULL) break; /* padding to 4 byte word */ for (cc=(GetBlobSize(image)) % 4; cc > 0; cc--) (void) WriteBlobByte(image,0); /* write nextDepthOffset and return to end of image */ (void) SeekBlob(image,currentOffset+10,SEEK_SET); nextDepthOffset=(size_t) ((GetBlobSize(image)-currentOffset)/4); (void) WriteBlobMSBShort(image,(unsigned short) nextDepthOffset); currentOffset=(MagickOffsetType) GetBlobSize(image); (void) SeekBlob(image,currentOffset,SEEK_SET); image=SyncNextImageInList(image); status=SetImageProgress(image,SaveImagesTag,scene++, GetImageListLength(image)); if (status == MagickFalse) break; } while (image_info->adjoin != MagickFalse); quantize_info=DestroyQuantizeInfo(quantize_info); (void) CloseBlob(image); (void) DestroyExceptionInfo(exception); return(MagickTrue); }
static MagickBooleanType WritePALMImage(const ImageInfo *image_info, Image *image) { ExceptionInfo *exception; MagickBooleanType status; MagickOffsetType currentOffset, offset, scene; MagickSizeType cc; PixelPacket transpix; QuantizeInfo *quantize_info; register IndexPacket *indexes; register ssize_t x; register PixelPacket *p; ssize_t y; size_t count, bits_per_pixel, bytes_per_row, nextDepthOffset, one; unsigned char bit, byte, color, *lastrow, *one_row, *ptr, version; unsigned int transparentIndex; unsigned short color16, flags; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); exception=AcquireExceptionInfo(); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); quantize_info=AcquireQuantizeInfo(image_info); flags=0; currentOffset=0; transparentIndex=0; transpix.red=0; transpix.green=0; transpix.blue=0; transpix.opacity=0; one=1; version=0; scene=0; do { (void) TransformImageColorspace(image,sRGBColorspace); count=GetNumberColors(image,NULL,exception); for (bits_per_pixel=1; (one << bits_per_pixel) < count; bits_per_pixel*=2) ; if (bits_per_pixel > 16) bits_per_pixel=16; else if (bits_per_pixel < 16) (void) TransformImageColorspace(image,image->colorspace); if (bits_per_pixel < 8) { (void) TransformImageColorspace(image,GRAYColorspace); (void) SetImageType(image,PaletteType); (void) SortColormapByIntensity(image); } if ((image->storage_class == PseudoClass) && (image->colors > 256)) (void) SetImageStorageClass(image,DirectClass); if (image->storage_class == PseudoClass) flags|=PALM_HAS_COLORMAP_FLAG; else flags|=PALM_IS_DIRECT_COLOR; (void) WriteBlobMSBShort(image,(unsigned short) image->columns); /* width */ (void) WriteBlobMSBShort(image,(unsigned short) image->rows); /* height */ bytes_per_row=((image->columns+(16/bits_per_pixel-1))/(16/ bits_per_pixel))*2; (void) WriteBlobMSBShort(image,(unsigned short) bytes_per_row); if ((image_info->compression == RLECompression) || (image_info->compression == FaxCompression)) flags|=PALM_IS_COMPRESSED_FLAG; (void) WriteBlobMSBShort(image, flags); (void) WriteBlobByte(image,(unsigned char) bits_per_pixel); if (bits_per_pixel > 1) version=1; if ((image_info->compression == RLECompression) || (image_info->compression == FaxCompression)) version=2; (void) WriteBlobByte(image,version); (void) WriteBlobMSBShort(image,0); /* nextDepthOffset */ (void) WriteBlobByte(image,(unsigned char) transparentIndex); if (image_info->compression == RLECompression) (void) WriteBlobByte(image,PALM_COMPRESSION_RLE); else if (image_info->compression == FaxCompression) (void) WriteBlobByte(image,PALM_COMPRESSION_SCANLINE); else (void) WriteBlobByte(image,PALM_COMPRESSION_NONE); (void) WriteBlobMSBShort(image,0); /* reserved */ offset=16; if (bits_per_pixel == 16) { (void) WriteBlobByte(image,5); /* # of bits of red */ (void) WriteBlobByte(image,6); /* # of bits of green */ (void) WriteBlobByte(image,5); /* # of bits of blue */ (void) WriteBlobByte(image,0); /* reserved by Palm */ (void) WriteBlobMSBLong(image,0); /* no transparent color, YET */ offset+=8; } if (bits_per_pixel == 8) { if (flags & PALM_HAS_COLORMAP_FLAG) /* Write out colormap */ { quantize_info->dither=IsPaletteImage(image,&image->exception); quantize_info->number_colors=image->colors; (void) QuantizeImage(quantize_info,image); (void) WriteBlobMSBShort(image,(unsigned short) image->colors); for (count = 0; count < image->colors; count++) { (void) WriteBlobByte(image,(unsigned char) count); (void) WriteBlobByte(image,ScaleQuantumToChar( image->colormap[count].red)); (void) WriteBlobByte(image, ScaleQuantumToChar(image->colormap[count].green)); (void) WriteBlobByte(image, ScaleQuantumToChar(image->colormap[count].blue)); } offset+=2+count*4; } else /* Map colors to Palm standard colormap */ { Image *affinity_image; affinity_image=ConstituteImage(256,1,"RGB",CharPixel,&PalmPalette, exception); (void) TransformImageColorspace(affinity_image, affinity_image->colorspace); (void) RemapImage(quantize_info,image,affinity_image); for (y=0; y < (ssize_t) image->rows; y++) { p=GetAuthenticPixels(image,0,y,image->columns,1,exception); indexes=GetAuthenticIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) SetPixelIndex(indexes+x,FindColor(&image->colormap[ (ssize_t) GetPixelIndex(indexes+x)])); } affinity_image=DestroyImage(affinity_image); } } if (flags & PALM_IS_COMPRESSED_FLAG) (void) WriteBlobMSBShort(image,0); /* fill in size later */ lastrow=(unsigned char *) NULL; if (image_info->compression == FaxCompression) lastrow=(unsigned char *) AcquireQuantumMemory(bytes_per_row, sizeof(*lastrow)); /* TODO check whether memory really was acquired? */ one_row=(unsigned char *) AcquireQuantumMemory(bytes_per_row, sizeof(*one_row)); if (one_row == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); for (y=0; y < (ssize_t) image->rows; y++) { ptr=one_row; (void) ResetMagickMemory(ptr,0,bytes_per_row); p=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (p == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); if (bits_per_pixel == 16) { for (x=0; x < (ssize_t) image->columns; x++) { color16=(unsigned short) ((((31*(size_t) GetPixelRed(p))/ (size_t) QuantumRange) << 11) | (((63*(size_t) GetPixelGreen(p))/(size_t) QuantumRange) << 5) | ((31*(size_t) GetPixelBlue(p))/(size_t) QuantumRange)); if (GetPixelOpacity(p) == (Quantum) TransparentOpacity) { transpix.red=GetPixelRed(p); transpix.green=GetPixelGreen(p); transpix.blue=GetPixelBlue(p); transpix.opacity=GetPixelOpacity(p); flags|=PALM_HAS_TRANSPARENCY_FLAG; } *ptr++=(unsigned char) ((color16 >> 8) & 0xff); *ptr++=(unsigned char) (color16 & 0xff); p++; } } else { byte=0x00; bit=(unsigned char) (8-bits_per_pixel); for (x=0; x < (ssize_t) image->columns; x++) { if (bits_per_pixel >= 8) color=(unsigned char) GetPixelIndex(indexes+x); else color=(unsigned char) (GetPixelIndex(indexes+x)* ((one << bits_per_pixel)-1)/MagickMax(1*image->colors-1,1)); byte|=color << bit; if (bit != 0) bit-=(unsigned char) bits_per_pixel; else { *ptr++=byte; byte=0x00; bit=(unsigned char) (8-bits_per_pixel); } } if ((image->columns % (8/bits_per_pixel)) != 0) *ptr++=byte; } if (image_info->compression == RLECompression) { x=0; while (x < (ssize_t) bytes_per_row) { byte=one_row[x]; count=1; while ((one_row[++x] == byte) && (count < 255) && (x < (ssize_t) bytes_per_row)) count++; (void) WriteBlobByte(image,(unsigned char) count); (void) WriteBlobByte(image,(unsigned char) byte); } } else if (image_info->compression == FaxCompression) { char tmpbuf[8], *tptr; for (x = 0; x < (ssize_t) bytes_per_row; x += 8) { tptr = tmpbuf; for (bit=0, byte=0; bit < (unsigned char) MagickMin(8,(ssize_t) bytes_per_row-x); bit++) { if ((y == 0) || (lastrow[x + bit] != one_row[x + bit])) { byte |= (1 << (7 - bit)); *tptr++ = (char) one_row[x + bit]; } } (void) WriteBlobByte(image, byte); (void) WriteBlob(image,tptr-tmpbuf,(unsigned char *) tmpbuf); } (void) CopyMagickMemory(lastrow,one_row,bytes_per_row); } else (void) WriteBlob(image,bytes_per_row,one_row); } if (flags & PALM_HAS_TRANSPARENCY_FLAG) { offset=SeekBlob(image,currentOffset+6,SEEK_SET); (void) WriteBlobMSBShort(image,flags); offset=SeekBlob(image,currentOffset+12,SEEK_SET); (void) WriteBlobByte(image,(unsigned char) transparentIndex); /* trans index */ } if (bits_per_pixel == 16) { offset=SeekBlob(image,currentOffset+20,SEEK_SET); (void) WriteBlobByte(image,0); /* reserved by Palm */ (void) WriteBlobByte(image,(unsigned char) ((31*transpix.red)/QuantumRange)); (void) WriteBlobByte(image,(unsigned char) ((63*transpix.green)/QuantumRange)); (void) WriteBlobByte(image,(unsigned char) ((31*transpix.blue)/QuantumRange)); } if (flags & PALM_IS_COMPRESSED_FLAG) /* fill in size now */ { offset=SeekBlob(image,currentOffset+offset,SEEK_SET); (void) WriteBlobMSBShort(image,(unsigned short) (GetBlobSize(image)- currentOffset-offset)); } if (one_row != (unsigned char *) NULL) one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (lastrow != (unsigned char *) NULL) lastrow=(unsigned char *) RelinquishMagickMemory(lastrow); if (GetNextImageInList(image) == (Image *) NULL) break; /* padding to 4 byte word */ for (cc=(GetBlobSize(image)) % 4; cc > 0; cc--) (void) WriteBlobByte(image,0); /* write nextDepthOffset and return to end of image */ (void) SeekBlob(image,currentOffset+10,SEEK_SET); nextDepthOffset=(size_t) ((GetBlobSize(image)-currentOffset)/4); (void) WriteBlobMSBShort(image,(unsigned short) nextDepthOffset); currentOffset=(MagickOffsetType) GetBlobSize(image); (void) SeekBlob(image,currentOffset,SEEK_SET); image=SyncNextImageInList(image); status=SetImageProgress(image,SaveImagesTag,scene++, GetImageListLength(image)); if (status == MagickFalse) break; } while (image_info->adjoin != MagickFalse); quantize_info=DestroyQuantizeInfo(quantize_info); (void) CloseBlob(image); (void) DestroyExceptionInfo(exception); return(MagickTrue); }
C
ImageMagick
1
CVE-2010-5313
https://www.cvedetails.com/cve/CVE-2010-5313/
CWE-362
https://github.com/torvalds/linux/commit/fc3a9157d3148ab91039c75423da8ef97be3e105
fc3a9157d3148ab91039c75423da8ef97be3e105
KVM: X86: Don't report L2 emulation failures to user-space This patch prevents that emulation failures which result from emulating an instruction for an L2-Guest results in being reported to userspace. Without this patch a malicious L2-Guest would be able to kill the L1 by triggering a race-condition between an vmexit and the instruction emulator. With this patch the L2 will most likely only kill itself in this situation. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { unsigned long old_cr4 = kvm_read_cr4(vcpu); unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE; if (cr4 & CR4_RESERVED_BITS) return 1; if (!guest_cpuid_has_xsave(vcpu) && (cr4 & X86_CR4_OSXSAVE)) return 1; if (is_long_mode(vcpu)) { if (!(cr4 & X86_CR4_PAE)) return 1; } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE) && ((cr4 ^ old_cr4) & pdptr_bits) && !load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3)) return 1; if (cr4 & X86_CR4_VMXE) return 1; kvm_x86_ops->set_cr4(vcpu, cr4); if ((cr4 ^ old_cr4) & pdptr_bits) kvm_mmu_reset_context(vcpu); if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) update_cpuid(vcpu); return 0; }
int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { unsigned long old_cr4 = kvm_read_cr4(vcpu); unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE; if (cr4 & CR4_RESERVED_BITS) return 1; if (!guest_cpuid_has_xsave(vcpu) && (cr4 & X86_CR4_OSXSAVE)) return 1; if (is_long_mode(vcpu)) { if (!(cr4 & X86_CR4_PAE)) return 1; } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE) && ((cr4 ^ old_cr4) & pdptr_bits) && !load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3)) return 1; if (cr4 & X86_CR4_VMXE) return 1; kvm_x86_ops->set_cr4(vcpu, cr4); if ((cr4 ^ old_cr4) & pdptr_bits) kvm_mmu_reset_context(vcpu); if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) update_cpuid(vcpu); return 0; }
C
linux
0
CVE-2017-5130
https://www.cvedetails.com/cve/CVE-2017-5130/
CWE-787
https://github.com/chromium/chromium/commit/ce1446c00f0fd8f5a3b00727421be2124cb7370f
ce1446c00f0fd8f5a3b00727421be2124cb7370f
Roll libxml to 3939178e4cb797417ff033b1e04ab4b038e224d9 Removes a few patches fixed upstream: https://git.gnome.org/browse/libxml2/commit/?id=e26630548e7d138d2c560844c43820b6767251e3 https://git.gnome.org/browse/libxml2/commit/?id=94691dc884d1a8ada39f073408b4bb92fe7fe882 Stops using the NOXXE flag which was reverted upstream: https://git.gnome.org/browse/libxml2/commit/?id=030b1f7a27c22f9237eddca49ec5e620b6258d7d Changes the patch to uri.c to not add limits.h, which is included upstream. Bug: 722079 Change-Id: I4b8449ed33f95de23c54c2cde99970c2df2781ac Reviewed-on: https://chromium-review.googlesource.com/535233 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Dominic Cooney <dominicc@chromium.org> Cr-Commit-Position: refs/heads/master@{#480755}
htmlElementStatusHere(const htmlElemDesc* parent, const htmlElemDesc* elt) { if ( ! parent || ! elt ) return HTML_INVALID ; if ( ! htmlElementAllowedHere(parent, (const xmlChar*) elt->name ) ) return HTML_INVALID ; return ( elt->dtd == 0 ) ? HTML_VALID : HTML_DEPRECATED ; }
htmlElementStatusHere(const htmlElemDesc* parent, const htmlElemDesc* elt) { if ( ! parent || ! elt ) return HTML_INVALID ; if ( ! htmlElementAllowedHere(parent, (const xmlChar*) elt->name ) ) return HTML_INVALID ; return ( elt->dtd == 0 ) ? HTML_VALID : HTML_DEPRECATED ; }
C
Chrome
0
CVE-2018-18352
https://www.cvedetails.com/cve/CVE-2018-18352/
CWE-732
https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949
a9cbaa7a40e2b2723cfc2f266c42f4980038a949
Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whether the response body is available for scripts. They are known to be confusing, and actually MediaElementAudioSourceHandler::WouldTaintOrigin misuses them. This CL merges the three predicates to one, WouldTaintOrigin, to remove the confusion. Now the "response type" concept is available and we don't need a custom CORS check, so this CL removes BaseAudioContext::WouldTaintOrigin. This CL also renames URLData::has_opaque_data_ and its (direct and indirect) data accessors to match the spec. Bug: 849942, 875153 Change-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a Reviewed-on: https://chromium-review.googlesource.com/c/1238098 Reviewed-by: Fredrik Hubinette <hubbe@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Raymond Toy <rtoy@chromium.org> Commit-Queue: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#598258}
void WebMediaPlayerImpl::OnVideoDecoderChange(const std::string& name) { if (name == video_decoder_name_) return; video_decoder_name_ = name; if (!watch_time_reporter_) return; UpdateSecondaryProperties(); }
void WebMediaPlayerImpl::OnVideoDecoderChange(const std::string& name) { if (name == video_decoder_name_) return; video_decoder_name_ = name; if (!watch_time_reporter_) return; UpdateSecondaryProperties(); }
C
Chrome
0
CVE-2016-3822
https://www.cvedetails.com/cve/CVE-2016-3822/
CWE-119
https://android.googlesource.com/platform/external/jhead/+/bae671597d47b9e5955c4cb742e468cebfd7ca6b
bae671597d47b9e5955c4cb742e468cebfd7ca6b
Fix possible out of bounds access Bug: 28868315 Change-Id: I2b416c662f9ad7f9b3c6cf973a39c6693c66775a
void ShowConciseImageInfo(void) { printf("\"%s\"",ImageInfo.FileName); printf(" %dx%d",ImageInfo.Width, ImageInfo.Height); if (ImageInfo.ExposureTime){ if (ImageInfo.ExposureTime <= 0.5){ printf(" (1/%d)",(int)(0.5 + 1/ImageInfo.ExposureTime)); }else{ printf(" (%1.1f)",ImageInfo.ExposureTime); } } if (ImageInfo.ApertureFNumber){ printf(" f/%3.1f",(double)ImageInfo.ApertureFNumber); } if (ImageInfo.FocalLength35mmEquiv){ printf(" f(35)=%dmm",ImageInfo.FocalLength35mmEquiv); } if (ImageInfo.FlashUsed >= 0 && ImageInfo.FlashUsed & 1){ printf(" (flash)"); } if (ImageInfo.IsColor == 0){ printf(" (bw)"); } printf("\n"); }
void ShowConciseImageInfo(void) { printf("\"%s\"",ImageInfo.FileName); printf(" %dx%d",ImageInfo.Width, ImageInfo.Height); if (ImageInfo.ExposureTime){ if (ImageInfo.ExposureTime <= 0.5){ printf(" (1/%d)",(int)(0.5 + 1/ImageInfo.ExposureTime)); }else{ printf(" (%1.1f)",ImageInfo.ExposureTime); } } if (ImageInfo.ApertureFNumber){ printf(" f/%3.1f",(double)ImageInfo.ApertureFNumber); } if (ImageInfo.FocalLength35mmEquiv){ printf(" f(35)=%dmm",ImageInfo.FocalLength35mmEquiv); } if (ImageInfo.FlashUsed >= 0 && ImageInfo.FlashUsed & 1){ printf(" (flash)"); } if (ImageInfo.IsColor == 0){ printf(" (bw)"); } printf("\n"); }
C
Android
0
CVE-2018-20182
https://www.cvedetails.com/cve/CVE-2018-20182/
CWE-119
https://github.com/rdesktop/rdesktop/commit/4dca546d04321a610c1835010b5dad85163b65e1
4dca546d04321a610c1835010b5dad85163b65e1
Malicious RDP server security fixes This commit includes fixes for a set of 21 vulnerabilities in rdesktop when a malicious RDP server is used. All vulnerabilities was identified and reported by Eyal Itkin. * Add rdp_protocol_error function that is used in several fixes * Refactor of process_bitmap_updates * Fix possible integer overflow in s_check_rem() on 32bit arch * Fix memory corruption in process_bitmap_data - CVE-2018-8794 * Fix remote code execution in process_bitmap_data - CVE-2018-8795 * Fix remote code execution in process_plane - CVE-2018-8797 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176 * Fix Denial of Service in sec_recv - CVE-2018-20176 * Fix minor information leak in rdpdr_process - CVE-2018-8791 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798 * Fix Denial of Service in process_secondary_order - CVE-2018-8799 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177 * Fix Denial of Service in process_demand_active - CVE-2018-20178 * Fix remote code execution in lspci_process - CVE-2018-20179 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180 * Fix remote code execution in seamless_process - CVE-2018-20181 * Fix remote code execution in seamless_process_line - CVE-2018-20182
rdpsnd_init(char *optarg) { struct audio_driver *pos; char *driver = NULL, *options = NULL; drivers = NULL; packet.data = (uint8 *) xmalloc(65536); packet.p = packet.end = packet.data; packet.size = 0; rdpsnd_channel = channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, rdpsnd_process); rdpsnddbg_channel = channel_register("snddbg", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, rdpsnddbg_process); if ((rdpsnd_channel == NULL) || (rdpsnddbg_channel == NULL)) { logger(Sound, Error, "rdpsnd_init(), failed to register rdpsnd / snddbg virtual channels"); return False; } rdpsnd_queue_init(); if (optarg != NULL && strlen(optarg) > 0) { driver = options = optarg; while (*options != '\0' && *options != ':') options++; if (*options == ':') { *options = '\0'; options++; } if (*options == '\0') options = NULL; } rdpsnd_register_drivers(options); if (!driver) return True; pos = drivers; while (pos != NULL) { if (!strcmp(pos->name, driver)) { logger(Sound, Debug, "rdpsnd_init(), using driver '%s'", pos->name); current_driver = pos; return True; } pos = pos->next; } return False; }
rdpsnd_init(char *optarg) { struct audio_driver *pos; char *driver = NULL, *options = NULL; drivers = NULL; packet.data = (uint8 *) xmalloc(65536); packet.p = packet.end = packet.data; packet.size = 0; rdpsnd_channel = channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, rdpsnd_process); rdpsnddbg_channel = channel_register("snddbg", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, rdpsnddbg_process); if ((rdpsnd_channel == NULL) || (rdpsnddbg_channel == NULL)) { logger(Sound, Error, "rdpsnd_init(), failed to register rdpsnd / snddbg virtual channels"); return False; } rdpsnd_queue_init(); if (optarg != NULL && strlen(optarg) > 0) { driver = options = optarg; while (*options != '\0' && *options != ':') options++; if (*options == ':') { *options = '\0'; options++; } if (*options == '\0') options = NULL; } rdpsnd_register_drivers(options); if (!driver) return True; pos = drivers; while (pos != NULL) { if (!strcmp(pos->name, driver)) { logger(Sound, Debug, "rdpsnd_init(), using driver '%s'", pos->name); current_driver = pos; return True; } pos = pos->next; } return False; }
C
rdesktop
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 <eric.dumazet@gmail.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) { if (skb->ip_summed == CHECKSUM_COMPLETE) { if (!tcp_v6_check(skb->len, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, skb->csum)) { skb->ip_summed = CHECKSUM_UNNECESSARY; return 0; } } skb->csum = ~csum_unfold(tcp_v6_check(skb->len, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 0)); if (skb->len <= 76) { return __skb_checksum_complete(skb); } return 0; }
static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) { if (skb->ip_summed == CHECKSUM_COMPLETE) { if (!tcp_v6_check(skb->len, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, skb->csum)) { skb->ip_summed = CHECKSUM_UNNECESSARY; return 0; } } skb->csum = ~csum_unfold(tcp_v6_check(skb->len, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 0)); if (skb->len <= 76) { return __skb_checksum_complete(skb); } return 0; }
C
linux
0
CVE-2013-4118
https://www.cvedetails.com/cve/CVE-2013-4118/
CWE-476
https://github.com/FreeRDP/FreeRDP/commit/7d58aac24fe20ffaad7bd9b40c9ddf457c1b06e7
7d58aac24fe20ffaad7bd9b40c9ddf457c1b06e7
security: add a NULL pointer check to fix a server crash.
BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_decrypt(rdp->fips_decrypt, length, data, data); return TRUE; }
BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_decrypt(rdp->fips_decrypt, length, data, data); return TRUE; }
C
FreeRDP
0
CVE-2019-9003
https://www.cvedetails.com/cve/CVE-2019-9003/
CWE-416
https://github.com/torvalds/linux/commit/77f8269606bf95fcb232ee86f6da80886f1dfae8
77f8269606bf95fcb232ee86f6da80886f1dfae8
ipmi: fix use-after-free of user->release_barrier.rda When we do the following test, we got oops in ipmi_msghandler driver while((1)) do service ipmievd restart & service ipmievd restart done --------------------------------------------------------------- [ 294.230186] Unable to handle kernel paging request at virtual address 0000803fea6ea008 [ 294.230188] Mem abort info: [ 294.230190] ESR = 0x96000004 [ 294.230191] Exception class = DABT (current EL), IL = 32 bits [ 294.230193] SET = 0, FnV = 0 [ 294.230194] EA = 0, S1PTW = 0 [ 294.230195] Data abort info: [ 294.230196] ISV = 0, ISS = 0x00000004 [ 294.230197] CM = 0, WnR = 0 [ 294.230199] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000a1c1b75a [ 294.230201] [0000803fea6ea008] pgd=0000000000000000 [ 294.230204] Internal error: Oops: 96000004 [#1] SMP [ 294.235211] Modules linked in: nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm iw_cm dm_mirror dm_region_hash dm_log dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce sha2_ce ses sha256_arm64 sha1_ce hibmc_drm hisi_sas_v2_hw enclosure sg hisi_sas_main sbsa_gwdt ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe ipmi_si mdio hns_dsaf ipmi_devintf ipmi_msghandler hns_enet_drv hns_mdio [ 294.277745] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Not tainted 5.0.0-rc2+ #113 [ 294.285511] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017 [ 294.292835] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 294.297695] pc : __srcu_read_lock+0x38/0x58 [ 294.301940] lr : acquire_ipmi_user+0x2c/0x70 [ipmi_msghandler] [ 294.307853] sp : ffff00001001bc80 [ 294.311208] x29: ffff00001001bc80 x28: ffff0000117e5000 [ 294.316594] x27: 0000000000000000 x26: dead000000000100 [ 294.321980] x25: dead000000000200 x24: ffff803f6bd06800 [ 294.327366] x23: 0000000000000000 x22: 0000000000000000 [ 294.332752] x21: ffff00001001bd04 x20: ffff80df33d19018 [ 294.338137] x19: ffff80df33d19018 x18: 0000000000000000 [ 294.343523] x17: 0000000000000000 x16: 0000000000000000 [ 294.348908] x15: 0000000000000000 x14: 0000000000000002 [ 294.354293] x13: 0000000000000000 x12: 0000000000000000 [ 294.359679] x11: 0000000000000000 x10: 0000000000100000 [ 294.365065] x9 : 0000000000000000 x8 : 0000000000000004 [ 294.370451] x7 : 0000000000000000 x6 : ffff80df34558678 [ 294.375836] x5 : 000000000000000c x4 : 0000000000000000 [ 294.381221] x3 : 0000000000000001 x2 : 0000803fea6ea000 [ 294.386607] x1 : 0000803fea6ea008 x0 : 0000000000000001 [ 294.391994] Process swapper/3 (pid: 0, stack limit = 0x0000000083087293) [ 294.398791] Call trace: [ 294.401266] __srcu_read_lock+0x38/0x58 [ 294.405154] acquire_ipmi_user+0x2c/0x70 [ipmi_msghandler] [ 294.410716] deliver_response+0x80/0xf8 [ipmi_msghandler] [ 294.416189] deliver_local_response+0x28/0x68 [ipmi_msghandler] [ 294.422193] handle_one_recv_msg+0x158/0xcf8 [ipmi_msghandler] [ 294.432050] handle_new_recv_msgs+0xc0/0x210 [ipmi_msghandler] [ 294.441984] smi_recv_tasklet+0x8c/0x158 [ipmi_msghandler] [ 294.451618] tasklet_action_common.isra.5+0x88/0x138 [ 294.460661] tasklet_action+0x2c/0x38 [ 294.468191] __do_softirq+0x120/0x2f8 [ 294.475561] irq_exit+0x134/0x140 [ 294.482445] __handle_domain_irq+0x6c/0xc0 [ 294.489954] gic_handle_irq+0xb8/0x178 [ 294.497037] el1_irq+0xb0/0x140 [ 294.503381] arch_cpu_idle+0x34/0x1a8 [ 294.510096] do_idle+0x1d4/0x290 [ 294.516322] cpu_startup_entry+0x28/0x30 [ 294.523230] secondary_start_kernel+0x184/0x1d0 [ 294.530657] Code: d538d082 d2800023 8b010c81 8b020021 (c85f7c25) [ 294.539746] ---[ end trace 8a7a880dee570b29 ]--- [ 294.547341] Kernel panic - not syncing: Fatal exception in interrupt [ 294.556837] SMP: stopping secondary CPUs [ 294.563996] Kernel Offset: disabled [ 294.570515] CPU features: 0x002,21006008 [ 294.577638] Memory Limit: none [ 294.587178] Starting crashdump kernel... [ 294.594314] Bye! Because the user->release_barrier.rda is freed in ipmi_destroy_user(), but the refcount is not zero, when acquire_ipmi_user() uses user->release_barrier.rda in __srcu_read_lock(), it causes oops. Fix this by calling cleanup_srcu_struct() when the refcount is zero. Fixes: e86ee2d44b44 ("ipmi: Rework locking and shutdown for hot remove") Cc: stable@vger.kernel.org # 4.18 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
smi_from_recv_msg(struct ipmi_smi *intf, struct ipmi_recv_msg *recv_msg, unsigned char seq, long seqid) { struct ipmi_smi_msg *smi_msg = ipmi_alloc_smi_msg(); if (!smi_msg) /* * If we can't allocate the message, then just return, we * get 4 retries, so this should be ok. */ return NULL; memcpy(smi_msg->data, recv_msg->msg.data, recv_msg->msg.data_len); smi_msg->data_size = recv_msg->msg.data_len; smi_msg->msgid = STORE_SEQ_IN_MSGID(seq, seqid); ipmi_debug_msg("Resend: ", smi_msg->data, smi_msg->data_size); return smi_msg; }
smi_from_recv_msg(struct ipmi_smi *intf, struct ipmi_recv_msg *recv_msg, unsigned char seq, long seqid) { struct ipmi_smi_msg *smi_msg = ipmi_alloc_smi_msg(); if (!smi_msg) /* * If we can't allocate the message, then just return, we * get 4 retries, so this should be ok. */ return NULL; memcpy(smi_msg->data, recv_msg->msg.data, recv_msg->msg.data_len); smi_msg->data_size = recv_msg->msg.data_len; smi_msg->msgid = STORE_SEQ_IN_MSGID(seq, seqid); ipmi_debug_msg("Resend: ", smi_msg->data, smi_msg->data_size); return smi_msg; }
C
linux
0
CVE-2011-2839
https://www.cvedetails.com/cve/CVE-2011-2839/
CWE-20
https://github.com/chromium/chromium/commit/c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7
c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7
Extend TTS extension API to support richer events returned from the engine to the client. Previously we just had a completed event; this adds start, word boundary, sentence boundary, and marker boundary. In addition, interrupted and canceled, which were previously errors, now become events. Mac and Windows implementations extended to support as many of these events as possible. BUG=67713 BUG=70198 BUG=75106 BUG=83404 TEST=Updates all TTS API tests to be event-based, and adds new tests. Review URL: http://codereview.chromium.org/6792014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91665 0039d316-1c4b-4281-b951-d872f2087c98
void CrosMock::TearDownMocks() { if (loader_) test_api()->SetLibraryLoader(NULL, false); if (mock_cryptohome_library_) test_api()->SetCryptohomeLibrary(NULL, false); if (mock_network_library_) test_api()->SetNetworkLibrary(NULL, false); if (mock_power_library_) test_api()->SetPowerLibrary(NULL, false); if (mock_screen_lock_library_) test_api()->SetScreenLockLibrary(NULL, false); if (mock_speech_synthesis_library_) test_api()->SetSpeechSynthesisLibrary(NULL, false); if (mock_touchpad_library_) test_api()->SetTouchpadLibrary(NULL, false); }
void CrosMock::TearDownMocks() { if (loader_) test_api()->SetLibraryLoader(NULL, false); if (mock_cryptohome_library_) test_api()->SetCryptohomeLibrary(NULL, false); if (mock_network_library_) test_api()->SetNetworkLibrary(NULL, false); if (mock_power_library_) test_api()->SetPowerLibrary(NULL, false); if (mock_screen_lock_library_) test_api()->SetScreenLockLibrary(NULL, false); if (mock_speech_synthesis_library_) test_api()->SetSpeechSynthesisLibrary(NULL, false); if (mock_touchpad_library_) test_api()->SetTouchpadLibrary(NULL, false); }
C
Chrome
0
CVE-2016-10012
https://www.cvedetails.com/cve/CVE-2016-10012/
CWE-119
https://github.com/openbsd/src/commit/3095060f479b86288e31c79ecbc5131a66bcd2f9
3095060f479b86288e31c79ecbc5131a66bcd2f9
Remove support for pre-authentication compression. Doing compression early in the protocol probably seemed reasonable in the 1990s, but today it's clearly a bad idea in terms of both cryptography (cf. multiple compression oracle attacks in TLS) and attack surface. Moreover, to support it across privilege-separation zlib needed the assistance of a complex shared-memory manager that made the required attack surface considerably larger. Prompted by Guido Vranken pointing out a compiler-elided security check in the shared memory manager found by Stack (http://css.csail.mit.edu/stack/); ok deraadt@ markus@ NB. pre-auth authentication has been disabled by default in sshd for >10 years.
mm_answer_bsdauthquery(int sock, Buffer *m) { char *name, *infotxt; u_int numprompts; u_int *echo_on; char **prompts; u_int success; if (!options.kbd_interactive_authentication) fatal("%s: kbd-int authentication not enabled", __func__); success = bsdauth_query(authctxt, &name, &infotxt, &numprompts, &prompts, &echo_on) < 0 ? 0 : 1; buffer_clear(m); buffer_put_int(m, success); if (success) buffer_put_cstring(m, prompts[0]); debug3("%s: sending challenge success: %u", __func__, success); mm_request_send(sock, MONITOR_ANS_BSDAUTHQUERY, m); if (success) { free(name); free(infotxt); free(prompts); free(echo_on); } return (0); }
mm_answer_bsdauthquery(int sock, Buffer *m) { char *name, *infotxt; u_int numprompts; u_int *echo_on; char **prompts; u_int success; if (!options.kbd_interactive_authentication) fatal("%s: kbd-int authentication not enabled", __func__); success = bsdauth_query(authctxt, &name, &infotxt, &numprompts, &prompts, &echo_on) < 0 ? 0 : 1; buffer_clear(m); buffer_put_int(m, success); if (success) buffer_put_cstring(m, prompts[0]); debug3("%s: sending challenge success: %u", __func__, success); mm_request_send(sock, MONITOR_ANS_BSDAUTHQUERY, m); if (success) { free(name); free(infotxt); free(prompts); free(echo_on); } return (0); }
C
src
0
CVE-2018-9510
https://www.cvedetails.com/cve/CVE-2018-9510/
CWE-200
https://android.googlesource.com/platform/system/bt/+/6e4b8e505173f803a5fc05abc09f64eef89dc308
6e4b8e505173f803a5fc05abc09f64eef89dc308
Checks the SMP length to fix OOB read Bug: 111937065 Test: manual Change-Id: I330880a6e1671d0117845430db4076dfe1aba688 Merged-In: I330880a6e1671d0117845430db4076dfe1aba688 (cherry picked from commit fceb753bda651c4135f3f93a510e5fcb4c7542b8)
void smp_pair_terminate(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { SMP_TRACE_DEBUG("%s", __func__); p_cb->status = SMP_CONN_TOUT; smp_proc_pairing_cmpl(p_cb); }
void smp_pair_terminate(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { SMP_TRACE_DEBUG("%s", __func__); p_cb->status = SMP_CONN_TOUT; smp_proc_pairing_cmpl(p_cb); }
C
Android
0
CVE-2016-10165
https://www.cvedetails.com/cve/CVE-2016-10165/
CWE-125
https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2
5ca71a7bc18b6897ab21d815d15e218e204581e2
Added an extra check to MLU bounds Thanks to Ibrahim el-sayed for spotting the bug
void Type_Measurement_Free(struct _cms_typehandler_struct* self, void* Ptr) { _cmsFree(self ->ContextID, Ptr); }
void Type_Measurement_Free(struct _cms_typehandler_struct* self, void* Ptr) { _cmsFree(self ->ContextID, Ptr); }
C
Little-CMS
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 <ursula.braun@de.ibm.com> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Reviewed-by: Heiko Carstens <heicars2@linux.vnet.ibm.com> Reported-by: Nico Golde <nico@ngolde.de> Reported-by: Fabian Yamaguchi <fabs@goesec.de> Cc: <stable@vger.kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
static int qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue) { struct qeth_qdio_out_buffer *buffer; buffer = queue->bufs[queue->next_buf_to_fill]; if ((atomic_read(&buffer->state) == QETH_QDIO_BUF_EMPTY) && (buffer->next_element_to_fill > 0)) { /* it's a packing buffer */ atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; return 1; } return 0; }
static int qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue) { struct qeth_qdio_out_buffer *buffer; buffer = queue->bufs[queue->next_buf_to_fill]; if ((atomic_read(&buffer->state) == QETH_QDIO_BUF_EMPTY) && (buffer->next_element_to_fill > 0)) { /* it's a packing buffer */ atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; return 1; } return 0; }
C
linux
0