CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2018-19489
https://www.cvedetails.com/cve/CVE-2018-19489/
CWE-362
https://git.qemu.org/?p=qemu.git;a=commit;h=1d20398694a3b67a388d955b7a945ba4aa90a8a8
1d20398694a3b67a388d955b7a945ba4aa90a8a8
null
static void coroutine_fn v9fs_fsync(void *opaque) { int err; int32_t fid; int datasync; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; err = pdu_unmarshal(pdu, offset, "dd", &fid, &datasync); if (err < 0) { goto out_nofid; } trace_v9fs_fsync(pdu->tag, pdu->id, fid, datasync); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fsync(pdu, fidp, datasync); if (!err) { err = offset; } put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); }
static void coroutine_fn v9fs_fsync(void *opaque) { int err; int32_t fid; int datasync; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; err = pdu_unmarshal(pdu, offset, "dd", &fid, &datasync); if (err < 0) { goto out_nofid; } trace_v9fs_fsync(pdu->tag, pdu->id, fid, datasync); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fsync(pdu, fidp, datasync); if (!err) { err = offset; } put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); }
C
qemu
0
CVE-2015-9016
https://www.cvedetails.com/cve/CVE-2015-9016/
CWE-362
https://github.com/torvalds/linux/commit/0048b4837affd153897ed1222283492070027aa9
0048b4837affd153897ed1222283492070027aa9
blk-mq: fix race between timeout and freeing request Inside timeout handler, blk_mq_tag_to_rq() is called to retrieve the request from one tag. This way is obviously wrong because the request can be freed any time and some fiedds of the request can't be trusted, then kernel oops might be triggered[1]. Currently wrt. blk_mq_tag_to_rq(), the only special case is that the flush request can share same tag with the request cloned from, and the two requests can't be active at the same time, so this patch fixes the above issue by updating tags->rqs[tag] with the active request(either flush rq or the request cloned from) of the tag. Also blk_mq_tag_to_rq() gets much simplified with this patch. Given blk_mq_tag_to_rq() is mainly for drivers and the caller must make sure the request can't be freed, so in bt_for_each() this helper is replaced with tags->rqs[tag]. [1] kernel oops log [ 439.696220] BUG: unable to handle kernel NULL pointer dereference at 0000000000000158^M [ 439.697162] IP: [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.700653] PGD 7ef765067 PUD 7ef764067 PMD 0 ^M [ 439.700653] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ^M [ 439.700653] Dumping ftrace buffer:^M [ 439.700653] (ftrace buffer empty)^M [ 439.700653] Modules linked in: nbd ipv6 kvm_intel kvm serio_raw^M [ 439.700653] CPU: 6 PID: 2779 Comm: stress-ng-sigfd Not tainted 4.2.0-rc5-next-20150805+ #265^M [ 439.730500] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M [ 439.730500] task: ffff880605308000 ti: ffff88060530c000 task.ti: ffff88060530c000^M [ 439.730500] RIP: 0010:[<ffffffff812d89ba>] [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.730500] RSP: 0018:ffff880819203da0 EFLAGS: 00010283^M [ 439.730500] RAX: ffff880811b0e000 RBX: ffff8800bb465f00 RCX: 0000000000000002^M [ 439.730500] RDX: 0000000000000000 RSI: 0000000000000202 RDI: 0000000000000000^M [ 439.730500] RBP: ffff880819203db0 R08: 0000000000000002 R09: 0000000000000000^M [ 439.730500] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000202^M [ 439.730500] R13: ffff880814104800 R14: 0000000000000002 R15: ffff880811a2ea00^M [ 439.730500] FS: 00007f165b3f5740(0000) GS:ffff880819200000(0000) knlGS:0000000000000000^M [ 439.730500] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b^M [ 439.730500] CR2: 0000000000000158 CR3: 00000007ef766000 CR4: 00000000000006e0^M [ 439.730500] Stack:^M [ 439.730500] 0000000000000008 ffff8808114eed90 ffff880819203e00 ffffffff812dc104^M [ 439.755663] ffff880819203e40 ffffffff812d9f5e 0000020000000000 ffff8808114eed80^M [ 439.755663] Call Trace:^M [ 439.755663] <IRQ> ^M [ 439.755663] [<ffffffff812dc104>] bt_for_each+0x6e/0xc8^M [ 439.755663] [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M [ 439.755663] [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M [ 439.755663] [<ffffffff812dc1b3>] blk_mq_tag_busy_iter+0x55/0x5e^M [ 439.755663] [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M [ 439.755663] [<ffffffff812d8911>] blk_mq_rq_timer+0x5d/0xd4^M [ 439.755663] [<ffffffff810a3e10>] call_timer_fn+0xf7/0x284^M [ 439.755663] [<ffffffff810a3d1e>] ? call_timer_fn+0x5/0x284^M [ 439.755663] [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M [ 439.755663] [<ffffffff810a46d6>] run_timer_softirq+0x1ce/0x1f8^M [ 439.755663] [<ffffffff8104c367>] __do_softirq+0x181/0x3a4^M [ 439.755663] [<ffffffff8104c76e>] irq_exit+0x40/0x94^M [ 439.755663] [<ffffffff81031482>] smp_apic_timer_interrupt+0x33/0x3e^M [ 439.755663] [<ffffffff815559a4>] apic_timer_interrupt+0x84/0x90^M [ 439.755663] <EOI> ^M [ 439.755663] [<ffffffff81554350>] ? _raw_spin_unlock_irq+0x32/0x4a^M [ 439.755663] [<ffffffff8106a98b>] finish_task_switch+0xe0/0x163^M [ 439.755663] [<ffffffff8106a94d>] ? finish_task_switch+0xa2/0x163^M [ 439.755663] [<ffffffff81550066>] __schedule+0x469/0x6cd^M [ 439.755663] [<ffffffff8155039b>] schedule+0x82/0x9a^M [ 439.789267] [<ffffffff8119b28b>] signalfd_read+0x186/0x49a^M [ 439.790911] [<ffffffff8106d86a>] ? wake_up_q+0x47/0x47^M [ 439.790911] [<ffffffff811618c2>] __vfs_read+0x28/0x9f^M [ 439.790911] [<ffffffff8117a289>] ? __fget_light+0x4d/0x74^M [ 439.790911] [<ffffffff811620a7>] vfs_read+0x7a/0xc6^M [ 439.790911] [<ffffffff8116292b>] SyS_read+0x49/0x7f^M [ 439.790911] [<ffffffff81554c17>] entry_SYSCALL_64_fastpath+0x12/0x6f^M [ 439.790911] Code: 48 89 e5 e8 a9 b8 e7 ff 5d c3 0f 1f 44 00 00 55 89 f2 48 89 e5 41 54 41 89 f4 53 48 8b 47 60 48 8b 1c d0 48 8b 7b 30 48 8b 53 38 <48> 8b 87 58 01 00 00 48 85 c0 75 09 48 8b 97 88 0c 00 00 eb 10 ^M [ 439.790911] RIP [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.790911] RSP <ffff880819203da0>^M [ 439.790911] CR2: 0000000000000158^M [ 439.790911] ---[ end trace d40af58949325661 ]---^M Cc: <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp, bool reserved) { struct blk_mq_ctx *ctx; struct blk_mq_hw_ctx *hctx; struct request *rq; struct blk_mq_alloc_data alloc_data; int ret; ret = blk_mq_queue_enter(q, gfp); if (ret) return ERR_PTR(ret); ctx = blk_mq_get_ctx(q); hctx = q->mq_ops->map_queue(q, ctx->cpu); blk_mq_set_alloc_data(&alloc_data, q, gfp & ~__GFP_WAIT, reserved, ctx, hctx); rq = __blk_mq_alloc_request(&alloc_data, rw); if (!rq && (gfp & __GFP_WAIT)) { __blk_mq_run_hw_queue(hctx); blk_mq_put_ctx(ctx); ctx = blk_mq_get_ctx(q); hctx = q->mq_ops->map_queue(q, ctx->cpu); blk_mq_set_alloc_data(&alloc_data, q, gfp, reserved, ctx, hctx); rq = __blk_mq_alloc_request(&alloc_data, rw); ctx = alloc_data.ctx; } blk_mq_put_ctx(ctx); if (!rq) { blk_mq_queue_exit(q); return ERR_PTR(-EWOULDBLOCK); } return rq; }
struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp, bool reserved) { struct blk_mq_ctx *ctx; struct blk_mq_hw_ctx *hctx; struct request *rq; struct blk_mq_alloc_data alloc_data; int ret; ret = blk_mq_queue_enter(q, gfp); if (ret) return ERR_PTR(ret); ctx = blk_mq_get_ctx(q); hctx = q->mq_ops->map_queue(q, ctx->cpu); blk_mq_set_alloc_data(&alloc_data, q, gfp & ~__GFP_WAIT, reserved, ctx, hctx); rq = __blk_mq_alloc_request(&alloc_data, rw); if (!rq && (gfp & __GFP_WAIT)) { __blk_mq_run_hw_queue(hctx); blk_mq_put_ctx(ctx); ctx = blk_mq_get_ctx(q); hctx = q->mq_ops->map_queue(q, ctx->cpu); blk_mq_set_alloc_data(&alloc_data, q, gfp, reserved, ctx, hctx); rq = __blk_mq_alloc_request(&alloc_data, rw); ctx = alloc_data.ctx; } blk_mq_put_ctx(ctx); if (!rq) { blk_mq_queue_exit(q); return ERR_PTR(-EWOULDBLOCK); } return rq; }
C
linux
0
CVE-2016-2476
https://www.cvedetails.com/cve/CVE-2016-2476/
CWE-119
https://android.googlesource.com/platform/frameworks/av/+/94d9e646454f6246bf823b6897bd6aea5f08eda3
94d9e646454f6246bf823b6897bd6aea5f08eda3
Fix initialization of AAC presentation struct Otherwise the new size checks trip on this. Bug: 27207275 Change-Id: I1f8f01097e3a88ff041b69279a6121be842f1766
void ACodec::ExecutingState::submitOutputBuffers() { submitRegularOutputBuffers(); if (mCodec->storingMetadataInDecodedBuffers()) { submitOutputMetaBuffers(); } }
void ACodec::ExecutingState::submitOutputBuffers() { submitRegularOutputBuffers(); if (mCodec->storingMetadataInDecodedBuffers()) { submitOutputMetaBuffers(); } }
C
Android
0
CVE-2017-18221
https://www.cvedetails.com/cve/CVE-2017-18221/
CWE-20
https://github.com/torvalds/linux/commit/70feee0e1ef331b22cc51f383d532a0d043fbdcc
70feee0e1ef331b22cc51f383d532a0d043fbdcc
mlock: fix mlock count can not decrease in race condition Kefeng reported that when running the follow test, the mlock count in meminfo will increase permanently: [1] testcase linux:~ # cat test_mlockal grep Mlocked /proc/meminfo for j in `seq 0 10` do for i in `seq 4 15` do ./p_mlockall >> log & done sleep 0.2 done # wait some time to let mlock counter decrease and 5s may not enough sleep 5 grep Mlocked /proc/meminfo linux:~ # cat p_mlockall.c #include <sys/mman.h> #include <stdlib.h> #include <stdio.h> #define SPACE_LEN 4096 int main(int argc, char ** argv) { int ret; void *adr = malloc(SPACE_LEN); if (!adr) return -1; ret = mlockall(MCL_CURRENT | MCL_FUTURE); printf("mlcokall ret = %d\n", ret); ret = munlockall(); printf("munlcokall ret = %d\n", ret); free(adr); return 0; } In __munlock_pagevec() we should decrement NR_MLOCK for each page where we clear the PageMlocked flag. Commit 1ebb7cc6a583 ("mm: munlock: batch NR_MLOCK zone state updates") has introduced a bug where we don't decrement NR_MLOCK for pages where we clear the flag, but fail to isolate them from the lru list (e.g. when the pages are on some other cpu's percpu pagevec). Since PageMlocked stays cleared, the NR_MLOCK accounting gets permanently disrupted by this. Fix it by counting the number of page whose PageMlock flag is cleared. Fixes: 1ebb7cc6a583 (" mm: munlock: batch NR_MLOCK zone state updates") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yisheng Xie <[email protected]> Reported-by: Kefeng Wang <[email protected]> Tested-by: Kefeng Wang <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Joern Engel <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Xishi Qiu <[email protected]> Cc: zhongjiang <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) { return do_mlock(start, len, VM_LOCKED); }
SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) { return do_mlock(start, len, VM_LOCKED); }
C
linux
0
CVE-2017-8086
https://www.cvedetails.com/cve/CVE-2017-8086/
CWE-772
https://git.qemu.org/?p=qemu.git;a=commit;h=4ffcdef4277a91af15a3c09f7d16af072c29f3f2
4ffcdef4277a91af15a3c09f7d16af072c29f3f2
null
int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size, int flags) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); int ret; ret = lsetxattr(proc_path, name, value, size, flags); g_free(proc_path); return ret; }
int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size, int flags) { char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename); int ret; ret = lsetxattr(proc_path, name, value, size, flags); g_free(proc_path); return ret; }
C
qemu
0
CVE-2018-6079
https://www.cvedetails.com/cve/CVE-2018-6079/
CWE-200
https://github.com/chromium/chromium/commit/d128139d53e9268e87921e82d89b3f2053cb83fd
d128139d53e9268e87921e82d89b3f2053cb83fd
Fix tabs sharing TEXTURE_2D_ARRAY/TEXTURE_3D data. In linux and android, we are seeing an issue where texture data from one tab overwrites the texture data of another tab. This is happening for apps which are using webgl2 texture of type TEXTURE_2D_ARRAY/TEXTURE_3D. Due to a bug in virtual context save/restore code for above texture formats, the texture data is not properly restored while switching tabs. Hence texture data from one tab overwrites other. This CL has fix for that issue, an update for existing test expectations and a new unit test for this bug. Bug: 788448 Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: Ie933984cdd2d1381f42eb4638f730c8245207a28 Reviewed-on: https://chromium-review.googlesource.com/930327 Reviewed-by: Zhenyao Mo <[email protected]> Commit-Queue: vikas soni <[email protected]> Cr-Commit-Position: refs/heads/master@{#539111}
uint64_t GLManager::GenerateFenceSyncRelease() { return next_fence_sync_release_++; }
uint64_t GLManager::GenerateFenceSyncRelease() { return next_fence_sync_release_++; }
C
Chrome
0
CVE-2016-0830
https://www.cvedetails.com/cve/CVE-2016-0830/
CWE-119
https://android.googlesource.com/platform/system/bt/+/d77f1999ecece56c1cbb333f4ddc26f0b5bac2c5
d77f1999ecece56c1cbb333f4ddc26f0b5bac2c5
Fix crashes with lots of discovered LE devices When loads of devices are discovered a config file which is too large can be written out, which causes the BT daemon to crash on startup. This limits the number of config entries for unpaired devices which are initialized, and prevents a large number from being saved to the filesystem. Bug: 26071376 Change-Id: I4a74094f57a82b17f94e99a819974b8bc8082184
bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type) { if (p_addr_type == NULL) return FALSE; bt_bdaddr_t bda; bdcpy(bda.address, bd_addr); bdstr_t bd_addr_str; bdaddr_to_string(&bda, bd_addr_str, sizeof(bd_addr_str)); if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type)) return FALSE; LOG_DEBUG(LOG_TAG, "%s: Device [%s] address type %d", __FUNCTION__, bd_addr_str, *p_addr_type); return TRUE; }
bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type) { if (p_addr_type == NULL) return FALSE; bt_bdaddr_t bda; bdcpy(bda.address, bd_addr); bdstr_t bd_addr_str; bdaddr_to_string(&bda, bd_addr_str, sizeof(bd_addr_str)); if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type)) return FALSE; LOG_DEBUG(LOG_TAG, "%s: Device [%s] address type %d", __FUNCTION__, bd_addr_str, *p_addr_type); return TRUE; }
C
Android
0
CVE-2015-8963
https://www.cvedetails.com/cve/CVE-2015-8963/
CWE-416
https://github.com/torvalds/linux/commit/12ca6ad2e3a896256f086497a7c7406a547ee373
12ca6ad2e3a896256f086497a7c7406a547ee373
perf: Fix race in swevent hash There's a race on CPU unplug where we free the swevent hash array while it can still have events on. This will result in a use-after-free which is BAD. Simply do not free the hash array on unplug. This leaves the thing around and no use-after-free takes place. When the last swevent dies, we do a for_each_possible_cpu() iteration anyway to clean these up, at which time we'll free it, so no leakage will occur. Reported-by: Sasha Levin <[email protected]> Tested-by: Sasha Levin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
void perf_event_aux_event(struct perf_event *event, unsigned long head, unsigned long size, u64 flags) { struct perf_output_handle handle; struct perf_sample_data sample; struct perf_aux_event { struct perf_event_header header; u64 offset; u64 size; u64 flags; } rec = { .header = { .type = PERF_RECORD_AUX, .misc = 0, .size = sizeof(rec), }, .offset = head, .size = size, .flags = flags, }; int ret; perf_event_header__init_id(&rec.header, &sample, event); ret = perf_output_begin(&handle, event, rec.header.size); if (ret) return; perf_output_put(&handle, rec); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); }
void perf_event_aux_event(struct perf_event *event, unsigned long head, unsigned long size, u64 flags) { struct perf_output_handle handle; struct perf_sample_data sample; struct perf_aux_event { struct perf_event_header header; u64 offset; u64 size; u64 flags; } rec = { .header = { .type = PERF_RECORD_AUX, .misc = 0, .size = sizeof(rec), }, .offset = head, .size = size, .flags = flags, }; int ret; perf_event_header__init_id(&rec.header, &sample, event); ret = perf_output_begin(&handle, event, rec.header.size); if (ret) return; perf_output_put(&handle, rec); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); }
C
linux
0
CVE-2014-1713
https://www.cvedetails.com/cve/CVE-2014-1713/
CWE-399
https://github.com/chromium/chromium/commit/f85a87ec670ad0fce9d98d90c9a705b72a288154
f85a87ec670ad0fce9d98d90c9a705b72a288154
document.location bindings fix BUG=352374 [email protected] Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void sequenceLongMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, v8Array(imp->sequenceLongMethod(), info.GetIsolate())); }
static void sequenceLongMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, v8Array(imp->sequenceLongMethod(), info.GetIsolate())); }
C
Chrome
0
CVE-2013-2635
https://www.cvedetails.com/cve/CVE-2013-2635/
CWE-399
https://github.com/torvalds/linux/commit/84d73cd3fb142bf1298a8c13fd4ca50fd2432372
84d73cd3fb142bf1298a8c13fd4ca50fd2432372
rtnl: fix info leak on RTM_GETLINK request for VF devices Initialize the mac address buffer with 0 as the driver specific function will probably not fill the whole buffer. In fact, all in-kernel drivers fill only ETH_ALEN of the MAX_ADDR_LEN bytes, i.e. 6 of the 32 possible bytes. Therefore we currently leak 26 bytes of stack memory to userland via the netlink interface. Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev) { int err; if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent) return 0; err = rtnl_port_self_fill(skb, dev); if (err) return err; if (dev_num_vf(dev->dev.parent)) { err = rtnl_vf_ports_fill(skb, dev); if (err) return err; } return 0; }
static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev) { int err; if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent) return 0; err = rtnl_port_self_fill(skb, dev); if (err) return err; if (dev_num_vf(dev->dev.parent)) { err = rtnl_vf_ports_fill(skb, dev); if (err) return err; } return 0; }
C
linux
0
CVE-2013-4470
https://www.cvedetails.com/cve/CVE-2013-4470/
CWE-264
https://github.com/torvalds/linux/commit/e93b7d748be887cd7639b113ba7d7ef792a7efb9
e93b7d748be887cd7639b113ba7d7ef792a7efb9
ip_output: do skb ufo init for peeked non ufo skb as well Now, if user application does: sendto len<mtu flag MSG_MORE sendto len>mtu flag 0 The skb is not treated as fragmented one because it is not initialized that way. So move the initialization to fix this. introduced by: commit e89e9cf539a28df7d0eb1d0a545368e9920b34ac "[IPv4/IPv6]: UFO Scatter-gather approach" Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, int offset, size_t size, int flags) { struct inet_sock *inet = inet_sk(sk); struct sk_buff *skb; struct rtable *rt; struct ip_options *opt = NULL; struct inet_cork *cork; int hh_len; int mtu; int len; int err; unsigned int maxfraglen, fragheaderlen, fraggap; if (inet->hdrincl) return -EPERM; if (flags&MSG_PROBE) return 0; if (skb_queue_empty(&sk->sk_write_queue)) return -EINVAL; cork = &inet->cork.base; rt = (struct rtable *)cork->dst; if (cork->flags & IPCORK_OPT) opt = cork->opt; if (!(rt->dst.dev->features&NETIF_F_SG)) return -EOPNOTSUPP; hh_len = LL_RESERVED_SPACE(rt->dst.dev); mtu = cork->fragsize; fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; if (cork->length + size > 0xFFFF - fragheaderlen) { ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, mtu); return -EMSGSIZE; } if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) return -EINVAL; cork->length += size; if ((size + skb->len > mtu) && (sk->sk_protocol == IPPROTO_UDP) && (rt->dst.dev->features & NETIF_F_UFO)) { skb_shinfo(skb)->gso_size = mtu - fragheaderlen; skb_shinfo(skb)->gso_type = SKB_GSO_UDP; } while (size > 0) { int i; if (skb_is_gso(skb)) len = size; else { /* Check if the remaining data fits into current packet. */ len = mtu - skb->len; if (len < size) len = maxfraglen - skb->len; } if (len <= 0) { struct sk_buff *skb_prev; int alloclen; skb_prev = skb; fraggap = skb_prev->len - maxfraglen; alloclen = fragheaderlen + hh_len + fraggap + 15; skb = sock_wmalloc(sk, alloclen, 1, sk->sk_allocation); if (unlikely(!skb)) { err = -ENOBUFS; goto error; } /* * Fill in the control structures */ skb->ip_summed = CHECKSUM_NONE; skb->csum = 0; skb_reserve(skb, hh_len); /* * Find where to start putting bytes. */ skb_put(skb, fragheaderlen + fraggap); skb_reset_network_header(skb); skb->transport_header = (skb->network_header + fragheaderlen); if (fraggap) { skb->csum = skb_copy_and_csum_bits(skb_prev, maxfraglen, skb_transport_header(skb), fraggap, 0); skb_prev->csum = csum_sub(skb_prev->csum, skb->csum); pskb_trim_unique(skb_prev, maxfraglen); } /* * Put the packet on the pending queue. */ __skb_queue_tail(&sk->sk_write_queue, skb); continue; } i = skb_shinfo(skb)->nr_frags; if (len > size) len = size; if (skb_can_coalesce(skb, i, page, offset)) { skb_frag_size_add(&skb_shinfo(skb)->frags[i-1], len); } else if (i < MAX_SKB_FRAGS) { get_page(page); skb_fill_page_desc(skb, i, page, offset, len); } else { err = -EMSGSIZE; goto error; } if (skb->ip_summed == CHECKSUM_NONE) { __wsum csum; csum = csum_page(page, offset, len); skb->csum = csum_block_add(skb->csum, csum, skb->len); } skb->len += len; skb->data_len += len; skb->truesize += len; atomic_add(len, &sk->sk_wmem_alloc); offset += len; size -= len; } return 0; error: cork->length -= size; IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); return err; }
ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, int offset, size_t size, int flags) { struct inet_sock *inet = inet_sk(sk); struct sk_buff *skb; struct rtable *rt; struct ip_options *opt = NULL; struct inet_cork *cork; int hh_len; int mtu; int len; int err; unsigned int maxfraglen, fragheaderlen, fraggap; if (inet->hdrincl) return -EPERM; if (flags&MSG_PROBE) return 0; if (skb_queue_empty(&sk->sk_write_queue)) return -EINVAL; cork = &inet->cork.base; rt = (struct rtable *)cork->dst; if (cork->flags & IPCORK_OPT) opt = cork->opt; if (!(rt->dst.dev->features&NETIF_F_SG)) return -EOPNOTSUPP; hh_len = LL_RESERVED_SPACE(rt->dst.dev); mtu = cork->fragsize; fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; if (cork->length + size > 0xFFFF - fragheaderlen) { ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, mtu); return -EMSGSIZE; } if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) return -EINVAL; cork->length += size; if ((size + skb->len > mtu) && (sk->sk_protocol == IPPROTO_UDP) && (rt->dst.dev->features & NETIF_F_UFO)) { skb_shinfo(skb)->gso_size = mtu - fragheaderlen; skb_shinfo(skb)->gso_type = SKB_GSO_UDP; } while (size > 0) { int i; if (skb_is_gso(skb)) len = size; else { /* Check if the remaining data fits into current packet. */ len = mtu - skb->len; if (len < size) len = maxfraglen - skb->len; } if (len <= 0) { struct sk_buff *skb_prev; int alloclen; skb_prev = skb; fraggap = skb_prev->len - maxfraglen; alloclen = fragheaderlen + hh_len + fraggap + 15; skb = sock_wmalloc(sk, alloclen, 1, sk->sk_allocation); if (unlikely(!skb)) { err = -ENOBUFS; goto error; } /* * Fill in the control structures */ skb->ip_summed = CHECKSUM_NONE; skb->csum = 0; skb_reserve(skb, hh_len); /* * Find where to start putting bytes. */ skb_put(skb, fragheaderlen + fraggap); skb_reset_network_header(skb); skb->transport_header = (skb->network_header + fragheaderlen); if (fraggap) { skb->csum = skb_copy_and_csum_bits(skb_prev, maxfraglen, skb_transport_header(skb), fraggap, 0); skb_prev->csum = csum_sub(skb_prev->csum, skb->csum); pskb_trim_unique(skb_prev, maxfraglen); } /* * Put the packet on the pending queue. */ __skb_queue_tail(&sk->sk_write_queue, skb); continue; } i = skb_shinfo(skb)->nr_frags; if (len > size) len = size; if (skb_can_coalesce(skb, i, page, offset)) { skb_frag_size_add(&skb_shinfo(skb)->frags[i-1], len); } else if (i < MAX_SKB_FRAGS) { get_page(page); skb_fill_page_desc(skb, i, page, offset, len); } else { err = -EMSGSIZE; goto error; } if (skb->ip_summed == CHECKSUM_NONE) { __wsum csum; csum = csum_page(page, offset, len); skb->csum = csum_block_add(skb->csum, csum, skb->len); } skb->len += len; skb->data_len += len; skb->truesize += len; atomic_add(len, &sk->sk_wmem_alloc); offset += len; size -= len; } return 0; error: cork->length -= size; IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); return err; }
C
linux
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
void omx_vdec::append_frame_dimension_extradata(OMX_OTHER_EXTRADATATYPE *extra) { OMX_QCOM_EXTRADATA_FRAMEDIMENSION *frame_dimension; if (!(client_extradata & OMX_FRAMEDIMENSION_EXTRADATA)) { return; } extra->nSize = OMX_FRAMEDIMENSION_EXTRADATA_SIZE; extra->nVersion.nVersion = OMX_SPEC_VERSION; extra->nPortIndex = OMX_CORE_OUTPUT_PORT_INDEX; extra->eType = (OMX_EXTRADATATYPE)OMX_ExtraDataFrameDimension; extra->nDataSize = sizeof(OMX_QCOM_EXTRADATA_FRAMEDIMENSION); frame_dimension = (OMX_QCOM_EXTRADATA_FRAMEDIMENSION *)(void *)extra->data; frame_dimension->nDecWidth = rectangle.nLeft; frame_dimension->nDecHeight = rectangle.nTop; frame_dimension->nActualWidth = rectangle.nWidth; frame_dimension->nActualHeight = rectangle.nHeight; }
void omx_vdec::append_frame_dimension_extradata(OMX_OTHER_EXTRADATATYPE *extra) { OMX_QCOM_EXTRADATA_FRAMEDIMENSION *frame_dimension; if (!(client_extradata & OMX_FRAMEDIMENSION_EXTRADATA)) { return; } extra->nSize = OMX_FRAMEDIMENSION_EXTRADATA_SIZE; extra->nVersion.nVersion = OMX_SPEC_VERSION; extra->nPortIndex = OMX_CORE_OUTPUT_PORT_INDEX; extra->eType = (OMX_EXTRADATATYPE)OMX_ExtraDataFrameDimension; extra->nDataSize = sizeof(OMX_QCOM_EXTRADATA_FRAMEDIMENSION); frame_dimension = (OMX_QCOM_EXTRADATA_FRAMEDIMENSION *)(void *)extra->data; frame_dimension->nDecWidth = rectangle.nLeft; frame_dimension->nDecHeight = rectangle.nTop; frame_dimension->nActualWidth = rectangle.nWidth; frame_dimension->nActualHeight = rectangle.nHeight; }
C
Android
0
CVE-2017-7616
https://www.cvedetails.com/cve/CVE-2017-7616/
CWE-388
https://github.com/torvalds/linux/commit/cf01fb9985e8deb25ccf0ea54d916b8871ae0e62
cf01fb9985e8deb25ccf0ea54d916b8871ae0e62
mm/mempolicy.c: fix error handling in set_mempolicy and mbind. In the case that compat_get_bitmap fails we do not want to copy the bitmap to the user as it will contain uninitialized stack data and leak sensitive data. Signed-off-by: Chris Salls <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
int mpol_parse_str(char *str, struct mempolicy **mpol) { struct mempolicy *new = NULL; unsigned short mode; unsigned short mode_flags; nodemask_t nodes; char *nodelist = strchr(str, ':'); char *flags = strchr(str, '='); int err = 1; if (nodelist) { /* NUL-terminate mode or flags string */ *nodelist++ = '\0'; if (nodelist_parse(nodelist, nodes)) goto out; if (!nodes_subset(nodes, node_states[N_MEMORY])) goto out; } else nodes_clear(nodes); if (flags) *flags++ = '\0'; /* terminate mode string */ for (mode = 0; mode < MPOL_MAX; mode++) { if (!strcmp(str, policy_modes[mode])) { break; } } if (mode >= MPOL_MAX) goto out; switch (mode) { case MPOL_PREFERRED: /* * Insist on a nodelist of one node only */ if (nodelist) { char *rest = nodelist; while (isdigit(*rest)) rest++; if (*rest) goto out; } break; case MPOL_INTERLEAVE: /* * Default to online nodes with memory if no nodelist */ if (!nodelist) nodes = node_states[N_MEMORY]; break; case MPOL_LOCAL: /* * Don't allow a nodelist; mpol_new() checks flags */ if (nodelist) goto out; mode = MPOL_PREFERRED; break; case MPOL_DEFAULT: /* * Insist on a empty nodelist */ if (!nodelist) err = 0; goto out; case MPOL_BIND: /* * Insist on a nodelist */ if (!nodelist) goto out; } mode_flags = 0; if (flags) { /* * Currently, we only support two mutually exclusive * mode flags. */ if (!strcmp(flags, "static")) mode_flags |= MPOL_F_STATIC_NODES; else if (!strcmp(flags, "relative")) mode_flags |= MPOL_F_RELATIVE_NODES; else goto out; } new = mpol_new(mode, mode_flags, &nodes); if (IS_ERR(new)) goto out; /* * Save nodes for mpol_to_str() to show the tmpfs mount options * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. */ if (mode != MPOL_PREFERRED) new->v.nodes = nodes; else if (nodelist) new->v.preferred_node = first_node(nodes); else new->flags |= MPOL_F_LOCAL; /* * Save nodes for contextualization: this will be used to "clone" * the mempolicy in a specific context [cpuset] at a later time. */ new->w.user_nodemask = nodes; err = 0; out: /* Restore string for error message */ if (nodelist) *--nodelist = ':'; if (flags) *--flags = '='; if (!err) *mpol = new; return err; }
int mpol_parse_str(char *str, struct mempolicy **mpol) { struct mempolicy *new = NULL; unsigned short mode; unsigned short mode_flags; nodemask_t nodes; char *nodelist = strchr(str, ':'); char *flags = strchr(str, '='); int err = 1; if (nodelist) { /* NUL-terminate mode or flags string */ *nodelist++ = '\0'; if (nodelist_parse(nodelist, nodes)) goto out; if (!nodes_subset(nodes, node_states[N_MEMORY])) goto out; } else nodes_clear(nodes); if (flags) *flags++ = '\0'; /* terminate mode string */ for (mode = 0; mode < MPOL_MAX; mode++) { if (!strcmp(str, policy_modes[mode])) { break; } } if (mode >= MPOL_MAX) goto out; switch (mode) { case MPOL_PREFERRED: /* * Insist on a nodelist of one node only */ if (nodelist) { char *rest = nodelist; while (isdigit(*rest)) rest++; if (*rest) goto out; } break; case MPOL_INTERLEAVE: /* * Default to online nodes with memory if no nodelist */ if (!nodelist) nodes = node_states[N_MEMORY]; break; case MPOL_LOCAL: /* * Don't allow a nodelist; mpol_new() checks flags */ if (nodelist) goto out; mode = MPOL_PREFERRED; break; case MPOL_DEFAULT: /* * Insist on a empty nodelist */ if (!nodelist) err = 0; goto out; case MPOL_BIND: /* * Insist on a nodelist */ if (!nodelist) goto out; } mode_flags = 0; if (flags) { /* * Currently, we only support two mutually exclusive * mode flags. */ if (!strcmp(flags, "static")) mode_flags |= MPOL_F_STATIC_NODES; else if (!strcmp(flags, "relative")) mode_flags |= MPOL_F_RELATIVE_NODES; else goto out; } new = mpol_new(mode, mode_flags, &nodes); if (IS_ERR(new)) goto out; /* * Save nodes for mpol_to_str() to show the tmpfs mount options * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. */ if (mode != MPOL_PREFERRED) new->v.nodes = nodes; else if (nodelist) new->v.preferred_node = first_node(nodes); else new->flags |= MPOL_F_LOCAL; /* * Save nodes for contextualization: this will be used to "clone" * the mempolicy in a specific context [cpuset] at a later time. */ new->w.user_nodemask = nodes; err = 0; out: /* Restore string for error message */ if (nodelist) *--nodelist = ':'; if (flags) *--flags = '='; if (!err) *mpol = new; return err; }
C
linux
0
CVE-2019-3817
https://www.cvedetails.com/cve/CVE-2019-3817/
CWE-416
https://github.com/rpm-software-management/libcomps/commit/e3a5d056633677959ad924a51758876d415e7046
e3a5d056633677959ad924a51758876d415e7046
Fix UAF in comps_objmrtree_unite function The added field is not used at all in many places and it is probably the left-over of some copy-paste.
void comps_objmrtree_set_n(COMPS_ObjMRTree *rt, char *key, size_t len, void *ndata) { __comps_objmrtree_set(rt, key, len, ndata); }
void comps_objmrtree_set_n(COMPS_ObjMRTree *rt, char *key, size_t len, void *ndata) { __comps_objmrtree_set(rt, key, len, ndata); }
C
libcomps
0
CVE-2013-0886
https://www.cvedetails.com/cve/CVE-2013-0886/
null
https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76
18d67244984a574ba2dd8779faabc0e3e34f4b76
Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 [email protected] Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98
void RenderWidgetHostViewAura::OnDisplayRemoved( const gfx::Display& old_display) { }
void RenderWidgetHostViewAura::OnDisplayRemoved( const gfx::Display& old_display) { }
C
Chrome
0
CVE-2018-6942
https://www.cvedetails.com/cve/CVE-2018-6942/
CWE-476
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=29c759284e305ec428703c9a5831d0b1fc3497ef
29c759284e305ec428703c9a5831d0b1fc3497ef
null
Ins_IP( TT_ExecContext exc ) { FT_F26Dot6 old_range, cur_range; FT_Vector* orus_base; FT_Vector* cur_base; FT_Int twilight; if ( exc->top < exc->GS.loop ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } /* * We need to deal in a special way with the twilight zone. * Otherwise, by definition, the value of exc->twilight.orus[n] is (0,0), * for every n. */ twilight = ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0 ); if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } if ( twilight ) orus_base = &exc->zp0.org[exc->GS.rp1]; else orus_base = &exc->zp0.orus[exc->GS.rp1]; cur_base = &exc->zp0.cur[exc->GS.rp1]; /* XXX: There are some glyphs in some braindead but popular */ /* fonts out there (e.g. [aeu]grave in monotype.ttf) */ /* calling IP[] with bad values of rp[12]. */ /* Do something sane when this odd thing happens. */ if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) || BOUNDS( exc->GS.rp2, exc->zp1.n_points ) ) { old_range = 0; cur_range = 0; } else { if ( twilight ) old_range = DUALPROJ( &exc->zp1.org[exc->GS.rp2], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) old_range = DUALPROJ( &exc->zp1.orus[exc->GS.rp2], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); } cur_range = PROJECT( &exc->zp1.cur[exc->GS.rp2], cur_base ); } for ( ; exc->GS.loop > 0; exc->GS.loop-- ) { FT_UInt point = (FT_UInt)exc->stack[--exc->args]; FT_F26Dot6 org_dist, cur_dist, new_dist; /* check point bounds */ if ( BOUNDS( point, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } continue; } if ( twilight ) org_dist = DUALPROJ( &exc->zp2.org[point], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) org_dist = DUALPROJ( &exc->zp2.orus[point], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } cur_dist = PROJECT( &exc->zp2.cur[point], cur_base ); if ( org_dist ) { if ( old_range ) new_dist = FT_MulDiv( org_dist, cur_range, old_range ); else { /* This is the same as what MS does for the invalid case: */ /* */ /* delta = (Original_Pt - Original_RP1) - */ /* (Current_Pt - Current_RP1) ; */ /* */ /* In FreeType speak: */ /* */ /* delta = org_dist - cur_dist . */ /* */ /* We move `point' by `new_dist - cur_dist' after leaving */ /* this block, thus we have */ /* */ /* new_dist - cur_dist = delta , */ /* new_dist - cur_dist = org_dist - cur_dist , */ /* new_dist = org_dist . */ new_dist = org_dist; } } else new_dist = 0; exc->func_move( exc, &exc->zp2, (FT_UShort)point, SUB_LONG( new_dist, cur_dist ) ); } Fail: exc->GS.loop = 1; exc->new_top = exc->args; }
Ins_IP( TT_ExecContext exc ) { FT_F26Dot6 old_range, cur_range; FT_Vector* orus_base; FT_Vector* cur_base; FT_Int twilight; if ( exc->top < exc->GS.loop ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } /* * We need to deal in a special way with the twilight zone. * Otherwise, by definition, the value of exc->twilight.orus[n] is (0,0), * for every n. */ twilight = ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0 ); if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } if ( twilight ) orus_base = &exc->zp0.org[exc->GS.rp1]; else orus_base = &exc->zp0.orus[exc->GS.rp1]; cur_base = &exc->zp0.cur[exc->GS.rp1]; /* XXX: There are some glyphs in some braindead but popular */ /* fonts out there (e.g. [aeu]grave in monotype.ttf) */ /* calling IP[] with bad values of rp[12]. */ /* Do something sane when this odd thing happens. */ if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) || BOUNDS( exc->GS.rp2, exc->zp1.n_points ) ) { old_range = 0; cur_range = 0; } else { if ( twilight ) old_range = DUALPROJ( &exc->zp1.org[exc->GS.rp2], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) old_range = DUALPROJ( &exc->zp1.orus[exc->GS.rp2], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); } cur_range = PROJECT( &exc->zp1.cur[exc->GS.rp2], cur_base ); } for ( ; exc->GS.loop > 0; exc->GS.loop-- ) { FT_UInt point = (FT_UInt)exc->stack[--exc->args]; FT_F26Dot6 org_dist, cur_dist, new_dist; /* check point bounds */ if ( BOUNDS( point, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } continue; } if ( twilight ) org_dist = DUALPROJ( &exc->zp2.org[point], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) org_dist = DUALPROJ( &exc->zp2.orus[point], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } cur_dist = PROJECT( &exc->zp2.cur[point], cur_base ); if ( org_dist ) { if ( old_range ) new_dist = FT_MulDiv( org_dist, cur_range, old_range ); else { /* This is the same as what MS does for the invalid case: */ /* */ /* delta = (Original_Pt - Original_RP1) - */ /* (Current_Pt - Current_RP1) ; */ /* */ /* In FreeType speak: */ /* */ /* delta = org_dist - cur_dist . */ /* */ /* We move `point' by `new_dist - cur_dist' after leaving */ /* this block, thus we have */ /* */ /* new_dist - cur_dist = delta , */ /* new_dist - cur_dist = org_dist - cur_dist , */ /* new_dist = org_dist . */ new_dist = org_dist; } } else new_dist = 0; exc->func_move( exc, &exc->zp2, (FT_UShort)point, SUB_LONG( new_dist, cur_dist ) ); } Fail: exc->GS.loop = 1; exc->new_top = exc->args; }
C
savannah
0
CVE-2016-3899
https://www.cvedetails.com/cve/CVE-2016-3899/
CWE-284
https://android.googlesource.com/platform/frameworks/av/+/97837bb6cbac21ea679843a0037779d3834bed64
97837bb6cbac21ea679843a0037779d3834bed64
OMXCodec: check IMemory::pointer() before using allocation Bug: 29421811 Change-Id: I0a73ba12bae4122f1d89fc92e5ea4f6a96cd1ed1
bool OMXCodec::drainInputBuffer(BufferInfo *info) { if (info != NULL) { CHECK_EQ((int)info->mStatus, (int)OWNED_BY_US); } if (mSignalledEOS) { return false; } if (mCodecSpecificDataIndex < mCodecSpecificData.size()) { CHECK(!(mFlags & kUseSecureInputBuffers)); const CodecSpecificData *specific = mCodecSpecificData[mCodecSpecificDataIndex]; size_t size = specific->mSize; if ((!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mMIME) || !strcasecmp(MEDIA_MIMETYPE_VIDEO_HEVC, mMIME)) && !(mQuirks & kWantsNALFragments)) { static const uint8_t kNALStartCode[4] = { 0x00, 0x00, 0x00, 0x01 }; CHECK(info->mSize >= specific->mSize + 4); size += 4; memcpy(info->mData, kNALStartCode, 4); memcpy((uint8_t *)info->mData + 4, specific->mData, specific->mSize); } else { CHECK(info->mSize >= specific->mSize); memcpy(info->mData, specific->mData, specific->mSize); } mNoMoreOutputData = false; CODEC_LOGV("calling emptyBuffer with codec specific data"); status_t err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, size, OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_CODECCONFIG, 0); CHECK_EQ(err, (status_t)OK); info->mStatus = OWNED_BY_COMPONENT; ++mCodecSpecificDataIndex; return true; } if (mPaused) { return false; } status_t err; bool signalEOS = false; int64_t timestampUs = 0; size_t offset = 0; int32_t n = 0; for (;;) { MediaBuffer *srcBuffer; if (mSeekTimeUs >= 0) { if (mLeftOverBuffer) { mLeftOverBuffer->release(); mLeftOverBuffer = NULL; } MediaSource::ReadOptions options; options.setSeekTo(mSeekTimeUs, mSeekMode); mSeekTimeUs = -1; mSeekMode = ReadOptions::SEEK_CLOSEST_SYNC; mBufferFilled.signal(); err = mSource->read(&srcBuffer, &options); if (err == OK) { int64_t targetTimeUs; if (srcBuffer->meta_data()->findInt64( kKeyTargetTime, &targetTimeUs) && targetTimeUs >= 0) { CODEC_LOGV("targetTimeUs = %lld us", (long long)targetTimeUs); mTargetTimeUs = targetTimeUs; } else { mTargetTimeUs = -1; } } } else if (mLeftOverBuffer) { srcBuffer = mLeftOverBuffer; mLeftOverBuffer = NULL; err = OK; } else { err = mSource->read(&srcBuffer); } if (err != OK) { signalEOS = true; mFinalStatus = err; mSignalledEOS = true; mBufferFilled.signal(); break; } if (mFlags & kUseSecureInputBuffers) { info = findInputBufferByDataPointer(srcBuffer->data()); CHECK(info != NULL); } size_t remainingBytes = info->mSize - offset; if (srcBuffer->range_length() > remainingBytes) { if (offset == 0) { CODEC_LOGE( "Codec's input buffers are too small to accomodate " "buffer read from source (info->mSize = %zu, srcLength = %zu)", info->mSize, srcBuffer->range_length()); srcBuffer->release(); srcBuffer = NULL; setState(ERROR); return false; } mLeftOverBuffer = srcBuffer; break; } bool releaseBuffer = true; if (mFlags & kStoreMetaDataInVideoBuffers) { releaseBuffer = false; info->mMediaBuffer = srcBuffer; } if (mFlags & kUseSecureInputBuffers) { releaseBuffer = false; CHECK(info->mMediaBuffer == NULL); info->mMediaBuffer = srcBuffer; } else { CHECK(srcBuffer->data() != NULL) ; memcpy((uint8_t *)info->mData + offset, (const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(), srcBuffer->range_length()); } int64_t lastBufferTimeUs; CHECK(srcBuffer->meta_data()->findInt64(kKeyTime, &lastBufferTimeUs)); CHECK(lastBufferTimeUs >= 0); if (mIsEncoder && mIsVideo) { mDecodingTimeList.push_back(lastBufferTimeUs); } if (offset == 0) { timestampUs = lastBufferTimeUs; } offset += srcBuffer->range_length(); if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_VORBIS, mMIME)) { CHECK(!(mQuirks & kSupportsMultipleFramesPerInputBuffer)); CHECK_GE(info->mSize, offset + sizeof(int32_t)); int32_t numPageSamples; if (!srcBuffer->meta_data()->findInt32( kKeyValidSamples, &numPageSamples)) { numPageSamples = -1; } memcpy((uint8_t *)info->mData + offset, &numPageSamples, sizeof(numPageSamples)); offset += sizeof(numPageSamples); } if (releaseBuffer) { srcBuffer->release(); srcBuffer = NULL; } ++n; if (!(mQuirks & kSupportsMultipleFramesPerInputBuffer)) { break; } int64_t coalescedDurationUs = lastBufferTimeUs - timestampUs; if (coalescedDurationUs > 250000ll) { break; } } if (n > 1) { ALOGV("coalesced %d frames into one input buffer", n); } OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS) { flags |= OMX_BUFFERFLAG_EOS; } else { mNoMoreOutputData = false; } if (info == NULL) { CHECK(mFlags & kUseSecureInputBuffers); CHECK(signalEOS); info = findEmptyInputBuffer(); } CODEC_LOGV("Calling emptyBuffer on buffer %u (length %zu), " "timestamp %lld us (%.2f secs)", info->mBuffer, offset, (long long)timestampUs, timestampUs / 1E6); err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, offset, flags, timestampUs); if (err != OK) { setState(ERROR); return false; } info->mStatus = OWNED_BY_COMPONENT; return true; }
bool OMXCodec::drainInputBuffer(BufferInfo *info) { if (info != NULL) { CHECK_EQ((int)info->mStatus, (int)OWNED_BY_US); } if (mSignalledEOS) { return false; } if (mCodecSpecificDataIndex < mCodecSpecificData.size()) { CHECK(!(mFlags & kUseSecureInputBuffers)); const CodecSpecificData *specific = mCodecSpecificData[mCodecSpecificDataIndex]; size_t size = specific->mSize; if ((!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mMIME) || !strcasecmp(MEDIA_MIMETYPE_VIDEO_HEVC, mMIME)) && !(mQuirks & kWantsNALFragments)) { static const uint8_t kNALStartCode[4] = { 0x00, 0x00, 0x00, 0x01 }; CHECK(info->mSize >= specific->mSize + 4); size += 4; memcpy(info->mData, kNALStartCode, 4); memcpy((uint8_t *)info->mData + 4, specific->mData, specific->mSize); } else { CHECK(info->mSize >= specific->mSize); memcpy(info->mData, specific->mData, specific->mSize); } mNoMoreOutputData = false; CODEC_LOGV("calling emptyBuffer with codec specific data"); status_t err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, size, OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_CODECCONFIG, 0); CHECK_EQ(err, (status_t)OK); info->mStatus = OWNED_BY_COMPONENT; ++mCodecSpecificDataIndex; return true; } if (mPaused) { return false; } status_t err; bool signalEOS = false; int64_t timestampUs = 0; size_t offset = 0; int32_t n = 0; for (;;) { MediaBuffer *srcBuffer; if (mSeekTimeUs >= 0) { if (mLeftOverBuffer) { mLeftOverBuffer->release(); mLeftOverBuffer = NULL; } MediaSource::ReadOptions options; options.setSeekTo(mSeekTimeUs, mSeekMode); mSeekTimeUs = -1; mSeekMode = ReadOptions::SEEK_CLOSEST_SYNC; mBufferFilled.signal(); err = mSource->read(&srcBuffer, &options); if (err == OK) { int64_t targetTimeUs; if (srcBuffer->meta_data()->findInt64( kKeyTargetTime, &targetTimeUs) && targetTimeUs >= 0) { CODEC_LOGV("targetTimeUs = %lld us", (long long)targetTimeUs); mTargetTimeUs = targetTimeUs; } else { mTargetTimeUs = -1; } } } else if (mLeftOverBuffer) { srcBuffer = mLeftOverBuffer; mLeftOverBuffer = NULL; err = OK; } else { err = mSource->read(&srcBuffer); } if (err != OK) { signalEOS = true; mFinalStatus = err; mSignalledEOS = true; mBufferFilled.signal(); break; } if (mFlags & kUseSecureInputBuffers) { info = findInputBufferByDataPointer(srcBuffer->data()); CHECK(info != NULL); } size_t remainingBytes = info->mSize - offset; if (srcBuffer->range_length() > remainingBytes) { if (offset == 0) { CODEC_LOGE( "Codec's input buffers are too small to accomodate " "buffer read from source (info->mSize = %zu, srcLength = %zu)", info->mSize, srcBuffer->range_length()); srcBuffer->release(); srcBuffer = NULL; setState(ERROR); return false; } mLeftOverBuffer = srcBuffer; break; } bool releaseBuffer = true; if (mFlags & kStoreMetaDataInVideoBuffers) { releaseBuffer = false; info->mMediaBuffer = srcBuffer; } if (mFlags & kUseSecureInputBuffers) { releaseBuffer = false; CHECK(info->mMediaBuffer == NULL); info->mMediaBuffer = srcBuffer; } else { CHECK(srcBuffer->data() != NULL) ; memcpy((uint8_t *)info->mData + offset, (const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(), srcBuffer->range_length()); } int64_t lastBufferTimeUs; CHECK(srcBuffer->meta_data()->findInt64(kKeyTime, &lastBufferTimeUs)); CHECK(lastBufferTimeUs >= 0); if (mIsEncoder && mIsVideo) { mDecodingTimeList.push_back(lastBufferTimeUs); } if (offset == 0) { timestampUs = lastBufferTimeUs; } offset += srcBuffer->range_length(); if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_VORBIS, mMIME)) { CHECK(!(mQuirks & kSupportsMultipleFramesPerInputBuffer)); CHECK_GE(info->mSize, offset + sizeof(int32_t)); int32_t numPageSamples; if (!srcBuffer->meta_data()->findInt32( kKeyValidSamples, &numPageSamples)) { numPageSamples = -1; } memcpy((uint8_t *)info->mData + offset, &numPageSamples, sizeof(numPageSamples)); offset += sizeof(numPageSamples); } if (releaseBuffer) { srcBuffer->release(); srcBuffer = NULL; } ++n; if (!(mQuirks & kSupportsMultipleFramesPerInputBuffer)) { break; } int64_t coalescedDurationUs = lastBufferTimeUs - timestampUs; if (coalescedDurationUs > 250000ll) { break; } } if (n > 1) { ALOGV("coalesced %d frames into one input buffer", n); } OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS) { flags |= OMX_BUFFERFLAG_EOS; } else { mNoMoreOutputData = false; } if (info == NULL) { CHECK(mFlags & kUseSecureInputBuffers); CHECK(signalEOS); info = findEmptyInputBuffer(); } CODEC_LOGV("Calling emptyBuffer on buffer %u (length %zu), " "timestamp %lld us (%.2f secs)", info->mBuffer, offset, (long long)timestampUs, timestampUs / 1E6); err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, offset, flags, timestampUs); if (err != OK) { setState(ERROR); return false; } info->mStatus = OWNED_BY_COMPONENT; return true; }
C
Android
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, unsigned int ol) { struct sock *sk = sock->sk; struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); int linksel; if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) return -ENOPROTOOPT; switch (opt) { case CAIFSO_LINK_SELECT: if (ol < sizeof(int)) return -EINVAL; if (lvl != SOL_CAIF) goto bad_sol; if (copy_from_user(&linksel, ov, sizeof(int))) return -EINVAL; lock_sock(&(cf_sk->sk)); cf_sk->conn_req.link_selector = linksel; release_sock(&cf_sk->sk); return 0; case CAIFSO_REQ_PARAM: if (lvl != SOL_CAIF) goto bad_sol; if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL) return -ENOPROTOOPT; lock_sock(&(cf_sk->sk)); if (ol > sizeof(cf_sk->conn_req.param.data) || copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) { release_sock(&cf_sk->sk); return -EINVAL; } cf_sk->conn_req.param.size = ol; release_sock(&cf_sk->sk); return 0; default: return -ENOPROTOOPT; } return 0; bad_sol: return -ENOPROTOOPT; }
static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, unsigned int ol) { struct sock *sk = sock->sk; struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); int linksel; if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) return -ENOPROTOOPT; switch (opt) { case CAIFSO_LINK_SELECT: if (ol < sizeof(int)) return -EINVAL; if (lvl != SOL_CAIF) goto bad_sol; if (copy_from_user(&linksel, ov, sizeof(int))) return -EINVAL; lock_sock(&(cf_sk->sk)); cf_sk->conn_req.link_selector = linksel; release_sock(&cf_sk->sk); return 0; case CAIFSO_REQ_PARAM: if (lvl != SOL_CAIF) goto bad_sol; if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL) return -ENOPROTOOPT; lock_sock(&(cf_sk->sk)); if (ol > sizeof(cf_sk->conn_req.param.data) || copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) { release_sock(&cf_sk->sk); return -EINVAL; } cf_sk->conn_req.param.size = ol; release_sock(&cf_sk->sk); return 0; default: return -ENOPROTOOPT; } return 0; bad_sol: return -ENOPROTOOPT; }
C
linux
0
CVE-2016-4565
https://www.cvedetails.com/cve/CVE-2016-4565/
CWE-264
https://github.com/torvalds/linux/commit/e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3
e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3
IB/security: Restrict use of the write() interface The drivers/infiniband stack uses write() as a replacement for bi-directional ioctl(). This is not safe. There are ways to trigger write calls that result in the return structure that is normally written to user space being shunted off to user specified kernel memory instead. For the immediate repair, detect and deny suspicious accesses to the write API. For long term, update the user space libraries and the kernel API to something that doesn't present the same security vulnerabilities (likely a structured ioctl() interface). The impacted uAPI interfaces are generally only available if hardware from drivers/infiniband is installed in the system. Reported-by: Jann Horn <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> [ Expanded check to all known write() entry points ] Cc: [email protected] Signed-off-by: Doug Ledford <[email protected]>
static int qib_ctxt_info(struct file *fp, struct qib_ctxt_info __user *uinfo) { struct qib_ctxt_info info; int ret; size_t sz; struct qib_ctxtdata *rcd = ctxt_fp(fp); struct qib_filedata *fd; fd = fp->private_data; info.num_active = qib_count_active_units(); info.unit = rcd->dd->unit; info.port = rcd->ppd->port; info.ctxt = rcd->ctxt; info.subctxt = subctxt_fp(fp); /* Number of user ctxts available for this device. */ info.num_ctxts = rcd->dd->cfgctxts - rcd->dd->first_user_ctxt; info.num_subctxts = rcd->subctxt_cnt; info.rec_cpu = fd->rec_cpu_num; sz = sizeof(info); if (copy_to_user(uinfo, &info, sz)) { ret = -EFAULT; goto bail; } ret = 0; bail: return ret; }
static int qib_ctxt_info(struct file *fp, struct qib_ctxt_info __user *uinfo) { struct qib_ctxt_info info; int ret; size_t sz; struct qib_ctxtdata *rcd = ctxt_fp(fp); struct qib_filedata *fd; fd = fp->private_data; info.num_active = qib_count_active_units(); info.unit = rcd->dd->unit; info.port = rcd->ppd->port; info.ctxt = rcd->ctxt; info.subctxt = subctxt_fp(fp); /* Number of user ctxts available for this device. */ info.num_ctxts = rcd->dd->cfgctxts - rcd->dd->first_user_ctxt; info.num_subctxts = rcd->subctxt_cnt; info.rec_cpu = fd->rec_cpu_num; sz = sizeof(info); if (copy_to_user(uinfo, &info, sz)) { ret = -EFAULT; goto bail; } ret = 0; bail: return ret; }
C
linux
0
CVE-2017-17862
https://www.cvedetails.com/cve/CVE-2017-17862/
CWE-20
https://github.com/torvalds/linux/commit/c131187db2d3fa2f8bf32fdf4e9a4ef805168467
c131187db2d3fa2f8bf32fdf4e9a4ef805168467
bpf: fix branch pruning logic when the verifier detects that register contains a runtime constant and it's compared with another constant it will prune exploration of the branch that is guaranteed not to be taken at runtime. This is all correct, but malicious program may be constructed in such a way that it always has a constant comparison and the other branch is never taken under any conditions. In this case such path through the program will not be explored by the verifier. It won't be taken at run-time either, but since all instructions are JITed the malicious program may cause JITs to complain about using reserved fields, etc. To fix the issue we have to track the instructions explored by the verifier and sanitize instructions that are dead at run time with NOPs. We cannot reject such dead code, since llvm generates it for valid C code, since it doesn't do as much data flow analysis as the verifier does. Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)") Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
static int __check_packet_access(struct bpf_verifier_env *env, u32 regno, int off, int size, bool zero_size_allowed) { struct bpf_reg_state *regs = cur_regs(env); struct bpf_reg_state *reg = &regs[regno]; if (off < 0 || size < 0 || (size == 0 && !zero_size_allowed) || (u64)off + size > reg->range) { verbose(env, "invalid access to packet, off=%d size=%d, R%d(id=%d,off=%d,r=%d)\n", off, size, regno, reg->id, reg->off, reg->range); return -EACCES; } return 0; }
static int __check_packet_access(struct bpf_verifier_env *env, u32 regno, int off, int size, bool zero_size_allowed) { struct bpf_reg_state *regs = cur_regs(env); struct bpf_reg_state *reg = &regs[regno]; if (off < 0 || size < 0 || (size == 0 && !zero_size_allowed) || (u64)off + size > reg->range) { verbose(env, "invalid access to packet, off=%d size=%d, R%d(id=%d,off=%d,r=%d)\n", off, size, regno, reg->id, reg->off, reg->range); return -EACCES; } return 0; }
C
linux
0
CVE-2019-13454
https://www.cvedetails.com/cve/CVE-2019-13454/
CWE-369
https://github.com/ImageMagick/ImageMagick/commit/1ddcf2e4f28029a888cadef2e757509ef5047ad8
1ddcf2e4f28029a888cadef2e757509ef5047ad8
https://github.com/ImageMagick/ImageMagick/issues/1629
static void ClearBounds(Image *image,RectangleInfo *bounds, ExceptionInfo *exception) { ssize_t y; if (bounds->x < 0) return; if (image->alpha_trait == UndefinedPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); for (y=0; y < (ssize_t) bounds->height; y++) { register ssize_t x; register Quantum *magick_restrict q; q=GetAuthenticPixels(image,bounds->x,bounds->y+y,bounds->width,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) bounds->width; x++) { SetPixelAlpha(image,TransparentAlpha,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } }
static void ClearBounds(Image *image,RectangleInfo *bounds, ExceptionInfo *exception) { ssize_t y; if (bounds->x < 0) return; if (image->alpha_trait == UndefinedPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); for (y=0; y < (ssize_t) bounds->height; y++) { register ssize_t x; register Quantum *magick_restrict q; q=GetAuthenticPixels(image,bounds->x,bounds->y+y,bounds->width,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) bounds->width; x++) { SetPixelAlpha(image,TransparentAlpha,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } }
C
ImageMagick6
0
CVE-2011-4621
https://www.cvedetails.com/cve/CVE-2011-4621/
null
https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64
f26f9aff6aaf67e9a430d16c266f91b13a5bff64
Sched: fix skip_clock_update optimization idle_balance() drops/retakes rq->lock, leaving the previous task vulnerable to set_tsk_need_resched(). Clear it after we return from balancing instead, and in setup_thread_stack() as well, so no successfully descheduled or never scheduled task has it set. Need resched confused the skip_clock_update logic, which assumes that the next call to update_rq_clock() will come nearly immediately after being set. Make the optimization robust against the waking a sleeper before it sucessfully deschedules case by checking that the current task has not been dequeued before setting the flag, since it is that useless clock update we're trying to save, and clear unconditionally in schedule() proper instead of conditionally in put_prev_task(). Signed-off-by: Mike Galbraith <[email protected]> Reported-by: Bjoern B. Brandenburg <[email protected]> Tested-by: Yong Zhang <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
void get_avenrun(unsigned long *loads, unsigned long offset, int shift) { loads[0] = (avenrun[0] + offset) << shift; loads[1] = (avenrun[1] + offset) << shift; loads[2] = (avenrun[2] + offset) << shift; }
void get_avenrun(unsigned long *loads, unsigned long offset, int shift) { loads[0] = (avenrun[0] + offset) << shift; loads[1] = (avenrun[1] + offset) << shift; loads[2] = (avenrun[2] + offset) << shift; }
C
linux
0
CVE-2012-2896
https://www.cvedetails.com/cve/CVE-2012-2896/
CWE-189
https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984
3aad1a37affb1ab70d1897f2b03eb8c077264984
Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98
bool GLES2DecoderImpl::ValidateCompressedTexSubDimensions( const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, TextureManager::TextureInfo* texture) { if (xoffset < 0 || yoffset < 0) { SetGLError( GL_INVALID_VALUE, function_name, "xoffset or yoffset < 0"); return false; } switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { const int kBlockWidth = 4; const int kBlockHeight = 4; if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { SetGLError( GL_INVALID_OPERATION, function_name, "xoffset or yoffset not multiple of 4"); return false; } GLsizei tex_width = 0; GLsizei tex_height = 0; if (!texture->GetLevelSize(target, level, &tex_width, &tex_height) || width - xoffset > tex_width || height - yoffset > tex_height) { SetGLError( GL_INVALID_OPERATION, function_name, "dimensions out of range"); return false; } return ValidateCompressedTexDimensions( function_name, level, width, height, format); } default: return false; } }
bool GLES2DecoderImpl::ValidateCompressedTexSubDimensions( const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, TextureManager::TextureInfo* texture) { if (xoffset < 0 || yoffset < 0) { SetGLError( GL_INVALID_VALUE, function_name, "xoffset or yoffset < 0"); return false; } switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { const int kBlockWidth = 4; const int kBlockHeight = 4; if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { SetGLError( GL_INVALID_OPERATION, function_name, "xoffset or yoffset not multiple of 4"); return false; } GLsizei tex_width = 0; GLsizei tex_height = 0; if (!texture->GetLevelSize(target, level, &tex_width, &tex_height) || width - xoffset > tex_width || height - yoffset > tex_height) { SetGLError( GL_INVALID_OPERATION, function_name, "dimensions out of range"); return false; } return ValidateCompressedTexDimensions( function_name, level, width, height, format); } default: return false; } }
C
Chrome
0
CVE-2014-2669
https://www.cvedetails.com/cve/CVE-2014-2669/
CWE-189
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
31400a673325147e1205326008e32135a78b4d8a
Predict integer overflow to avoid buffer overruns. Several functions, mostly type input functions, calculated an allocation size such that the calculation wrapped to a small positive value when arguments implied a sufficiently-large requirement. Writes past the end of the inadvertent small allocation followed shortly thereafter. Coverity identified the path_in() vulnerability; code inspection led to the rest. In passing, add check_stack_depth() to prevent stack overflow in related functions. Back-patch to 8.4 (all supported versions). The non-comment hstore changes touch code that did not exist in 8.4, so that part stops at 9.0. Noah Misch and Heikki Linnakangas, reviewed by Tom Lane. Security: CVE-2014-0064
bit_catenate(VarBit *arg1, VarBit *arg2) { VarBit *result; int bitlen1, bitlen2, bytelen, bit1pad, bit2shift; bits8 *pr, *pa; bitlen1 = VARBITLEN(arg1); bitlen2 = VARBITLEN(arg2); if (bitlen1 > VARBITMAXLEN - bitlen2) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("bit string length exceeds the maximum allowed (%d)", VARBITMAXLEN))); bytelen = VARBITTOTALLEN(bitlen1 + bitlen2); result = (VarBit *) palloc(bytelen); SET_VARSIZE(result, bytelen); VARBITLEN(result) = bitlen1 + bitlen2; /* Copy the first bitstring in */ memcpy(VARBITS(result), VARBITS(arg1), VARBITBYTES(arg1)); /* Copy the second bit string */ bit1pad = VARBITPAD(arg1); if (bit1pad == 0) { memcpy(VARBITS(result) + VARBITBYTES(arg1), VARBITS(arg2), VARBITBYTES(arg2)); } else if (bitlen2 > 0) { /* We need to shift all the bits to fit */ bit2shift = BITS_PER_BYTE - bit1pad; pr = VARBITS(result) + VARBITBYTES(arg1) - 1; for (pa = VARBITS(arg2); pa < VARBITEND(arg2); pa++) { *pr |= ((*pa >> bit2shift) & BITMASK); pr++; if (pr < VARBITEND(result)) *pr = (*pa << bit1pad) & BITMASK; } } return result; }
bit_catenate(VarBit *arg1, VarBit *arg2) { VarBit *result; int bitlen1, bitlen2, bytelen, bit1pad, bit2shift; bits8 *pr, *pa; bitlen1 = VARBITLEN(arg1); bitlen2 = VARBITLEN(arg2); bytelen = VARBITTOTALLEN(bitlen1 + bitlen2); result = (VarBit *) palloc(bytelen); SET_VARSIZE(result, bytelen); VARBITLEN(result) = bitlen1 + bitlen2; /* Copy the first bitstring in */ memcpy(VARBITS(result), VARBITS(arg1), VARBITBYTES(arg1)); /* Copy the second bit string */ bit1pad = VARBITPAD(arg1); if (bit1pad == 0) { memcpy(VARBITS(result) + VARBITBYTES(arg1), VARBITS(arg2), VARBITBYTES(arg2)); } else if (bitlen2 > 0) { /* We need to shift all the bits to fit */ bit2shift = BITS_PER_BYTE - bit1pad; pr = VARBITS(result) + VARBITBYTES(arg1) - 1; for (pa = VARBITS(arg2); pa < VARBITEND(arg2); pa++) { *pr |= ((*pa >> bit2shift) & BITMASK); pr++; if (pr < VARBITEND(result)) *pr = (*pa << bit1pad) & BITMASK; } } return result; }
C
postgres
1
CVE-2013-0886
https://www.cvedetails.com/cve/CVE-2013-0886/
null
https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76
18d67244984a574ba2dd8779faabc0e3e34f4b76
Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 [email protected] Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98
void RenderProcessHostImpl::OnChannelError() { ProcessDied(true /* already_dead */); }
void RenderProcessHostImpl::OnChannelError() { ProcessDied(true /* already_dead */); }
C
Chrome
0
CVE-2018-13406
https://www.cvedetails.com/cve/CVE-2018-13406/
CWE-190
https://github.com/torvalds/linux/commit/9f645bcc566a1e9f921bdae7528a01ced5bc3713
9f645bcc566a1e9f921bdae7528a01ced5bc3713
video: uvesafb: Fix integer overflow in allocation cmap->len can get close to INT_MAX/2, allowing for an integer overflow in allocation. This uses kmalloc_array() instead to catch the condition. Reported-by: Dr Silvio Cesare of InfoSect <[email protected]> Fixes: 8bdb3a2d7df48 ("uvesafb: the driver core") Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
static int uvesafb_remove(struct platform_device *dev) { struct fb_info *info = platform_get_drvdata(dev); if (info) { struct uvesafb_par *par = info->par; sysfs_remove_group(&dev->dev.kobj, &uvesafb_dev_attgrp); unregister_framebuffer(info); release_region(0x3c0, 32); iounmap(info->screen_base); arch_phys_wc_del(par->mtrr_handle); release_mem_region(info->fix.smem_start, info->fix.smem_len); fb_destroy_modedb(info->monspecs.modedb); fb_dealloc_cmap(&info->cmap); kfree(par->vbe_modes); kfree(par->vbe_state_orig); kfree(par->vbe_state_saved); framebuffer_release(info); } return 0; }
static int uvesafb_remove(struct platform_device *dev) { struct fb_info *info = platform_get_drvdata(dev); if (info) { struct uvesafb_par *par = info->par; sysfs_remove_group(&dev->dev.kobj, &uvesafb_dev_attgrp); unregister_framebuffer(info); release_region(0x3c0, 32); iounmap(info->screen_base); arch_phys_wc_del(par->mtrr_handle); release_mem_region(info->fix.smem_start, info->fix.smem_len); fb_destroy_modedb(info->monspecs.modedb); fb_dealloc_cmap(&info->cmap); kfree(par->vbe_modes); kfree(par->vbe_state_orig); kfree(par->vbe_state_saved); framebuffer_release(info); } return 0; }
C
linux
0
CVE-2016-3880
https://www.cvedetails.com/cve/CVE-2016-3880/
CWE-284
https://android.googlesource.com/platform/frameworks/av/+/68f67ef6cf1f41e77337be3bc4bff91f3a3c6324
68f67ef6cf1f41e77337be3bc4bff91f3a3c6324
Fix corruption via buffer overflow in mediaserver change unbound sprintf() to snprintf() so network-provided values can't overflow the buffers. Applicable to all K/L/M/N branches. Bug: 25747670 Change-Id: Id6a5120c2d08a6fbbd47deffb680ecf82015f4f6
bool ASessionDescription::isValid() const { return mIsValid; }
bool ASessionDescription::isValid() const { return mIsValid; }
C
Android
0
CVE-2016-8633
https://www.cvedetails.com/cve/CVE-2016-8633/
CWE-119
https://github.com/torvalds/linux/commit/667121ace9dbafb368618dbabcf07901c962ddac
667121ace9dbafb368618dbabcf07901c962ddac
firewire: net: guard against rx buffer overflows The IP-over-1394 driver firewire-net lacked input validation when handling incoming fragmented datagrams. A maliciously formed fragment with a respectively large datagram_offset would cause a memcpy past the datagram buffer. So, drop any packets carrying a fragment with offset + length larger than datagram_size. In addition, ensure that - GASP header, unfragmented encapsulation header, or fragment encapsulation header actually exists before we access it, - the encapsulated datagram or fragment is of nonzero size. Reported-by: Eyal Itkin <[email protected]> Reviewed-by: Eyal Itkin <[email protected]> Fixes: CVE 2016-8633 Cc: [email protected] Signed-off-by: Stefan Richter <[email protected]>
static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net) { struct fwnet_header hdr_buf; struct fwnet_device *dev = netdev_priv(net); __be16 proto; u16 dest_node; unsigned max_payload; u16 dg_size; u16 *datagram_label_ptr; struct fwnet_packet_task *ptask; struct fwnet_peer *peer; unsigned long flags; spin_lock_irqsave(&dev->lock, flags); /* Can this happen? */ if (netif_queue_stopped(dev->netdev)) { spin_unlock_irqrestore(&dev->lock, flags); return NETDEV_TX_BUSY; } ptask = kmem_cache_alloc(fwnet_packet_task_cache, GFP_ATOMIC); if (ptask == NULL) goto fail; skb = skb_share_check(skb, GFP_ATOMIC); if (!skb) goto fail; /* * Make a copy of the driver-specific header. * We might need to rebuild the header on tx failure. */ memcpy(&hdr_buf, skb->data, sizeof(hdr_buf)); proto = hdr_buf.h_proto; switch (proto) { case htons(ETH_P_ARP): case htons(ETH_P_IP): #if IS_ENABLED(CONFIG_IPV6) case htons(ETH_P_IPV6): #endif break; default: goto fail; } skb_pull(skb, sizeof(hdr_buf)); dg_size = skb->len; /* * Set the transmission type for the packet. ARP packets and IP * broadcast packets are sent via GASP. */ if (fwnet_hwaddr_is_multicast(hdr_buf.h_dest)) { max_payload = dev->broadcast_xmt_max_payload; datagram_label_ptr = &dev->broadcast_xmt_datagramlabel; ptask->fifo_addr = FWNET_NO_FIFO_ADDR; ptask->generation = 0; ptask->dest_node = IEEE1394_ALL_NODES; ptask->speed = SCODE_100; } else { union fwnet_hwaddr *ha = (union fwnet_hwaddr *)hdr_buf.h_dest; __be64 guid = get_unaligned(&ha->uc.uniq_id); u8 generation; peer = fwnet_peer_find_by_guid(dev, be64_to_cpu(guid)); if (!peer) goto fail; generation = peer->generation; dest_node = peer->node_id; max_payload = peer->max_payload; datagram_label_ptr = &peer->datagram_label; ptask->fifo_addr = fwnet_hwaddr_fifo(ha); ptask->generation = generation; ptask->dest_node = dest_node; ptask->speed = peer->speed; } ptask->hdr.w0 = 0; ptask->hdr.w1 = 0; ptask->skb = skb; ptask->dev = dev; /* Does it all fit in one packet? */ if (dg_size <= max_payload) { fwnet_make_uf_hdr(&ptask->hdr, ntohs(proto)); ptask->outstanding_pkts = 1; max_payload = dg_size + RFC2374_UNFRAG_HDR_SIZE; } else { u16 datagram_label; max_payload -= RFC2374_FRAG_OVERHEAD; datagram_label = (*datagram_label_ptr)++; fwnet_make_ff_hdr(&ptask->hdr, ntohs(proto), dg_size, datagram_label); ptask->outstanding_pkts = DIV_ROUND_UP(dg_size, max_payload); max_payload += RFC2374_FRAG_HDR_SIZE; } if (++dev->queued_datagrams == FWNET_MAX_QUEUED_DATAGRAMS) netif_stop_queue(dev->netdev); spin_unlock_irqrestore(&dev->lock, flags); ptask->max_payload = max_payload; ptask->enqueued = 0; fwnet_send_packet(ptask); return NETDEV_TX_OK; fail: spin_unlock_irqrestore(&dev->lock, flags); if (ptask) kmem_cache_free(fwnet_packet_task_cache, ptask); if (skb != NULL) dev_kfree_skb(skb); net->stats.tx_dropped++; net->stats.tx_errors++; /* * FIXME: According to a patch from 2003-02-26, "returning non-zero * causes serious problems" here, allegedly. Before that patch, * -ERRNO was returned which is not appropriate under Linux 2.6. * Perhaps more needs to be done? Stop the queue in serious * conditions and restart it elsewhere? */ return NETDEV_TX_OK; }
static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net) { struct fwnet_header hdr_buf; struct fwnet_device *dev = netdev_priv(net); __be16 proto; u16 dest_node; unsigned max_payload; u16 dg_size; u16 *datagram_label_ptr; struct fwnet_packet_task *ptask; struct fwnet_peer *peer; unsigned long flags; spin_lock_irqsave(&dev->lock, flags); /* Can this happen? */ if (netif_queue_stopped(dev->netdev)) { spin_unlock_irqrestore(&dev->lock, flags); return NETDEV_TX_BUSY; } ptask = kmem_cache_alloc(fwnet_packet_task_cache, GFP_ATOMIC); if (ptask == NULL) goto fail; skb = skb_share_check(skb, GFP_ATOMIC); if (!skb) goto fail; /* * Make a copy of the driver-specific header. * We might need to rebuild the header on tx failure. */ memcpy(&hdr_buf, skb->data, sizeof(hdr_buf)); proto = hdr_buf.h_proto; switch (proto) { case htons(ETH_P_ARP): case htons(ETH_P_IP): #if IS_ENABLED(CONFIG_IPV6) case htons(ETH_P_IPV6): #endif break; default: goto fail; } skb_pull(skb, sizeof(hdr_buf)); dg_size = skb->len; /* * Set the transmission type for the packet. ARP packets and IP * broadcast packets are sent via GASP. */ if (fwnet_hwaddr_is_multicast(hdr_buf.h_dest)) { max_payload = dev->broadcast_xmt_max_payload; datagram_label_ptr = &dev->broadcast_xmt_datagramlabel; ptask->fifo_addr = FWNET_NO_FIFO_ADDR; ptask->generation = 0; ptask->dest_node = IEEE1394_ALL_NODES; ptask->speed = SCODE_100; } else { union fwnet_hwaddr *ha = (union fwnet_hwaddr *)hdr_buf.h_dest; __be64 guid = get_unaligned(&ha->uc.uniq_id); u8 generation; peer = fwnet_peer_find_by_guid(dev, be64_to_cpu(guid)); if (!peer) goto fail; generation = peer->generation; dest_node = peer->node_id; max_payload = peer->max_payload; datagram_label_ptr = &peer->datagram_label; ptask->fifo_addr = fwnet_hwaddr_fifo(ha); ptask->generation = generation; ptask->dest_node = dest_node; ptask->speed = peer->speed; } ptask->hdr.w0 = 0; ptask->hdr.w1 = 0; ptask->skb = skb; ptask->dev = dev; /* Does it all fit in one packet? */ if (dg_size <= max_payload) { fwnet_make_uf_hdr(&ptask->hdr, ntohs(proto)); ptask->outstanding_pkts = 1; max_payload = dg_size + RFC2374_UNFRAG_HDR_SIZE; } else { u16 datagram_label; max_payload -= RFC2374_FRAG_OVERHEAD; datagram_label = (*datagram_label_ptr)++; fwnet_make_ff_hdr(&ptask->hdr, ntohs(proto), dg_size, datagram_label); ptask->outstanding_pkts = DIV_ROUND_UP(dg_size, max_payload); max_payload += RFC2374_FRAG_HDR_SIZE; } if (++dev->queued_datagrams == FWNET_MAX_QUEUED_DATAGRAMS) netif_stop_queue(dev->netdev); spin_unlock_irqrestore(&dev->lock, flags); ptask->max_payload = max_payload; ptask->enqueued = 0; fwnet_send_packet(ptask); return NETDEV_TX_OK; fail: spin_unlock_irqrestore(&dev->lock, flags); if (ptask) kmem_cache_free(fwnet_packet_task_cache, ptask); if (skb != NULL) dev_kfree_skb(skb); net->stats.tx_dropped++; net->stats.tx_errors++; /* * FIXME: According to a patch from 2003-02-26, "returning non-zero * causes serious problems" here, allegedly. Before that patch, * -ERRNO was returned which is not appropriate under Linux 2.6. * Perhaps more needs to be done? Stop the queue in serious * conditions and restart it elsewhere? */ return NETDEV_TX_OK; }
C
linux
0
CVE-2011-3896
https://www.cvedetails.com/cve/CVE-2011-3896/
CWE-119
https://github.com/chromium/chromium/commit/5925dff83699508b5e2735afb0297dfb310e159d
5925dff83699508b5e2735afb0297dfb310e159d
Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFullScreen(), telling the user how to exit fullscreen. This is implemented as an NSView rather than an NSWindow because the floating chrome that appears in presentation mode should overlap the bubble. Content-initiated fullscreen mode makes use of 'presentation mode' on the Mac: the mode in which the UI is hidden, accessible by moving the cursor to the top of the screen. On Snow Leopard, this mode is synonymous with fullscreen mode. On Lion, however, fullscreen mode does not imply presentation mode: in non-presentation fullscreen mode, the chrome is permanently shown. It is possible to switch between presentation mode and fullscreen mode using the presentation mode UI control. When a tab initiates fullscreen mode on Lion, we enter presentation mode if not in presentation mode already. When the user exits fullscreen mode using Chrome UI (i.e. keyboard shortcuts, menu items, buttons, switching tabs, etc.) we return the user to the mode they were in before the tab entered fullscreen. BUG=14471 TEST=Enter fullscreen mode using webkitRequestFullScreen. You should see a bubble pop down from the top of the screen. Need to test the Lion logic somehow, with no Lion trybots. BUG=96883 Original review http://codereview.chromium.org/7890056/ TBR=thakis Review URL: http://codereview.chromium.org/7920024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101624 0039d316-1c4b-4281-b951-d872f2087c98
TabContents* Browser::OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { return OpenURLFromTab(NULL, OpenURLParams(url, referrer, disposition, transition)); }
TabContents* Browser::OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { return OpenURLFromTab(NULL, OpenURLParams(url, referrer, disposition, transition)); }
C
Chrome
0
CVE-2018-14395
https://www.cvedetails.com/cve/CVE-2018-14395/
CWE-369
https://github.com/FFmpeg/FFmpeg/commit/fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
avformat/movenc: Write version 2 of audio atom if channels is not known The version 1 needs the channel count and would divide by 0 Fixes: division by 0 Fixes: fpe_movenc.c_1108_1.ogg Fixes: fpe_movenc.c_1108_2.ogg Fixes: fpe_movenc.c_1108_3.wav Found-by: #CHEN HONGXU# <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
static int mov_write_raw_metadata_tag(AVFormatContext *s, AVIOContext *pb, const char *name, const char *key) { int len; AVDictionaryEntry *t; if (!(t = av_dict_get(s->metadata, key, NULL, 0))) return 0; len = strlen(t->value); if (len > 0) { int size = len + 8; avio_wb32(pb, size); ffio_wfourcc(pb, name); avio_write(pb, t->value, len); return size; } return 0; }
static int mov_write_raw_metadata_tag(AVFormatContext *s, AVIOContext *pb, const char *name, const char *key) { int len; AVDictionaryEntry *t; if (!(t = av_dict_get(s->metadata, key, NULL, 0))) return 0; len = strlen(t->value); if (len > 0) { int size = len + 8; avio_wb32(pb, size); ffio_wfourcc(pb, name); avio_write(pb, t->value, len); return size; } return 0; }
C
FFmpeg
0
CVE-2017-9059
https://www.cvedetails.com/cve/CVE-2017-9059/
CWE-404
https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1
c70422f760c120480fee4de6c38804c72aa26bc1
Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ...
nfs4_find_file(struct nfs4_stid *s, int flags) { if (!s) return NULL; switch (s->sc_type) { case NFS4_DELEG_STID: if (WARN_ON_ONCE(!s->sc_file->fi_deleg_file)) return NULL; return get_file(s->sc_file->fi_deleg_file); case NFS4_OPEN_STID: case NFS4_LOCK_STID: if (flags & RD_STATE) return find_readable_file(s->sc_file); else return find_writeable_file(s->sc_file); break; } return NULL; }
nfs4_find_file(struct nfs4_stid *s, int flags) { if (!s) return NULL; switch (s->sc_type) { case NFS4_DELEG_STID: if (WARN_ON_ONCE(!s->sc_file->fi_deleg_file)) return NULL; return get_file(s->sc_file->fi_deleg_file); case NFS4_OPEN_STID: case NFS4_LOCK_STID: if (flags & RD_STATE) return find_readable_file(s->sc_file); else return find_writeable_file(s->sc_file); break; } return NULL; }
C
linux
0
CVE-2011-4324
https://www.cvedetails.com/cve/CVE-2011-4324/
null
https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
NFSv4: Convert the open and close ops to use fmode Signed-off-by: Trond Myklebust <[email protected]>
static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) { __be32 *p; *res = 0; if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) { READ_BUF(4); READ32(*res); bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; } dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); return 0; }
static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) { __be32 *p; *res = 0; if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) { READ_BUF(4); READ32(*res); bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; } dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/a3e2afaedd8190398ae45ccef34fcdee00fb19aa
a3e2afaedd8190398ae45ccef34fcdee00fb19aa
Fixed crash related to cellular network payment plan retreival. BUG=chromium-os:8864 TEST=none Review URL: http://codereview.chromium.org/4690002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65405 0039d316-1c4b-4281-b951-d872f2087c98
virtual void RefreshCellularDataPlans(const CellularNetwork* network) {}
virtual void RefreshCellularDataPlans(const CellularNetwork* network) {}
C
Chrome
0
CVE-2019-1010295
https://www.cvedetails.com/cve/CVE-2019-1010295/
CWE-119
https://github.com/OP-TEE/optee_os/commit/d5c5b0b77b2b589666024d219a8007b3f5b6faeb
d5c5b0b77b2b589666024d219a8007b3f5b6faeb
core: svc: always check ta parameters Always check TA parameters from a user TA. This prevents a user TA from passing invalid pointers to a pseudo TA. Fixes: OP-TEE-2018-0007: "Buffer checks missing when calling pseudo TAs". Signed-off-by: Jens Wiklander <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Joakim Bech <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
static TEE_Result get_prop_tee_dev_id(struct tee_ta_session *sess __unused, void *buf, size_t *blen) { TEE_Result res; TEE_UUID uuid; const size_t nslen = 5; uint8_t data[5 + FVR_DIE_ID_NUM_REGS * sizeof(uint32_t)] = { 'O', 'P', 'T', 'E', 'E' }; if (*blen < sizeof(uuid)) { *blen = sizeof(uuid); return TEE_ERROR_SHORT_BUFFER; } *blen = sizeof(uuid); if (tee_otp_get_die_id(data + nslen, sizeof(data) - nslen)) return TEE_ERROR_BAD_STATE; res = tee_hash_createdigest(TEE_ALG_SHA256, data, sizeof(data), (uint8_t *)&uuid, sizeof(uuid)); if (res != TEE_SUCCESS) return TEE_ERROR_BAD_STATE; /* * Changes the random value into and UUID as specifiec * in RFC 4122. The magic values are from the example * code in the RFC. * * TEE_UUID is defined slightly different from the RFC, * but close enough for our purpose. */ uuid.timeHiAndVersion &= 0x0fff; uuid.timeHiAndVersion |= 5 << 12; /* uuid.clock_seq_hi_and_reserved in the RFC */ uuid.clockSeqAndNode[0] &= 0x3f; uuid.clockSeqAndNode[0] |= 0x80; return tee_svc_copy_to_user(buf, &uuid, sizeof(TEE_UUID)); }
static TEE_Result get_prop_tee_dev_id(struct tee_ta_session *sess __unused, void *buf, size_t *blen) { TEE_Result res; TEE_UUID uuid; const size_t nslen = 5; uint8_t data[5 + FVR_DIE_ID_NUM_REGS * sizeof(uint32_t)] = { 'O', 'P', 'T', 'E', 'E' }; if (*blen < sizeof(uuid)) { *blen = sizeof(uuid); return TEE_ERROR_SHORT_BUFFER; } *blen = sizeof(uuid); if (tee_otp_get_die_id(data + nslen, sizeof(data) - nslen)) return TEE_ERROR_BAD_STATE; res = tee_hash_createdigest(TEE_ALG_SHA256, data, sizeof(data), (uint8_t *)&uuid, sizeof(uuid)); if (res != TEE_SUCCESS) return TEE_ERROR_BAD_STATE; /* * Changes the random value into and UUID as specifiec * in RFC 4122. The magic values are from the example * code in the RFC. * * TEE_UUID is defined slightly different from the RFC, * but close enough for our purpose. */ uuid.timeHiAndVersion &= 0x0fff; uuid.timeHiAndVersion |= 5 << 12; /* uuid.clock_seq_hi_and_reserved in the RFC */ uuid.clockSeqAndNode[0] &= 0x3f; uuid.clockSeqAndNode[0] |= 0x80; return tee_svc_copy_to_user(buf, &uuid, sizeof(TEE_UUID)); }
C
optee_os
0
CVE-2014-9710
https://www.cvedetails.com/cve/CVE-2014-9710/
CWE-362
https://github.com/torvalds/linux/commit/5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339
5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339
Btrfs: make xattr replace operations atomic Replacing a xattr consists of doing a lookup for its existing value, delete the current value from the respective leaf, release the search path and then finally insert the new value. This leaves a time window where readers (getxattr, listxattrs) won't see any value for the xattr. Xattrs are used to store ACLs, so this has security implications. This change also fixes 2 other existing issues which were: *) Deleting the old xattr value without verifying first if the new xattr will fit in the existing leaf item (in case multiple xattrs are packed in the same item due to name hash collision); *) Returning -EEXIST when the flag XATTR_CREATE is given and the xattr doesn't exist but we have have an existing item that packs muliple xattrs with the same name hash as the input xattr. In this case we should return ENOSPC. A test case for xfstests follows soon. Thanks to Alexandre Oliva for reporting the non-atomicity of the xattr replace implementation. Reported-by: Alexandre Oliva <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: Chris Mason <[email protected]>
static noinline void reada_for_balance(struct btrfs_root *root, struct btrfs_path *path, int level) { int slot; int nritems; struct extent_buffer *parent; struct extent_buffer *eb; u64 gen; u64 block1 = 0; u64 block2 = 0; int blocksize; parent = path->nodes[level + 1]; if (!parent) return; nritems = btrfs_header_nritems(parent); slot = path->slots[level + 1]; blocksize = root->nodesize; if (slot > 0) { block1 = btrfs_node_blockptr(parent, slot - 1); gen = btrfs_node_ptr_generation(parent, slot - 1); eb = btrfs_find_tree_block(root, block1); /* * if we get -eagain from btrfs_buffer_uptodate, we * don't want to return eagain here. That will loop * forever */ if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) block1 = 0; free_extent_buffer(eb); } if (slot + 1 < nritems) { block2 = btrfs_node_blockptr(parent, slot + 1); gen = btrfs_node_ptr_generation(parent, slot + 1); eb = btrfs_find_tree_block(root, block2); if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) block2 = 0; free_extent_buffer(eb); } if (block1) readahead_tree_block(root, block1, blocksize); if (block2) readahead_tree_block(root, block2, blocksize); }
static noinline void reada_for_balance(struct btrfs_root *root, struct btrfs_path *path, int level) { int slot; int nritems; struct extent_buffer *parent; struct extent_buffer *eb; u64 gen; u64 block1 = 0; u64 block2 = 0; int blocksize; parent = path->nodes[level + 1]; if (!parent) return; nritems = btrfs_header_nritems(parent); slot = path->slots[level + 1]; blocksize = root->nodesize; if (slot > 0) { block1 = btrfs_node_blockptr(parent, slot - 1); gen = btrfs_node_ptr_generation(parent, slot - 1); eb = btrfs_find_tree_block(root, block1); /* * if we get -eagain from btrfs_buffer_uptodate, we * don't want to return eagain here. That will loop * forever */ if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) block1 = 0; free_extent_buffer(eb); } if (slot + 1 < nritems) { block2 = btrfs_node_blockptr(parent, slot + 1); gen = btrfs_node_ptr_generation(parent, slot + 1); eb = btrfs_find_tree_block(root, block2); if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) block2 = 0; free_extent_buffer(eb); } if (block1) readahead_tree_block(root, block1, blocksize); if (block2) readahead_tree_block(root, block2, blocksize); }
C
linux
0
CVE-2014-2669
https://www.cvedetails.com/cve/CVE-2014-2669/
CWE-189
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
31400a673325147e1205326008e32135a78b4d8a
Predict integer overflow to avoid buffer overruns. Several functions, mostly type input functions, calculated an allocation size such that the calculation wrapped to a small positive value when arguments implied a sufficiently-large requirement. Writes past the end of the inadvertent small allocation followed shortly thereafter. Coverity identified the path_in() vulnerability; code inspection led to the rest. In passing, add check_stack_depth() to prevent stack overflow in related functions. Back-patch to 8.4 (all supported versions). The non-comment hstore changes touch code that did not exist in 8.4, so that part stops at 9.0. Noah Misch and Heikki Linnakangas, reviewed by Tom Lane. Security: CVE-2014-0064
circle_right(PG_FUNCTION_ARGS) { CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); PG_RETURN_BOOL(FPgt((circle1->center.x - circle1->radius), (circle2->center.x + circle2->radius))); }
circle_right(PG_FUNCTION_ARGS) { CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); PG_RETURN_BOOL(FPgt((circle1->center.x - circle1->radius), (circle2->center.x + circle2->radius))); }
C
postgres
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 <[email protected]> Commit-Queue: Ken Rockot <[email protected]> Commit-Queue: Fernando Serboncini <[email protected]> Auto-Submit: Fernando Serboncini <[email protected]> Cr-Commit-Position: refs/heads/master@{#635833}
void HTMLCanvasElement::RemoveListener(CanvasDrawListener* listener) { listeners_.erase(listener); }
void HTMLCanvasElement::RemoveListener(CanvasDrawListener* listener) { listeners_.erase(listener); }
C
Chrome
0
CVE-2015-1278
https://www.cvedetails.com/cve/CVE-2015-1278/
CWE-254
https://github.com/chromium/chromium/commit/784f56a9c97a838448dd23f9bdc7c05fe8e639b3
784f56a9c97a838448dd23f9bdc7c05fe8e639b3
Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f Reviewed-on: https://chromium-review.googlesource.com/482380 Commit-Queue: Ian Clelland <[email protected]> Reviewed-by: Charles Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#466778}
cc::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() { return frame_sink_id_; }
cc::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() { return frame_sink_id_; }
C
Chrome
0
CVE-2016-7166
https://www.cvedetails.com/cve/CVE-2016-7166/
CWE-399
https://github.com/libarchive/libarchive/commit/6e06b1c89dd0d16f74894eac4cfc1327a06ee4a0
6e06b1c89dd0d16f74894eac4cfc1327a06ee4a0
Fix a potential crash issue discovered by Alexander Cherepanov: It seems bsdtar automatically handles stacked compression. This is a nice feature but it could be problematic when it's completely unlimited. Most clearly it's illustrated with quines: $ curl -sRO http://www.maximumcompression.com/selfgz.gz $ (ulimit -v 10000000 && bsdtar -tvf selfgz.gz) bsdtar: Error opening archive: Can't allocate data for gzip decompression Without ulimit, bsdtar will eat all available memory. This could also be a problem for other applications using libarchive.
archive_read_open(struct archive *a, void *client_data, archive_open_callback *client_opener, archive_read_callback *client_reader, archive_close_callback *client_closer) { /* Old archive_read_open() is just a thin shell around * archive_read_open1. */ archive_read_set_open_callback(a, client_opener); archive_read_set_read_callback(a, client_reader); archive_read_set_close_callback(a, client_closer); archive_read_set_callback_data(a, client_data); return archive_read_open1(a); }
archive_read_open(struct archive *a, void *client_data, archive_open_callback *client_opener, archive_read_callback *client_reader, archive_close_callback *client_closer) { /* Old archive_read_open() is just a thin shell around * archive_read_open1. */ archive_read_set_open_callback(a, client_opener); archive_read_set_read_callback(a, client_reader); archive_read_set_close_callback(a, client_closer); archive_read_set_callback_data(a, client_data); return archive_read_open1(a); }
C
libarchive
0
null
null
null
https://github.com/chromium/chromium/commit/ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e
ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e
Clean up calls like "gfx::Rect(0, 0, size().width(), size().height()". The caller can use the much shorter "gfx::Rect(size())", since gfx::Rect has a constructor that just takes a Size. BUG=none TEST=none Review URL: http://codereview.chromium.org/2204001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48283 0039d316-1c4b-4281-b951-d872f2087c98
NPError WebPluginDelegatePepper::Device3DGetConfigAttribs( int32 config, int32* attrib_list) { if (config != 0) return NPERR_GENERIC_ERROR; if (attrib_list) { for (int32* attrib_pair = attrib_list; *attrib_pair; attrib_pair += 2) { switch (attrib_pair[0]) { case NP3DAttrib_BufferSize: attrib_pair[1] = 32; break; case NP3DAttrib_AlphaSize: case NP3DAttrib_BlueSize: case NP3DAttrib_GreenSize: case NP3DAttrib_RedSize: attrib_pair[1] = 8; break; case NP3DAttrib_DepthSize: attrib_pair[1] = 24; break; case NP3DAttrib_StencilSize: attrib_pair[1] = 8; break; case NP3DAttrib_SurfaceType: attrib_pair[1] = 0; break; default: return NPERR_GENERIC_ERROR; } } } return NPERR_NO_ERROR; }
NPError WebPluginDelegatePepper::Device3DGetConfigAttribs( int32 config, int32* attrib_list) { if (config != 0) return NPERR_GENERIC_ERROR; if (attrib_list) { for (int32* attrib_pair = attrib_list; *attrib_pair; attrib_pair += 2) { switch (attrib_pair[0]) { case NP3DAttrib_BufferSize: attrib_pair[1] = 32; break; case NP3DAttrib_AlphaSize: case NP3DAttrib_BlueSize: case NP3DAttrib_GreenSize: case NP3DAttrib_RedSize: attrib_pair[1] = 8; break; case NP3DAttrib_DepthSize: attrib_pair[1] = 24; break; case NP3DAttrib_StencilSize: attrib_pair[1] = 8; break; case NP3DAttrib_SurfaceType: attrib_pair[1] = 0; break; default: return NPERR_GENERIC_ERROR; } } } return NPERR_NO_ERROR; }
C
Chrome
0
CVE-2017-6903
https://www.cvedetails.com/cve/CVE-2017-6903/
CWE-269
https://github.com/ioquake/ioq3/commit/376267d534476a875d8b9228149c4ee18b74a4fd
376267d534476a875d8b9228149c4ee18b74a4fd
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
static long FS_HashFileName( const char *fname, int hashSize ) { int i; long hash; char letter; hash = 0; i = 0; while (fname[i] != '\0') { letter = tolower(fname[i]); if (letter =='.') break; // don't include extension if (letter =='\\') letter = '/'; // damn path names if (letter == PATH_SEP) letter = '/'; // damn path names hash+=(long)(letter)*(i+119); i++; } hash = (hash ^ (hash >> 10) ^ (hash >> 20)); hash &= (hashSize-1); return hash; }
static long FS_HashFileName( const char *fname, int hashSize ) { int i; long hash; char letter; hash = 0; i = 0; while (fname[i] != '\0') { letter = tolower(fname[i]); if (letter =='.') break; // don't include extension if (letter =='\\') letter = '/'; // damn path names if (letter == PATH_SEP) letter = '/'; // damn path names hash+=(long)(letter)*(i+119); i++; } hash = (hash ^ (hash >> 10) ^ (hash >> 20)); hash &= (hashSize-1); return hash; }
C
OpenJK
0
CVE-2016-3913
https://www.cvedetails.com/cve/CVE-2016-3913/
CWE-264
https://android.googlesource.com/platform/frameworks/av/+/0c3b93c8c2027e74af642967eee5c142c8fd185d
0c3b93c8c2027e74af642967eee5c142c8fd185d
MediaPlayerService: avoid invalid static cast Bug: 30204103 Change-Id: Ie0dd3568a375f1e9fed8615ad3d85184bcc99028 (cherry picked from commit ee0a0e39acdcf8f97e0d6945c31ff36a06a36e9d)
Antagonizer::Antagonizer(notify_callback_f cb, void* client) : mExit(false), mActive(false), mClient(client), mCb(cb) { createThread(callbackThread, this); }
Antagonizer::Antagonizer(notify_callback_f cb, void* client) : mExit(false), mActive(false), mClient(client), mCb(cb) { createThread(callbackThread, this); }
C
Android
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
ScopedRenderBufferBinder::ScopedRenderBufferBinder(ContextState* state, ErrorState* error_state, GLuint id) : state_(state), error_state_(error_state) { ScopedGLErrorSuppressor suppressor("ScopedRenderBufferBinder::ctor", error_state_); state->api()->glBindRenderbufferEXTFn(GL_RENDERBUFFER, id); }
ScopedRenderBufferBinder::ScopedRenderBufferBinder(ContextState* state, ErrorState* error_state, GLuint id) : state_(state), error_state_(error_state) { ScopedGLErrorSuppressor suppressor("ScopedRenderBufferBinder::ctor", error_state_); state->api()->glBindRenderbufferEXTFn(GL_RENDERBUFFER, id); }
C
Chrome
0
CVE-2017-6594
https://www.cvedetails.com/cve/CVE-2017-6594/
CWE-295
https://github.com/heimdal/heimdal/commit/b1e699103f08d6a0ca46a122193c9da65f6cf837
b1e699103f08d6a0ca46a122193c9da65f6cf837
Fix transit path validation CVE-2017-6594 Commit f469fc6 (2010-10-02) inadvertently caused the previous hop realm to not be added to the transit path of issued tickets. This may, in some cases, enable bypass of capath policy in Heimdal versions 1.5 through 7.2. Note, this may break sites that rely on the bug. With the bug some incomplete [capaths] worked, that should not have. These may now break authentication in some cross-realm configurations.
build_server_referral(krb5_context context, krb5_kdc_configuration *config, krb5_crypto session, krb5_const_realm referred_realm, const PrincipalName *true_principal_name, const PrincipalName *requested_principal, krb5_data *outdata) { PA_ServerReferralData ref; krb5_error_code ret; EncryptedData ed; krb5_data data; size_t size = 0; memset(&ref, 0, sizeof(ref)); if (referred_realm) { ALLOC(ref.referred_realm); if (ref.referred_realm == NULL) goto eout; *ref.referred_realm = strdup(referred_realm); if (*ref.referred_realm == NULL) goto eout; } if (true_principal_name) { ALLOC(ref.true_principal_name); if (ref.true_principal_name == NULL) goto eout; ret = copy_PrincipalName(true_principal_name, ref.true_principal_name); if (ret) goto eout; } if (requested_principal) { ALLOC(ref.requested_principal_name); if (ref.requested_principal_name == NULL) goto eout; ret = copy_PrincipalName(requested_principal, ref.requested_principal_name); if (ret) goto eout; } ASN1_MALLOC_ENCODE(PA_ServerReferralData, data.data, data.length, &ref, &size, ret); free_PA_ServerReferralData(&ref); if (ret) return ret; if (data.length != size) krb5_abortx(context, "internal asn.1 encoder error"); ret = krb5_encrypt_EncryptedData(context, session, KRB5_KU_PA_SERVER_REFERRAL, data.data, data.length, 0 /* kvno */, &ed); free(data.data); if (ret) return ret; ASN1_MALLOC_ENCODE(EncryptedData, outdata->data, outdata->length, &ed, &size, ret); free_EncryptedData(&ed); if (ret) return ret; if (outdata->length != size) krb5_abortx(context, "internal asn.1 encoder error"); return 0; eout: free_PA_ServerReferralData(&ref); krb5_set_error_message(context, ENOMEM, "malloc: out of memory"); return ENOMEM; }
build_server_referral(krb5_context context, krb5_kdc_configuration *config, krb5_crypto session, krb5_const_realm referred_realm, const PrincipalName *true_principal_name, const PrincipalName *requested_principal, krb5_data *outdata) { PA_ServerReferralData ref; krb5_error_code ret; EncryptedData ed; krb5_data data; size_t size = 0; memset(&ref, 0, sizeof(ref)); if (referred_realm) { ALLOC(ref.referred_realm); if (ref.referred_realm == NULL) goto eout; *ref.referred_realm = strdup(referred_realm); if (*ref.referred_realm == NULL) goto eout; } if (true_principal_name) { ALLOC(ref.true_principal_name); if (ref.true_principal_name == NULL) goto eout; ret = copy_PrincipalName(true_principal_name, ref.true_principal_name); if (ret) goto eout; } if (requested_principal) { ALLOC(ref.requested_principal_name); if (ref.requested_principal_name == NULL) goto eout; ret = copy_PrincipalName(requested_principal, ref.requested_principal_name); if (ret) goto eout; } ASN1_MALLOC_ENCODE(PA_ServerReferralData, data.data, data.length, &ref, &size, ret); free_PA_ServerReferralData(&ref); if (ret) return ret; if (data.length != size) krb5_abortx(context, "internal asn.1 encoder error"); ret = krb5_encrypt_EncryptedData(context, session, KRB5_KU_PA_SERVER_REFERRAL, data.data, data.length, 0 /* kvno */, &ed); free(data.data); if (ret) return ret; ASN1_MALLOC_ENCODE(EncryptedData, outdata->data, outdata->length, &ed, &size, ret); free_EncryptedData(&ed); if (ret) return ret; if (outdata->length != size) krb5_abortx(context, "internal asn.1 encoder error"); return 0; eout: free_PA_ServerReferralData(&ref); krb5_set_error_message(context, ENOMEM, "malloc: out of memory"); return ENOMEM; }
C
heimdal
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/3475f5e448ddf5e48888f3d0563245cc46e3c98b
3475f5e448ddf5e48888f3d0563245cc46e3c98b
ash: Add launcher overflow bubble. - Host a LauncherView in bubble to display overflown items; - Mouse wheel and two-finger scroll to scroll the LauncherView in bubble in case overflow bubble is overflown; - Fit bubble when items are added/removed; - Keep launcher bar on screen when the bubble is shown; BUG=128054 TEST=Verify launcher overflown items are in a bubble instead of menu. Review URL: https://chromiumcodereview.appspot.com/10659003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146460 0039d316-1c4b-4281-b951-d872f2087c98
void LauncherView::ConfigureChildView(views::View* view) { view->SetPaintToLayer(true); view->layer()->SetFillsBoundsOpaquely(false); }
void LauncherView::ConfigureChildView(views::View* view) { view->SetPaintToLayer(true); view->layer()->SetFillsBoundsOpaquely(false); }
C
Chrome
0
CVE-2011-2804
https://www.cvedetails.com/cve/CVE-2011-2804/
CWE-399
https://github.com/chromium/chromium/commit/dc7b094a338c6c521f918f478e993f0f74bbea0d
dc7b094a338c6c521f918f478e993f0f74bbea0d
Remove use of libcros from InputMethodLibrary. BUG=chromium-os:16238 TEST==confirm that input methods work as before on the netbook. Also confirm that the chrome builds and works on the desktop as before. Review URL: http://codereview.chromium.org/7003086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89142 0039d316-1c4b-4281-b951-d872f2087c98
bool IBusConnectionsAreAlive() { return ibus_ && ibus_bus_is_connected(ibus_) && ibus_config_; }
bool IBusConnectionsAreAlive() { return ibus_ && ibus_bus_is_connected(ibus_) && ibus_config_; }
C
Chrome
0
CVE-2013-2878
https://www.cvedetails.com/cve/CVE-2013-2878/
CWE-119
https://github.com/chromium/chromium/commit/09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
Upgrade a TextIterator ASSERT to a RELEASE_ASSERT as a defensive measure. BUG=156930,177197 [email protected] Review URL: https://codereview.chromium.org/15057010 git-svn-id: svn://svn.chromium.org/blink/trunk@150123 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool TextIterator::hasVisibleTextNode(RenderText* renderer) { if (renderer->style()->visibility() == VISIBLE) return true; if (renderer->isTextFragment()) { RenderTextFragment* fragment = static_cast<RenderTextFragment*>(renderer); if (fragment->firstLetter() && fragment->firstLetter()->style()->visibility() == VISIBLE) return true; } return false; }
bool TextIterator::hasVisibleTextNode(RenderText* renderer) { if (renderer->style()->visibility() == VISIBLE) return true; if (renderer->isTextFragment()) { RenderTextFragment* fragment = static_cast<RenderTextFragment*>(renderer); if (fragment->firstLetter() && fragment->firstLetter()->style()->visibility() == VISIBLE) return true; } return false; }
C
Chrome
0
CVE-2011-1292
https://www.cvedetails.com/cve/CVE-2011-1292/
CWE-399
https://github.com/chromium/chromium/commit/5f372f899b8709dac700710b5f0f90959dcf9ecb
5f372f899b8709dac700710b5f0f90959dcf9ecb
Add support for autofill server experiments BUG=none TEST=unit_tests --gtest_filter=AutoFillMetricsTest.QualityMetricsWithExperimentId:AutoFillQueryXmlParserTest.ParseExperimentId Review URL: http://codereview.chromium.org/6260027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73216 0039d316-1c4b-4281-b951-d872f2087c98
explicit TestFormStructure(const FormData& form) : FormStructure(form) {}
explicit TestFormStructure(const FormData& form) : FormStructure(form) {}
C
Chrome
0
CVE-2016-1583
https://www.cvedetails.com/cve/CVE-2016-1583/
CWE-119
https://github.com/torvalds/linux/commit/f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
Merge branch 'stacking-fixes' (vfs stacking fixes from Jann) Merge filesystem stacking fixes from Jann Horn. * emailed patches from Jann Horn <[email protected]>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top
int sched_rr_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int ret; static DEFINE_MUTEX(mutex); mutex_lock(&mutex); ret = proc_dointvec(table, write, buffer, lenp, ppos); /* make sure that internally we keep jiffies */ /* also, writing zero resets timeslice to default */ if (!ret && write) { sched_rr_timeslice = sched_rr_timeslice <= 0 ? RR_TIMESLICE : msecs_to_jiffies(sched_rr_timeslice); } mutex_unlock(&mutex); return ret; }
int sched_rr_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int ret; static DEFINE_MUTEX(mutex); mutex_lock(&mutex); ret = proc_dointvec(table, write, buffer, lenp, ppos); /* make sure that internally we keep jiffies */ /* also, writing zero resets timeslice to default */ if (!ret && write) { sched_rr_timeslice = sched_rr_timeslice <= 0 ? RR_TIMESLICE : msecs_to_jiffies(sched_rr_timeslice); } mutex_unlock(&mutex); return ret; }
C
linux
0
CVE-2009-3605
https://www.cvedetails.com/cve/CVE-2009-3605/
CWE-189
https://cgit.freedesktop.org/poppler/poppler/commit/?id=9cf2325fb22f812b31858e519411f57747d39bd8
9cf2325fb22f812b31858e519411f57747d39bd8
null
SplashError Splash::fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font) { SplashGlyphBitmap glyph; SplashCoord xt, yt; int x0, y0, xFrac, yFrac; SplashClipResult clipRes; if (debugMode) { printf("fillChar: x=%.2f y=%.2f c=%3d=0x%02x='%c'\n", (double)x, (double)y, c, c, c); } transform(state->matrix, x, y, &xt, &yt); x0 = splashFloor(xt); xFrac = splashFloor((xt - x0) * splashFontFraction); y0 = splashFloor(yt); yFrac = splashFloor((yt - y0) * splashFontFraction); if (!font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip, &clipRes)) { return splashErrNoGlyph; } if (clipRes != splashClipAllOutside) { fillGlyph2(x0, y0, &glyph, clipRes == splashClipAllInside); } opClipRes = clipRes; if (glyph.freeData) { gfree(glyph.data); } return splashOk; }
SplashError Splash::fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font) { SplashGlyphBitmap glyph; SplashCoord xt, yt; int x0, y0, xFrac, yFrac; SplashClipResult clipRes; if (debugMode) { printf("fillChar: x=%.2f y=%.2f c=%3d=0x%02x='%c'\n", (double)x, (double)y, c, c, c); } transform(state->matrix, x, y, &xt, &yt); x0 = splashFloor(xt); xFrac = splashFloor((xt - x0) * splashFontFraction); y0 = splashFloor(yt); yFrac = splashFloor((yt - y0) * splashFontFraction); if (!font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip, &clipRes)) { return splashErrNoGlyph; } if (clipRes != splashClipAllOutside) { fillGlyph2(x0, y0, &glyph, clipRes == splashClipAllInside); } opClipRes = clipRes; if (glyph.freeData) { gfree(glyph.data); } return splashOk; }
CPP
poppler
0
CVE-2018-14395
https://www.cvedetails.com/cve/CVE-2018-14395/
CWE-369
https://github.com/FFmpeg/FFmpeg/commit/fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
avformat/movenc: Write version 2 of audio atom if channels is not known The version 1 needs the channel count and would divide by 0 Fixes: division by 0 Fixes: fpe_movenc.c_1108_1.ogg Fixes: fpe_movenc.c_1108_2.ogg Fixes: fpe_movenc.c_1108_3.wav Found-by: #CHEN HONGXU# <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->par->codec_tag; int i; enum AVPixelFormat pix_fmt; for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) { if (track->par->format == mov_pix_fmt_tags[i].pix_fmt) { tag = mov_pix_fmt_tags[i].tag; track->par->bits_per_coded_sample = mov_pix_fmt_tags[i].bps; if (track->par->codec_tag == mov_pix_fmt_tags[i].tag) break; } } pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov, track->par->bits_per_coded_sample); if (tag == MKTAG('r','a','w',' ') && track->par->format != pix_fmt && track->par->format != AV_PIX_FMT_GRAY8 && track->par->format != AV_PIX_FMT_NONE) av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to mov, output file will be unreadable\n", av_get_pix_fmt_name(track->par->format)); return tag; }
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->par->codec_tag; int i; enum AVPixelFormat pix_fmt; for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) { if (track->par->format == mov_pix_fmt_tags[i].pix_fmt) { tag = mov_pix_fmt_tags[i].tag; track->par->bits_per_coded_sample = mov_pix_fmt_tags[i].bps; if (track->par->codec_tag == mov_pix_fmt_tags[i].tag) break; } } pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov, track->par->bits_per_coded_sample); if (tag == MKTAG('r','a','w',' ') && track->par->format != pix_fmt && track->par->format != AV_PIX_FMT_GRAY8 && track->par->format != AV_PIX_FMT_NONE) av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to mov, output file will be unreadable\n", av_get_pix_fmt_name(track->par->format)); return tag; }
C
FFmpeg
0
CVE-2011-2517
https://www.cvedetails.com/cve/CVE-2011-2517/
CWE-119
https://github.com/torvalds/linux/commit/208c72f4fe44fe09577e7975ba0e7fa0278f3d03
208c72f4fe44fe09577e7975ba0e7fa0278f3d03
nl80211: fix check for valid SSID size in scan operations In both trigger_scan and sched_scan operations, we were checking for the SSID length before assigning the value correctly. Since the memory was just kzalloc'ed, the check was always failing and SSID with over 32 characters were allowed to go through. This was causing a buffer overflow when copying the actual SSID to the proper place. This bug has been there since 2.6.29-rc4. Cc: [email protected] Signed-off-by: Luciano Coelho <[email protected]> Signed-off-by: John W. Linville <[email protected]>
static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *netdev = info->user_ptr[1]; return __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); }
static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *netdev = info->user_ptr[1]; return __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); }
C
linux
0
CVE-2015-6775
https://www.cvedetails.com/cve/CVE-2015-6775/
null
https://github.com/chromium/chromium/commit/53f1c0f95e568d4b6b184904f98cfde2833c603c
53f1c0f95e568d4b6b184904f98cfde2833c603c
Support negative timestamps of TextTrackCue Ensure proper behaviour for negative timestamps of TextTrackCue. 1. Cues with negative startTime should become active from 0s. 2. Cues with negative startTime and endTime should never be active. Bug: 314032 Change-Id: Ib53710e58be0be770c933ea8c3c4709a0e5dec0d Reviewed-on: https://chromium-review.googlesource.com/863270 Commit-Queue: srirama chandra sekhar <[email protected]> Reviewed-by: Fredrik Söderquist <[email protected]> Cr-Commit-Position: refs/heads/master@{#529012}
void TextTrackCueList::InvalidateCueIndex(size_t index) { first_invalid_index_ = std::min(first_invalid_index_, index); }
void TextTrackCueList::InvalidateCueIndex(size_t index) { first_invalid_index_ = std::min(first_invalid_index_, index); }
C
Chrome
0
CVE-2012-5136
https://www.cvedetails.com/cve/CVE-2012-5136/
CWE-20
https://github.com/chromium/chromium/commit/401d30ef93030afbf7e81e53a11b68fc36194502
401d30ef93030afbf7e81e53a11b68fc36194502
Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no reason to stay in SecurityContext. TEST=none BUG=none [email protected], abarth, haraken, hayato Review URL: https://codereview.chromium.org/27615003 git-svn-id: svn://svn.chromium.org/blink/trunk@159829 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool Document::inDesignMode() const { for (const Document* d = this; d; d = d->parentDocument()) { if (d->m_designMode != inherit) return d->m_designMode; } return false; }
bool Document::inDesignMode() const { for (const Document* d = this; d; d = d->parentDocument()) { if (d->m_designMode != inherit) return d->m_designMode; } return false; }
C
Chrome
0
CVE-2016-6198
https://www.cvedetails.com/cve/CVE-2016-6198/
CWE-284
https://github.com/torvalds/linux/commit/9409e22acdfc9153f88d9b1ed2bd2a5b34d2d3ca
9409e22acdfc9153f88d9b1ed2bd2a5b34d2d3ca
vfs: rename: check backing inode being equal If a file is renamed to a hardlink of itself POSIX specifies that rename(2) should do nothing and return success. This condition is checked in vfs_rename(). However it won't detect hard links on overlayfs where these are given separate inodes on the overlayfs layer. Overlayfs itself detects this condition and returns success without doing anything, but then vfs_rename() will proceed as if this was a successful rename (detach_mounts(), d_move()). The correct thing to do is to detect this condition before even calling into overlayfs. This patch does this by calling vfs_select_inode() to get the underlying inodes. Signed-off-by: Miklos Szeredi <[email protected]> Cc: <[email protected]> # v4.2+
int page_symlink(struct inode *inode, const char *symname, int len) { return __page_symlink(inode, symname, len, !mapping_gfp_constraint(inode->i_mapping, __GFP_FS)); }
int page_symlink(struct inode *inode, const char *symname, int len) { return __page_symlink(inode, symname, len, !mapping_gfp_constraint(inode->i_mapping, __GFP_FS)); }
C
linux
0
CVE-2014-4502
https://www.cvedetails.com/cve/CVE-2014-4502/
CWE-119
https://github.com/ckolivas/cgminer/commit/e1c5050734123973b99d181c45e74b2cbb00272e
e1c5050734123973b99d181c45e74b2cbb00272e
Do some random sanity checking for stratum message parsing
static void keep_curlalive(CURL *curl) { const int tcp_keepidle = 45; const int tcp_keepintvl = 30; const long int keepalive = 1; curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, keepalive); curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, tcp_keepidle); curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, tcp_keepintvl); }
static void keep_curlalive(CURL *curl) { const int tcp_keepidle = 45; const int tcp_keepintvl = 30; const long int keepalive = 1; curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, keepalive); curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, tcp_keepidle); curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, tcp_keepintvl); }
C
cgminer
0
CVE-2017-6903
https://www.cvedetails.com/cve/CVE-2017-6903/
CWE-269
https://github.com/ioquake/ioq3/commit/376267d534476a875d8b9228149c4ee18b74a4fd
376267d534476a875d8b9228149c4ee18b74a4fd
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
long FS_filelength(fileHandle_t f) { FILE *h; h = FS_FileForHandle(f); if(h == NULL) return -1; else return FS_fplength(h); }
long FS_filelength(fileHandle_t f) { FILE *h; h = FS_FileForHandle(f); if(h == NULL) return -1; else return FS_fplength(h); }
C
OpenJK
0
CVE-2013-3076
https://www.cvedetails.com/cve/CVE-2013-3076/
CWE-200
https://github.com/torvalds/linux/commit/72a763d805a48ac8c0bf48fdb510e84c12de51fe
72a763d805a48ac8c0bf48fdb510e84c12de51fe
crypto: algif - suppress sending source address information in recvmsg The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that. Cc: <[email protected]> # 2.6.38 Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int __init algif_hash_init(void) { return af_alg_register_type(&algif_type_hash); }
static int __init algif_hash_init(void) { return af_alg_register_type(&algif_type_hash); }
C
linux
0
CVE-2011-2350
https://www.cvedetails.com/cve/CVE-2011-2350/
CWE-20
https://github.com/chromium/chromium/commit/b944f670bb7a8a919daac497a4ea0536c954c201
b944f670bb7a8a919daac497a4ea0536c954c201
[JSC] Implement a helper method createNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=85102 Reviewed by Geoffrey Garen. In bug 84787, kbr@ requested to avoid hard-coding createTypeError(exec, "Not enough arguments") here and there. This patch implements createNotEnoughArgumentsError(exec) and uses it in JSC bindings. c.f. a corresponding bug for V8 bindings is bug 85097. Source/JavaScriptCore: * runtime/Error.cpp: (JSC::createNotEnoughArgumentsError): (JSC): * runtime/Error.h: (JSC): Source/WebCore: Test: bindings/scripts/test/TestObj.idl * bindings/scripts/CodeGeneratorJS.pm: Modified as described above. (GenerateArgumentsCountCheck): * bindings/js/JSDataViewCustom.cpp: Ditto. (WebCore::getDataViewMember): (WebCore::setDataViewMember): * bindings/js/JSDeprecatedPeerConnectionCustom.cpp: (WebCore::JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection): * bindings/js/JSDirectoryEntryCustom.cpp: (WebCore::JSDirectoryEntry::getFile): (WebCore::JSDirectoryEntry::getDirectory): * bindings/js/JSSharedWorkerCustom.cpp: (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): * bindings/js/JSWebKitMutationObserverCustom.cpp: (WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver): (WebCore::JSWebKitMutationObserver::observe): * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorkerConstructor::constructJSWorker): * bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests. (WebCore::jsFloat64ArrayPrototypeFunctionFoo): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItem): (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::constructJSTestObj): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg): (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): (WebCore::jsTestObjPrototypeFunctionSerializedValue): (WebCore::jsTestObjPrototypeFunctionIdbKey): (WebCore::jsTestObjPrototypeFunctionOptionsObject): (WebCore::jsTestObjPrototypeFunctionAddEventListener): (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): (WebCore::jsTestObjConstructorFunctionClassMethod2): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongArray): (WebCore::jsTestObjPrototypeFunctionConvert1): (WebCore::jsTestObjPrototypeFunctionConvert2): (WebCore::jsTestObjPrototypeFunctionConvert3): (WebCore::jsTestObjPrototypeFunctionConvert4): (WebCore::jsTestObjPrototypeFunctionConvert5): (WebCore::jsTestObjPrototypeFunctionStrictFunction): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList): git-svn-id: svn://svn.chromium.org/blink/trunk@115536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
JSObject* addErrorInfo(CallFrame* callFrame, JSObject* error, int line, const SourceCode& source) { JSGlobalData* globalData = &callFrame->globalData(); const UString& sourceURL = source.provider()->url(); if (line != -1) error->putDirect(*globalData, Identifier(globalData, linePropertyName), jsNumber(line), ReadOnly | DontDelete); if (!sourceURL.isNull()) error->putDirect(*globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete); globalData->interpreter->addStackTraceIfNecessary(callFrame, error); return error; }
JSObject* addErrorInfo(CallFrame* callFrame, JSObject* error, int line, const SourceCode& source) { JSGlobalData* globalData = &callFrame->globalData(); const UString& sourceURL = source.provider()->url(); if (line != -1) error->putDirect(*globalData, Identifier(globalData, linePropertyName), jsNumber(line), ReadOnly | DontDelete); if (!sourceURL.isNull()) error->putDirect(*globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete); globalData->interpreter->addStackTraceIfNecessary(callFrame, error); return error; }
C
Chrome
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}
void BaseArena::prepareForSweep() { ASSERT(getThreadState()->isInGC()); ASSERT(!m_firstUnsweptPage); m_firstUnsweptPage = m_firstPage; m_firstPage = nullptr; }
void BaseArena::prepareForSweep() { ASSERT(getThreadState()->isInGC()); ASSERT(!m_firstUnsweptPage); m_firstUnsweptPage = m_firstPage; m_firstPage = nullptr; }
C
Chrome
0
CVE-2011-3085
https://www.cvedetails.com/cve/CVE-2011-3085/
CWE-119
https://github.com/chromium/chromium/commit/c7e50b5ef454efd6ab9527d795442c213eeb6afa
c7e50b5ef454efd6ab9527d795442c213eeb6afa
[REGRESSION] Refreshed autofill popup renders garbage https://bugs.webkit.org/show_bug.cgi?id=83255 http://code.google.com/p/chromium/issues/detail?id=118374 The code used to update only the PopupContainer coordinates as if they were the coordinates relative to the root view. Instead, a WebWidget positioned relative to the screen origin holds the PopupContainer, so it is the WebWidget that should be positioned in PopupContainer::refresh(), and the PopupContainer's location should be (0, 0) (and their sizes should always be equal). Reviewed by Kent Tamura. No new tests, as the popup appearance is not testable in WebKit. * platform/chromium/PopupContainer.cpp: (WebCore::PopupContainer::layoutAndCalculateWidgetRect): Variable renamed. (WebCore::PopupContainer::showPopup): Use m_originalFrameRect rather than frameRect() for passing into chromeClient. (WebCore::PopupContainer::showInRect): Set up the correct frameRect() for the container. (WebCore::PopupContainer::refresh): Resize the container and position the WebWidget correctly. * platform/chromium/PopupContainer.h: (PopupContainer): git-svn-id: svn://svn.chromium.org/blink/trunk@113418 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool PopupContainer::handleKeyEvent(const PlatformKeyboardEvent& event) { UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); return m_listBox->handleKeyEvent(event); }
bool PopupContainer::handleKeyEvent(const PlatformKeyboardEvent& event) { UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); return m_listBox->handleKeyEvent(event); }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { GLsync service_sync = 0; return group_->GetSyncServiceId(client_id, &service_sync); }
bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { GLsync service_sync = 0; return group_->GetSyncServiceId(client_id, &service_sync); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/befb46ae3385fa13975521e9a2281e35805b339e
befb46ae3385fa13975521e9a2281e35805b339e
2009-10-23 Chris Evans <[email protected]> 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 <[email protected]> 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::checkCompleted() { m_shouldCallCheckCompleted = false; if (m_frame->view()) m_frame->view()->checkStopDelayingDeferredRepaints(); if (!allChildrenAreComplete()) return; if (m_isComplete) return; if (m_frame->document()->parsing()) return; if (numRequests(m_frame->document())) return; m_isComplete = true; RefPtr<Frame> protect(m_frame); checkCallImplicitClose(); // if we didn't do it before m_frame->redirectScheduler()->startTimer(); completed(); if (m_frame->page()) checkLoadComplete(); }
void FrameLoader::checkCompleted() { m_shouldCallCheckCompleted = false; if (m_frame->view()) m_frame->view()->checkStopDelayingDeferredRepaints(); if (!allChildrenAreComplete()) return; if (m_isComplete) return; if (m_frame->document()->parsing()) return; if (numRequests(m_frame->document())) return; m_isComplete = true; RefPtr<Frame> protect(m_frame); checkCallImplicitClose(); // if we didn't do it before m_frame->redirectScheduler()->startTimer(); completed(); if (m_frame->page()) checkLoadComplete(); }
C
Chrome
0
CVE-2015-4700
https://www.cvedetails.com/cve/CVE-2015-4700/
CWE-17
https://github.com/torvalds/linux/commit/3f7352bf21f8fd7ba3e2fcef9488756f188e12be
3f7352bf21f8fd7ba3e2fcef9488756f188e12be
x86: bpf_jit: fix compilation of large bpf programs x86 has variable length encoding. x86 JIT compiler is trying to pick the shortest encoding for given bpf instruction. While doing so the jump targets are changing, so JIT is doing multiple passes over the program. Typical program needs 3 passes. Some very short programs converge with 2 passes. Large programs may need 4 or 5. But specially crafted bpf programs may hit the pass limit and if the program converges on the last iteration the JIT compiler will be producing an image full of 'int 3' insns. Fix this corner case by doing final iteration over bpf program. Fixes: 0a14842f5a3c ("net: filter: Just In Time compiler for x86-64") Reported-by: Daniel Borkmann <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Tested-by: Daniel Borkmann <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static u8 add_1reg(u8 byte, u32 dst_reg) { return byte + reg2hex[dst_reg]; }
static u8 add_1reg(u8 byte, u32 dst_reg) { return byte + reg2hex[dst_reg]; }
C
linux
0
CVE-2018-6177
https://www.cvedetails.com/cve/CVE-2018-6177/
CWE-200
https://github.com/chromium/chromium/commit/4504a474c069d07104237d0c03bfce7b29a42de6
4504a474c069d07104237d0c03bfce7b29a42de6
defeat cors attacks on audio/video tags Neutralize error messages and fire no progress events until media metadata has been loaded for media loaded from cross-origin locations. Bug: 828265, 826187 Change-Id: Iaf15ef38676403687d6a913cbdc84f2d70a6f5c6 Reviewed-on: https://chromium-review.googlesource.com/1015794 Reviewed-by: Mounir Lamouri <[email protected]> Reviewed-by: Dale Curtis <[email protected]> Commit-Queue: Fredrik Hubinette <[email protected]> Cr-Commit-Position: refs/heads/master@{#557312}
void HTMLMediaElement::enterPictureInPicture( WebMediaPlayer::PipWindowSizeCallback callback) { if (GetWebMediaPlayer()) GetWebMediaPlayer()->EnterPictureInPicture(std::move(callback)); }
void HTMLMediaElement::enterPictureInPicture( WebMediaPlayer::PipWindowSizeCallback callback) { if (GetWebMediaPlayer()) GetWebMediaPlayer()->EnterPictureInPicture(std::move(callback)); }
C
Chrome
0
CVE-2018-17468
https://www.cvedetails.com/cve/CVE-2018-17468/
CWE-200
https://github.com/chromium/chromium/commit/5fe74f831fddb92afa5ddfe46490bb49f083132b
5fe74f831fddb92afa5ddfe46490bb49f083132b
Do not forward resource timing to parent frame after back-forward navigation LocalFrame has |should_send_resource_timing_info_to_parent_| flag not to send timing info to parent except for the first navigation. This flag is cleared when the first timing is sent to parent, however this does not happen if iframe's first navigation was by back-forward navigation. For such iframes, we shouldn't send timings to parent at all. Bug: 876822 Change-Id: I128b51a82ef278c439548afc8283ae63abdef5c5 Reviewed-on: https://chromium-review.googlesource.com/1186215 Reviewed-by: Kinuko Yasuda <[email protected]> Commit-Queue: Kunihiko Sakamoto <[email protected]> Cr-Commit-Position: refs/heads/master@{#585736}
bool WebLocalFrameImpl::ExecuteCommand(const WebString& name, const WebString& value) { DCHECK(GetFrame()); std::unique_ptr<UserGestureIndicator> gesture_indicator = Frame::NotifyUserActivation(GetFrame(), UserGestureToken::kNewGesture); WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(); if (plugin_container && plugin_container->ExecuteEditCommand(name, value)) return true; return GetFrame()->GetEditor().ExecuteCommand(name, value); }
bool WebLocalFrameImpl::ExecuteCommand(const WebString& name, const WebString& value) { DCHECK(GetFrame()); std::unique_ptr<UserGestureIndicator> gesture_indicator = Frame::NotifyUserActivation(GetFrame(), UserGestureToken::kNewGesture); WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(); if (plugin_container && plugin_container->ExecuteEditCommand(name, value)) return true; return GetFrame()->GetEditor().ExecuteCommand(name, value); }
C
Chrome
0
CVE-2013-2015
https://www.cvedetails.com/cve/CVE-2013-2015/
CWE-399
https://github.com/torvalds/linux/commit/0e9a9a1ad619e7e987815d20262d36a2f95717ca
0e9a9a1ad619e7e987815d20262d36a2f95717ca
ext4: avoid hang when mounting non-journal filesystems with orphan list When trying to mount a file system which does not contain a journal, but which does have a orphan list containing an inode which needs to be truncated, the mount call with hang forever in ext4_orphan_cleanup() because ext4_orphan_del() will return immediately without removing the inode from the orphan list, leading to an uninterruptible loop in kernel code which will busy out one of the CPU's on the system. This can be trivially reproduced by trying to mount the file system found in tests/f_orphan_extents_inode/image.gz from the e2fsprogs source tree. If a malicious user were to put this on a USB stick, and mount it on a Linux desktop which has automatic mounts enabled, this could be considered a potential denial of service attack. (Not a big deal in practice, but professional paranoids worry about such things, and have even been known to allocate CVE numbers for such problems.) Signed-off-by: "Theodore Ts'o" <[email protected]> Reviewed-by: Zheng Liu <[email protected]> Cc: [email protected]
static inline unsigned dx_get_hash(struct dx_entry *entry) { return le32_to_cpu(entry->hash); }
static inline unsigned dx_get_hash(struct dx_entry *entry) { return le32_to_cpu(entry->hash); }
C
linux
0
CVE-2018-6035
https://www.cvedetails.com/cve/CVE-2018-6035/
CWE-200
https://github.com/chromium/chromium/commit/2649de11c562aa96d336c06136a1a20c01711be0
2649de11c562aa96d336c06136a1a20c01711be0
Hide DevTools frontend from webRequest API Prevent extensions from observing requests for remote DevTools frontends and add regression tests. And update ExtensionTestApi to support initializing the embedded test server and port from SetUpCommandLine (before SetUpOnMainThread). BUG=797497,797500 TEST=browser_test --gtest_filter=DevToolsFrontendInWebRequestApiTest.HiddenRequests Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Ic8f44b5771f2d5796f8c3de128f0a7ab88a77735 Reviewed-on: https://chromium-review.googlesource.com/844316 Commit-Queue: Rob Wu <[email protected]> Reviewed-by: Devlin <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#528187}
ExtensionApiTest::ExtensionApiTest() { embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleServerRedirectRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleEchoHeaderRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleSetCookieRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleSetHeaderRequest)); }
ExtensionApiTest::ExtensionApiTest() { embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleServerRedirectRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleEchoHeaderRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleSetCookieRequest)); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleSetHeaderRequest)); }
C
Chrome
0
CVE-2015-5289
https://www.cvedetails.com/cve/CVE-2015-5289/
CWE-119
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=08fa47c4850cea32c3116665975bca219fbf2fe6
08fa47c4850cea32c3116665975bca219fbf2fe6
null
make_row_from_rec_and_jsonb(Jsonb *element, PopulateRecordsetState *state) { Datum *values; bool *nulls; int i; RecordIOData *my_extra = state->my_extra; int ncolumns = my_extra->ncolumns; TupleDesc tupdesc = state->ret_tdesc; HeapTupleHeader rec = state->rec; HeapTuple rettuple; values = (Datum *) palloc(ncolumns * sizeof(Datum)); nulls = (bool *) palloc(ncolumns * sizeof(bool)); if (state->rec) { HeapTupleData tuple; /* Build a temporary HeapTuple control structure */ tuple.t_len = HeapTupleHeaderGetDatumLength(state->rec); ItemPointerSetInvalid(&(tuple.t_self)); tuple.t_tableOid = InvalidOid; tuple.t_data = state->rec; /* Break down the tuple into fields */ heap_deform_tuple(&tuple, tupdesc, values, nulls); } else { for (i = 0; i < ncolumns; ++i) { values[i] = (Datum) 0; nulls[i] = true; } } for (i = 0; i < ncolumns; ++i) { ColumnIOData *column_info = &my_extra->columns[i]; Oid column_type = tupdesc->attrs[i]->atttypid; JsonbValue *v = NULL; char *key; /* Ignore dropped columns in datatype */ if (tupdesc->attrs[i]->attisdropped) { nulls[i] = true; continue; } key = NameStr(tupdesc->attrs[i]->attname); v = findJsonbValueFromContainerLen(&element->root, JB_FOBJECT, key, strlen(key)); /* * We can't just skip here if the key wasn't found since we might have * a domain to deal with. If we were passed in a non-null record * datum, we assume that the existing values are valid (if they're * not, then it's not our fault), but if we were passed in a null, * then every field which we don't populate needs to be run through * the input function just in case it's a domain type. */ if (v == NULL && rec) continue; /* * Prepare to convert the column value from text */ if (column_info->column_type != column_type) { getTypeInputInfo(column_type, &column_info->typiofunc, &column_info->typioparam); fmgr_info_cxt(column_info->typiofunc, &column_info->proc, state->fn_mcxt); column_info->column_type = column_type; } if (v == NULL || v->type == jbvNull) { /* * Need InputFunctionCall to happen even for nulls, so that domain * checks are done */ values[i] = InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i]->atttypmod); nulls[i] = true; } else { char *s = NULL; if (v->type == jbvString) s = pnstrdup(v->val.string.val, v->val.string.len); else if (v->type == jbvBool) s = pnstrdup((v->val.boolean) ? "t" : "f", 1); else if (v->type == jbvNumeric) s = DatumGetCString(DirectFunctionCall1(numeric_out, PointerGetDatum(v->val.numeric))); else if (v->type == jbvBinary) s = JsonbToCString(NULL, (JsonbContainer *) v->val.binary.data, v->val.binary.len); else elog(ERROR, "unrecognized jsonb type: %d", (int) v->type); values[i] = InputFunctionCall(&column_info->proc, s, column_info->typioparam, tupdesc->attrs[i]->atttypmod); nulls[i] = false; } } rettuple = heap_form_tuple(tupdesc, values, nulls); tuplestore_puttuple(state->tuple_store, rettuple); }
make_row_from_rec_and_jsonb(Jsonb *element, PopulateRecordsetState *state) { Datum *values; bool *nulls; int i; RecordIOData *my_extra = state->my_extra; int ncolumns = my_extra->ncolumns; TupleDesc tupdesc = state->ret_tdesc; HeapTupleHeader rec = state->rec; HeapTuple rettuple; values = (Datum *) palloc(ncolumns * sizeof(Datum)); nulls = (bool *) palloc(ncolumns * sizeof(bool)); if (state->rec) { HeapTupleData tuple; /* Build a temporary HeapTuple control structure */ tuple.t_len = HeapTupleHeaderGetDatumLength(state->rec); ItemPointerSetInvalid(&(tuple.t_self)); tuple.t_tableOid = InvalidOid; tuple.t_data = state->rec; /* Break down the tuple into fields */ heap_deform_tuple(&tuple, tupdesc, values, nulls); } else { for (i = 0; i < ncolumns; ++i) { values[i] = (Datum) 0; nulls[i] = true; } } for (i = 0; i < ncolumns; ++i) { ColumnIOData *column_info = &my_extra->columns[i]; Oid column_type = tupdesc->attrs[i]->atttypid; JsonbValue *v = NULL; char *key; /* Ignore dropped columns in datatype */ if (tupdesc->attrs[i]->attisdropped) { nulls[i] = true; continue; } key = NameStr(tupdesc->attrs[i]->attname); v = findJsonbValueFromContainerLen(&element->root, JB_FOBJECT, key, strlen(key)); /* * We can't just skip here if the key wasn't found since we might have * a domain to deal with. If we were passed in a non-null record * datum, we assume that the existing values are valid (if they're * not, then it's not our fault), but if we were passed in a null, * then every field which we don't populate needs to be run through * the input function just in case it's a domain type. */ if (v == NULL && rec) continue; /* * Prepare to convert the column value from text */ if (column_info->column_type != column_type) { getTypeInputInfo(column_type, &column_info->typiofunc, &column_info->typioparam); fmgr_info_cxt(column_info->typiofunc, &column_info->proc, state->fn_mcxt); column_info->column_type = column_type; } if (v == NULL || v->type == jbvNull) { /* * Need InputFunctionCall to happen even for nulls, so that domain * checks are done */ values[i] = InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i]->atttypmod); nulls[i] = true; } else { char *s = NULL; if (v->type == jbvString) s = pnstrdup(v->val.string.val, v->val.string.len); else if (v->type == jbvBool) s = pnstrdup((v->val.boolean) ? "t" : "f", 1); else if (v->type == jbvNumeric) s = DatumGetCString(DirectFunctionCall1(numeric_out, PointerGetDatum(v->val.numeric))); else if (v->type == jbvBinary) s = JsonbToCString(NULL, (JsonbContainer *) v->val.binary.data, v->val.binary.len); else elog(ERROR, "unrecognized jsonb type: %d", (int) v->type); values[i] = InputFunctionCall(&column_info->proc, s, column_info->typioparam, tupdesc->attrs[i]->atttypmod); nulls[i] = false; } } rettuple = heap_form_tuple(tupdesc, values, nulls); tuplestore_puttuple(state->tuple_store, rettuple); }
C
postgresql
0
CVE-2010-4819
https://www.cvedetails.com/cve/CVE-2010-4819/
CWE-20
https://cgit.freedesktop.org/xorg/xserver/commit/render/render.c?id=5725849a1b427cd4a72b84e57f211edb35838718
5725849a1b427cd4a72b84e57f211edb35838718
null
SProcRenderCreateRadialGradient (ClientPtr client) { register int n; int len; REQUEST (xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq); swaps(&stuff->length, n); swapl(&stuff->pid, n); swapl(&stuff->inner.x, n); swapl(&stuff->inner.y, n); swapl(&stuff->outer.x, n); swapl(&stuff->outer.y, n); swapl(&stuff->inner_radius, n); swapl(&stuff->outer_radius, n); swapl(&stuff->nStops, n); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff+1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); }
SProcRenderCreateRadialGradient (ClientPtr client) { register int n; int len; REQUEST (xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq); swaps(&stuff->length, n); swapl(&stuff->pid, n); swapl(&stuff->inner.x, n); swapl(&stuff->inner.y, n); swapl(&stuff->outer.x, n); swapl(&stuff->outer.y, n); swapl(&stuff->inner_radius, n); swapl(&stuff->outer_radius, n); swapl(&stuff->nStops, n); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff+1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); }
C
xserver
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <[email protected]> CC: Karsten Keil <[email protected]> CC: "David S. Miller" <[email protected]> CC: Jay Vosburgh <[email protected]> CC: Andy Gospodarek <[email protected]> CC: Patrick McHardy <[email protected]> CC: Krzysztof Halasa <[email protected]> CC: "John W. Linville" <[email protected]> CC: Greg Kroah-Hartman <[email protected]> CC: Marcel Holtmann <[email protected]> CC: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int readSsidRid(struct airo_info*ai, SsidRid *ssidr) { return PC4500_readrid(ai, RID_SSID, ssidr, sizeof(*ssidr), 1); }
static int readSsidRid(struct airo_info*ai, SsidRid *ssidr) { return PC4500_readrid(ai, RID_SSID, ssidr, sizeof(*ssidr), 1); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/a03d4448faf2c40f4ef444a88cb9aace5b98e8c4
a03d4448faf2c40f4ef444a88cb9aace5b98e8c4
Introduce background.scripts feature for extension manifests. This optimizes for the common use case where background pages just include a reference to one or more script files and no additional HTML. BUG=107791 Review URL: http://codereview.chromium.org/9150008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117110 0039d316-1c4b-4281-b951-d872f2087c98
void CloseBalloon(const std::string id) { g_browser_process->notification_ui_manager()->CancelById(id); }
void CloseBalloon(const std::string id) { g_browser_process->notification_ui_manager()->CancelById(id); }
C
Chrome
0
CVE-2017-13715
https://www.cvedetails.com/cve/CVE-2017-13715/
CWE-20
https://github.com/torvalds/linux/commit/a6e544b0a88b53114bfa5a57e21b7be7a8dfc9d0
a6e544b0a88b53114bfa5a57e21b7be7a8dfc9d0
flow_dissector: Jump to exit code in __skb_flow_dissect Instead of returning immediately (on a parsing failure for instance) we jump to cleanup code. This always sets protocol values in key_control (even on a failure there is still valid information in the key_tags that was set before the problem was hit). Signed-off-by: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void __skb_get_hash(struct sk_buff *skb) { struct flow_keys keys; u32 hash; __flow_hash_secret_init(); hash = ___skb_get_hash(skb, &keys, hashrnd); if (!hash) return; __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); }
void __skb_get_hash(struct sk_buff *skb) { struct flow_keys keys; u32 hash; __flow_hash_secret_init(); hash = ___skb_get_hash(skb, &keys, hashrnd); if (!hash) return; __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); }
C
linux
0
CVE-2013-2871
https://www.cvedetails.com/cve/CVE-2013-2871/
CWE-20
https://github.com/chromium/chromium/commit/bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
Setting input.x-webkit-speech should not cause focus change In r150866, we introduced element()->focus() in destroyShadowSubtree() to retain focus on <input> when its type attribute gets changed. But when x-webkit-speech attribute is changed, the element is detached before calling destroyShadowSubtree() and element()->focus() failed This patch moves detach() after destroyShadowSubtree() to fix the problem. BUG=243818 TEST=fast/forms/input-type-change-focusout.html NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16084005 git-svn-id: svn://svn.chromium.org/blink/trunk@151444 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void HTMLInputElement::updateClearButtonVisibility() { m_inputType->updateClearButtonVisibility(); }
void HTMLInputElement::updateClearButtonVisibility() { m_inputType->updateClearButtonVisibility(); }
C
Chrome
0
CVE-2011-4621
https://www.cvedetails.com/cve/CVE-2011-4621/
null
https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64
f26f9aff6aaf67e9a430d16c266f91b13a5bff64
Sched: fix skip_clock_update optimization idle_balance() drops/retakes rq->lock, leaving the previous task vulnerable to set_tsk_need_resched(). Clear it after we return from balancing instead, and in setup_thread_stack() as well, so no successfully descheduled or never scheduled task has it set. Need resched confused the skip_clock_update logic, which assumes that the next call to update_rq_clock() will come nearly immediately after being set. Make the optimization robust against the waking a sleeper before it sucessfully deschedules case by checking that the current task has not been dequeued before setting the flag, since it is that useless clock update we're trying to save, and clear unconditionally in schedule() proper instead of conditionally in put_prev_task(). Signed-off-by: Mike Galbraith <[email protected]> Reported-by: Bjoern B. Brandenburg <[email protected]> Tested-by: Yong Zhang <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
static inline struct task_group *task_group(struct task_struct *p) { struct cgroup_subsys_state *css; css = task_subsys_state_check(p, cpu_cgroup_subsys_id, lockdep_is_held(&task_rq(p)->lock)); return container_of(css, struct task_group, css); }
static inline struct task_group *task_group(struct task_struct *p) { struct cgroup_subsys_state *css; css = task_subsys_state_check(p, cpu_cgroup_subsys_id, lockdep_is_held(&task_rq(p)->lock)); return container_of(css, struct task_group, css); }
C
linux
0
CVE-2017-0600
https://www.cvedetails.com/cve/CVE-2017-0600/
null
https://android.googlesource.com/platform/frameworks/av/+/961e5ac5788b52304e64b9a509781beaf5201fb0
961e5ac5788b52304e64b9a509781beaf5201fb0
Fix NPDs in h263 decoder Bug: 35269635 Test: decoded PoC with and without patch Change-Id: I636a14360c7801cc5bca63c9cb44d1d235df8fd8 (cherry picked from commit 2ad2a92318a3b9daf78ebcdc597085adbf32600d)
void PVDecPostProcess(VideoDecControls *decCtrl, uint8 *outputYUV) { uint8 *outputBuffer; #ifdef PV_POSTPROC_ON VideoDecData *video = (VideoDecData *) decCtrl->videoDecoderData; int32 tmpvar; if (outputYUV) { outputBuffer = outputYUV; } else { if (video->postFilterType) { outputBuffer = video->currVop->yChan; } else { outputBuffer = decCtrl->outputFrame; } } if (video->postFilterType) { /* Post-processing, */ PostFilter(video, video->postFilterType, outputBuffer); } else { if (outputYUV) { /* Copy decoded frame to the output buffer. */ tmpvar = (int32)video->width * video->height; oscl_memcpy(outputBuffer, decCtrl->outputFrame, tmpvar*3 / 2); /* 3/3/01 */ } } #else outputBuffer = decCtrl->outputFrame; outputYUV; #endif decCtrl->outputFrame = outputBuffer; return; }
void PVDecPostProcess(VideoDecControls *decCtrl, uint8 *outputYUV) { uint8 *outputBuffer; #ifdef PV_POSTPROC_ON VideoDecData *video = (VideoDecData *) decCtrl->videoDecoderData; int32 tmpvar; if (outputYUV) { outputBuffer = outputYUV; } else { if (video->postFilterType) { outputBuffer = video->currVop->yChan; } else { outputBuffer = decCtrl->outputFrame; } } if (video->postFilterType) { /* Post-processing, */ PostFilter(video, video->postFilterType, outputBuffer); } else { if (outputYUV) { /* Copy decoded frame to the output buffer. */ tmpvar = (int32)video->width * video->height; oscl_memcpy(outputBuffer, decCtrl->outputFrame, tmpvar*3 / 2); /* 3/3/01 */ } } #else outputBuffer = decCtrl->outputFrame; outputYUV; #endif decCtrl->outputFrame = outputBuffer; return; }
C
Android
0
CVE-2019-12107
https://www.cvedetails.com/cve/CVE-2019-12107/
CWE-200
https://github.com/miniupnp/miniupnp/commit/bec6ccec63cadc95655721bc0e1dd49dac759d94
bec6ccec63cadc95655721bc0e1dd49dac759d94
upnp_event_prepare(): check the return value of snprintf()
upnpevents_renewSubscription(const char * sid, int sidlen, int timeout) { struct subscriber * sub; for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) { if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) { #ifdef UPNP_STRICT /* check if the subscription already timeouted */ if(sub->timeout && upnp_time() > sub->timeout) continue; #endif sub->timeout = (timeout ? upnp_time() + timeout : 0); return sub->uuid; } } return NULL; }
upnpevents_renewSubscription(const char * sid, int sidlen, int timeout) { struct subscriber * sub; for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) { if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) { #ifdef UPNP_STRICT /* check if the subscription already timeouted */ if(sub->timeout && upnp_time() > sub->timeout) continue; #endif sub->timeout = (timeout ? upnp_time() + timeout : 0); return sub->uuid; } } return NULL; }
C
miniupnp
0
CVE-2013-0884
https://www.cvedetails.com/cve/CVE-2013-0884/
null
https://github.com/chromium/chromium/commit/4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
[4/4] Process clearBrowserCahce/cookies commands in browser. BUG=366585 Review URL: https://codereview.chromium.org/251183005 git-svn-id: svn://svn.chromium.org/blink/trunk@172984 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InspectorClientImpl::resetTraceEventCallback() { if (WebDevToolsAgentImpl* agent = devToolsAgent()) agent->resetTraceEventCallback(); }
void InspectorClientImpl::resetTraceEventCallback() { if (WebDevToolsAgentImpl* agent = devToolsAgent()) agent->resetTraceEventCallback(); }
C
Chrome
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
cliprdr_send_data(uint8 * data, uint32 length) { logger(Clipboard, Debug, "cliprdr_send_data(), length %d bytes", length); cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length); }
cliprdr_send_data(uint8 * data, uint32 length) { logger(Clipboard, Debug, "cliprdr_send_data(), length %d bytes", length); cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length); }
C
rdesktop
0
null
null
null
https://github.com/chromium/chromium/commit/8353baf8d1504dbdd4ad7584ff2466de657521cd
8353baf8d1504dbdd4ad7584ff2466de657521cd
Remove WebFrame::canHaveSecureChild To simplify the public API, ServiceWorkerNetworkProvider can do the parent walk itself. Follow-up to https://crrev.com/ad1850962644e19. BUG=607543 Review-Url: https://codereview.chromium.org/2082493002 Cr-Commit-Position: refs/heads/master@{#400896}
void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) { DCHECK_NE(node.document(), this); if (m_ranges.isEmpty()) return; AttachedRangeSet ranges = m_ranges; for (Range* range : ranges) range->updateOwnerDocumentIfNeeded(); }
void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) { DCHECK_NE(node.document(), this); if (m_ranges.isEmpty()) return; AttachedRangeSet ranges = m_ranges; for (Range* range : ranges) range->updateOwnerDocumentIfNeeded(); }
C
Chrome
0
CVE-2011-2785
https://www.cvedetails.com/cve/CVE-2011-2785/
CWE-20
https://github.com/chromium/chromium/commit/697cd7e2ce2535696f1b9e5cfb474cc36a734747
697cd7e2ce2535696f1b9e5cfb474cc36a734747
Prevent extensions from defining homepages with schemes other than valid web extents. BUG=84402 TEST=ExtensionManifestTest.ParseHomepageURLs Review URL: http://codereview.chromium.org/7089014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87722 0039d316-1c4b-4281-b951-d872f2087c98
std::vector<std::string> Extension::GetDistinctHostsForDisplay( const URLPatternList& list) { return GetDistinctHosts(list, true); }
std::vector<std::string> Extension::GetDistinctHostsForDisplay( const URLPatternList& list) { return GetDistinctHosts(list, true); }
C
Chrome
0
CVE-2017-5089
https://www.cvedetails.com/cve/CVE-2017-5089/
CWE-20
https://github.com/chromium/chromium/commit/507241119f279c31766bd41c33d6ffb6851e2d7e
507241119f279c31766bd41c33d6ffb6851e2d7e
Migrate download_protection code to new DM token class. Migrates RetrieveDMToken calls to use the new BrowserDMToken class. Bug: 1020296 Change-Id: Icef580e243430d73b6c1c42b273a8540277481d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904234 Commit-Queue: Dominique Fauteux-Chapleau <[email protected]> Reviewed-by: Tien Mai <[email protected]> Reviewed-by: Daniel Rubery <[email protected]> Cr-Commit-Position: refs/heads/master@{#714196}
void CheckClientDownloadRequest::PopulateRequest( ClientDownloadRequest* request) { request->mutable_digests()->set_sha256(item_->GetHash()); request->set_length(item_->GetReceivedBytes()); for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { ClientDownloadRequest::Resource* resource = request->add_resources(); resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); if (i == item_->GetUrlChain().size() - 1) { resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); DVLOG(2) << "dl url " << resource->url(); if (!item_->GetRemoteAddress().empty()) { resource->set_remote_ip(item_->GetRemoteAddress()); DVLOG(2) << " dl url remote addr: " << resource->remote_ip(); } DVLOG(2) << "dl referrer " << resource->referrer(); } else { DVLOG(2) << "dl redirect " << i << " " << resource->url(); resource->set_type(ClientDownloadRequest::DOWNLOAD_REDIRECT); } } request->set_user_initiated(item_->HasUserGesture()); auto* referrer_chain_data = static_cast<ReferrerChainData*>( item_->GetUserData(ReferrerChainData::kDownloadReferrerChainDataKey)); if (referrer_chain_data && !referrer_chain_data->GetReferrerChain()->empty()) { request->mutable_referrer_chain()->Swap( referrer_chain_data->GetReferrerChain()); request->mutable_referrer_chain_options() ->set_recent_navigations_to_collect( referrer_chain_data->recent_navigations_to_collect()); UMA_HISTOGRAM_COUNTS_100( "SafeBrowsing.ReferrerURLChainSize.DownloadAttribution", referrer_chain_data->referrer_chain_length()); } }
void CheckClientDownloadRequest::PopulateRequest( ClientDownloadRequest* request) { request->mutable_digests()->set_sha256(item_->GetHash()); request->set_length(item_->GetReceivedBytes()); for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { ClientDownloadRequest::Resource* resource = request->add_resources(); resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); if (i == item_->GetUrlChain().size() - 1) { resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); DVLOG(2) << "dl url " << resource->url(); if (!item_->GetRemoteAddress().empty()) { resource->set_remote_ip(item_->GetRemoteAddress()); DVLOG(2) << " dl url remote addr: " << resource->remote_ip(); } DVLOG(2) << "dl referrer " << resource->referrer(); } else { DVLOG(2) << "dl redirect " << i << " " << resource->url(); resource->set_type(ClientDownloadRequest::DOWNLOAD_REDIRECT); } } request->set_user_initiated(item_->HasUserGesture()); auto* referrer_chain_data = static_cast<ReferrerChainData*>( item_->GetUserData(ReferrerChainData::kDownloadReferrerChainDataKey)); if (referrer_chain_data && !referrer_chain_data->GetReferrerChain()->empty()) { request->mutable_referrer_chain()->Swap( referrer_chain_data->GetReferrerChain()); request->mutable_referrer_chain_options() ->set_recent_navigations_to_collect( referrer_chain_data->recent_navigations_to_collect()); UMA_HISTOGRAM_COUNTS_100( "SafeBrowsing.ReferrerURLChainSize.DownloadAttribution", referrer_chain_data->referrer_chain_length()); } }
C
Chrome
0
CVE-2013-4282
https://www.cvedetails.com/cve/CVE-2013-4282/
CWE-119
https://cgit.freedesktop.org/spice/spice/commit/?id=8af619009660b24e0b41ad26b30289eea288fcc2
8af619009660b24e0b41ad26b30289eea288fcc2
null
SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* dest, int port, int secure_port, const char* cert_subject) { spice_info(NULL); spice_assert(!migration_interface); spice_assert(reds == s); if (!reds_set_migration_dest_info(dest, port, secure_port, cert_subject)) { return -1; } return 0; }
SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* dest, int port, int secure_port, const char* cert_subject) { spice_info(NULL); spice_assert(!migration_interface); spice_assert(reds == s); if (!reds_set_migration_dest_info(dest, port, secure_port, cert_subject)) { return -1; } return 0; }
C
spice
0
CVE-2016-4071
https://www.cvedetails.com/cve/CVE-2016-4071/
CWE-20
https://git.php.net/?p=php-src.git;a=commit;h=6e25966544fb1d2f3d7596e060ce9c9269bbdcf8
6e25966544fb1d2f3d7596e060ce9c9269bbdcf8
null
static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval) { php_error_docref(NULL, E_WARNING, "info property is read-only"); return FAILURE; }
static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval) { php_error_docref(NULL, E_WARNING, "info property is read-only"); return FAILURE; }
C
php
0
CVE-2018-12904
https://www.cvedetails.com/cve/CVE-2018-12904/
null
https://github.com/torvalds/linux/commit/727ba748e110b4de50d142edca9d6a9b7e6111d8
727ba748e110b4de50d142edca9d6a9b7e6111d8
kvm: nVMX: Enforce cpl=0 for VMX instructions VMX instructions executed inside a L1 VM will always trigger a VM exit even when executed with cpl 3. This means we must perform the privilege check in software. Fixes: 70f3aac964ae("kvm: nVMX: Remove superfluous VMX instruction fault checks") Cc: [email protected] Signed-off-by: Felix Wilhelm <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, bool nested) { #ifdef CONFIG_SMP int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; if (vcpu->mode == IN_GUEST_MODE) { /* * The vector of interrupt to be delivered to vcpu had * been set in PIR before this function. * * Following cases will be reached in this block, and * we always send a notification event in all cases as * explained below. * * Case 1: vcpu keeps in non-root mode. Sending a * notification event posts the interrupt to vcpu. * * Case 2: vcpu exits to root mode and is still * runnable. PIR will be synced to vIRR before the * next vcpu entry. Sending a notification event in * this case has no effect, as vcpu is not in root * mode. * * Case 3: vcpu exits to root mode and is blocked. * vcpu_block() has already synced PIR to vIRR and * never blocks vcpu if vIRR is not cleared. Therefore, * a blocked vcpu here does not wait for any requested * interrupts in PIR, and sending a notification event * which has no effect is safe here. */ apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec); return true; } #endif return false; }
static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, bool nested) { #ifdef CONFIG_SMP int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; if (vcpu->mode == IN_GUEST_MODE) { /* * The vector of interrupt to be delivered to vcpu had * been set in PIR before this function. * * Following cases will be reached in this block, and * we always send a notification event in all cases as * explained below. * * Case 1: vcpu keeps in non-root mode. Sending a * notification event posts the interrupt to vcpu. * * Case 2: vcpu exits to root mode and is still * runnable. PIR will be synced to vIRR before the * next vcpu entry. Sending a notification event in * this case has no effect, as vcpu is not in root * mode. * * Case 3: vcpu exits to root mode and is blocked. * vcpu_block() has already synced PIR to vIRR and * never blocks vcpu if vIRR is not cleared. Therefore, * a blocked vcpu here does not wait for any requested * interrupts in PIR, and sending a notification event * which has no effect is safe here. */ apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec); return true; } #endif return false; }
C
linux
0
CVE-2016-6491
https://www.cvedetails.com/cve/CVE-2016-6491/
CWE-125
https://github.com/ImageMagick/ImageMagick/commit/dd84447b63a71fa8c3f47071b09454efc667767b
dd84447b63a71fa8c3f47071b09454efc667767b
Prevent buffer overflow (bug report from Ibrahim el-sayed)
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property,const char *value,ExceptionInfo *exception) { MagickBooleanType status; MagickStatusType flags; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (image->properties == (void *) NULL) image->properties=NewSplayTree(CompareSplayTreeString, RelinquishMagickMemory,RelinquishMagickMemory); /* create splay-tree */ if (value == (const char *) NULL) return(DeleteImageProperty(image,property)); /* delete if NULL */ status=MagickTrue; if (strlen(property) <= 1) { /* Do not 'set' single letter properties - read only shorthand. */ (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } /* FUTURE: binary chars or quotes in key should produce a error */ /* Set attributes with known names or special prefixes return result is found, or break to set a free form properity */ switch (*property) { #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case '8': { if (LocaleNCompare("8bim:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; } #endif case 'B': case 'b': { if (LocaleCompare("background",property) == 0) { (void) QueryColorCompliance(value,AllCompliance, &image->background_color,exception); /* check for FUTURE: value exception?? */ /* also add user input to splay tree */ } break; /* not an attribute, add as a property */ } case 'C': case 'c': { if (LocaleCompare("channels",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } if (LocaleCompare("colorspace",property) == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse, value); if (colorspace < 0) return(MagickFalse); /* FUTURE: value exception?? */ return(SetImageColorspace(image,(ColorspaceType) colorspace,exception)); } if (LocaleCompare("compose",property) == 0) { ssize_t compose; compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value); if (compose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compose=(CompositeOperator) compose; return(MagickTrue); } if (LocaleCompare("compress",property) == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions,MagickFalse, value); if (compression < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compression=(CompressionType) compression; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'D': case 'd': { if (LocaleCompare("delay",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); if ((flags & GreaterValue) != 0) { if (image->delay > (size_t) floor(geometry_info.rho+0.5)) image->delay=(size_t) floor(geometry_info.rho+0.5); } else if ((flags & LessValue) != 0) { if (image->delay < (size_t) floor(geometry_info.rho+0.5)) image->delay=(ssize_t) floor(geometry_info.sigma+0.5); } else image->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5); return(MagickTrue); } if (LocaleCompare("delay_units",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } if (LocaleCompare("density",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; return(MagickTrue); } if (LocaleCompare("depth",property) == 0) { image->depth=StringToUnsignedLong(value); return(MagickTrue); } if (LocaleCompare("dispose",property) == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value); if (dispose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->dispose=(DisposeType) dispose; return(MagickTrue); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'E': case 'e': { if (LocaleNCompare("exif:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'F': case 'f': { if (LocaleNCompare("fx:",property,3) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif case 'G': case 'g': { if (LocaleCompare("gamma",property) == 0) { image->gamma=StringToDouble(value,(char **) NULL); return(MagickTrue); } if (LocaleCompare("gravity",property) == 0) { ssize_t gravity; gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value); if (gravity < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->gravity=(GravityType) gravity; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'H': case 'h': { if (LocaleCompare("height",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'I': case 'i': { if (LocaleCompare("intensity",property) == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,value); if (intensity < 0) return(MagickFalse); image->intensity=(PixelIntensityMethod) intensity; return(MagickTrue); } if (LocaleCompare("intent",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } if (LocaleCompare("interpolate",property) == 0) { ssize_t interpolate; interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, value); if (interpolate < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->interpolate=(PixelInterpolateMethod) interpolate; return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare("iptc:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } #endif break; /* not an attribute, add as a property */ } case 'K': case 'k': if (LocaleCompare("kurtosis",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'L': case 'l': { if (LocaleCompare("loop",property) == 0) { image->iterations=StringToUnsignedLong(value); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'M': case 'm': if ((LocaleCompare("magick",property) == 0) || (LocaleCompare("max",property) == 0) || (LocaleCompare("mean",property) == 0) || (LocaleCompare("min",property) == 0) || (LocaleCompare("min",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'O': case 'o': if (LocaleCompare("opaque",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'P': case 'p': { if (LocaleCompare("page",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare("pixel:",property,6) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } #endif if (LocaleCompare("profile",property) == 0) { ImageInfo *image_info; StringInfo *profile; image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,value,MagickPathExtent); (void) SetImageInfo(image_info,1,exception); profile=FileToStringInfo(image_info->filename,~0UL,exception); if (profile != (StringInfo *) NULL) status=SetImageProfile(image,image_info->magick,profile,exception); image_info=DestroyImageInfo(image_info); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'R': case 'r': { if (LocaleCompare("rendering-intent",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'S': case 's': if ((LocaleCompare("size",property) == 0) || (LocaleCompare("skewness",property) == 0) || (LocaleCompare("scenes",property) == 0) || (LocaleCompare("standard-deviation",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'T': case 't': { if (LocaleCompare("tile-offset",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'U': case 'u': { if (LocaleCompare("units",property) == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value); if (units < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->units=(ResolutionType) units; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'V': case 'v': { if (LocaleCompare("version",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'W': case 'w': { if (LocaleCompare("width",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'X': case 'x': { if (LocaleNCompare("xmp:",property,4) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif } /* Default: not an attribute, add as a property */ status=AddValueToSplayTree((SplayTreeInfo *) image->properties, ConstantString(property),ConstantString(value)); /* FUTURE: error if status is bad? */ return(status); }
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property,const char *value,ExceptionInfo *exception) { MagickBooleanType status; MagickStatusType flags; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (image->properties == (void *) NULL) image->properties=NewSplayTree(CompareSplayTreeString, RelinquishMagickMemory,RelinquishMagickMemory); /* create splay-tree */ if (value == (const char *) NULL) return(DeleteImageProperty(image,property)); /* delete if NULL */ status=MagickTrue; if (strlen(property) <= 1) { /* Do not 'set' single letter properties - read only shorthand. */ (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } /* FUTURE: binary chars or quotes in key should produce a error */ /* Set attributes with known names or special prefixes return result is found, or break to set a free form properity */ switch (*property) { #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case '8': { if (LocaleNCompare("8bim:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; } #endif case 'B': case 'b': { if (LocaleCompare("background",property) == 0) { (void) QueryColorCompliance(value,AllCompliance, &image->background_color,exception); /* check for FUTURE: value exception?? */ /* also add user input to splay tree */ } break; /* not an attribute, add as a property */ } case 'C': case 'c': { if (LocaleCompare("channels",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } if (LocaleCompare("colorspace",property) == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse, value); if (colorspace < 0) return(MagickFalse); /* FUTURE: value exception?? */ return(SetImageColorspace(image,(ColorspaceType) colorspace,exception)); } if (LocaleCompare("compose",property) == 0) { ssize_t compose; compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value); if (compose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compose=(CompositeOperator) compose; return(MagickTrue); } if (LocaleCompare("compress",property) == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions,MagickFalse, value); if (compression < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compression=(CompressionType) compression; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'D': case 'd': { if (LocaleCompare("delay",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); if ((flags & GreaterValue) != 0) { if (image->delay > (size_t) floor(geometry_info.rho+0.5)) image->delay=(size_t) floor(geometry_info.rho+0.5); } else if ((flags & LessValue) != 0) { if (image->delay < (size_t) floor(geometry_info.rho+0.5)) image->delay=(ssize_t) floor(geometry_info.sigma+0.5); } else image->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5); return(MagickTrue); } if (LocaleCompare("delay_units",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } if (LocaleCompare("density",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; return(MagickTrue); } if (LocaleCompare("depth",property) == 0) { image->depth=StringToUnsignedLong(value); return(MagickTrue); } if (LocaleCompare("dispose",property) == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value); if (dispose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->dispose=(DisposeType) dispose; return(MagickTrue); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'E': case 'e': { if (LocaleNCompare("exif:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'F': case 'f': { if (LocaleNCompare("fx:",property,3) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif case 'G': case 'g': { if (LocaleCompare("gamma",property) == 0) { image->gamma=StringToDouble(value,(char **) NULL); return(MagickTrue); } if (LocaleCompare("gravity",property) == 0) { ssize_t gravity; gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value); if (gravity < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->gravity=(GravityType) gravity; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'H': case 'h': { if (LocaleCompare("height",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'I': case 'i': { if (LocaleCompare("intensity",property) == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,value); if (intensity < 0) return(MagickFalse); image->intensity=(PixelIntensityMethod) intensity; return(MagickTrue); } if (LocaleCompare("intent",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } if (LocaleCompare("interpolate",property) == 0) { ssize_t interpolate; interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, value); if (interpolate < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->interpolate=(PixelInterpolateMethod) interpolate; return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare("iptc:",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } #endif break; /* not an attribute, add as a property */ } case 'K': case 'k': if (LocaleCompare("kurtosis",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'L': case 'l': { if (LocaleCompare("loop",property) == 0) { image->iterations=StringToUnsignedLong(value); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'M': case 'm': if ((LocaleCompare("magick",property) == 0) || (LocaleCompare("max",property) == 0) || (LocaleCompare("mean",property) == 0) || (LocaleCompare("min",property) == 0) || (LocaleCompare("min",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'O': case 'o': if (LocaleCompare("opaque",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'P': case 'p': { if (LocaleCompare("page",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare("pixel:",property,6) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } #endif if (LocaleCompare("profile",property) == 0) { ImageInfo *image_info; StringInfo *profile; image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,value,MagickPathExtent); (void) SetImageInfo(image_info,1,exception); profile=FileToStringInfo(image_info->filename,~0UL,exception); if (profile != (StringInfo *) NULL) status=SetImageProfile(image,image_info->magick,profile,exception); image_info=DestroyImageInfo(image_info); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'R': case 'r': { if (LocaleCompare("rendering-intent",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'S': case 's': if ((LocaleCompare("size",property) == 0) || (LocaleCompare("skewness",property) == 0) || (LocaleCompare("scenes",property) == 0) || (LocaleCompare("standard-deviation",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'T': case 't': { if (LocaleCompare("tile-offset",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'U': case 'u': { if (LocaleCompare("units",property) == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value); if (units < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->units=(ResolutionType) units; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'V': case 'v': { if (LocaleCompare("version",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'W': case 'w': { if (LocaleCompare("width",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'X': case 'x': { if (LocaleNCompare("xmp:",property,4) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "SetReadOnlyProperty","`%s'",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif } /* Default: not an attribute, add as a property */ status=AddValueToSplayTree((SplayTreeInfo *) image->properties, ConstantString(property),ConstantString(value)); /* FUTURE: error if status is bad? */ return(status); }
C
ImageMagick
0
CVE-2017-5093
https://www.cvedetails.com/cve/CVE-2017-5093/
CWE-20
https://github.com/chromium/chromium/commit/0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
If JavaScript shows a dialog, cause the page to lose fullscreen. BUG=670135, 550017, 726761, 728276 Review-Url: https://codereview.chromium.org/2906133004 Cr-Commit-Position: refs/heads/master@{#478884}
bool WebContentsImpl::IsShowingContextMenu() const { return showing_context_menu_; }
bool WebContentsImpl::IsShowingContextMenu() const { return showing_context_menu_; }
C
Chrome
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
void AXObject::tokenVectorFromAttribute(Vector<String>& tokens, const QualifiedName& attribute) const { Node* node = this->getNode(); if (!node || !node->isElementNode()) return; String attributeValue = getAttribute(attribute).getString(); if (attributeValue.isEmpty()) return; attributeValue.simplifyWhiteSpace(); attributeValue.split(' ', tokens); }
void AXObject::tokenVectorFromAttribute(Vector<String>& tokens, const QualifiedName& attribute) const { Node* node = this->getNode(); if (!node || !node->isElementNode()) return; String attributeValue = getAttribute(attribute).getString(); if (attributeValue.isEmpty()) return; attributeValue.simplifyWhiteSpace(); attributeValue.split(' ', tokens); }
C
Chrome
0
CVE-2011-3055
https://www.cvedetails.com/cve/CVE-2011-3055/
null
https://github.com/chromium/chromium/commit/e9372a1bfd3588a80fcf49aa07321f0971dd6091
e9372a1bfd3588a80fcf49aa07321f0971dd6091
[V8] Pass Isolate to throwNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=86983 Reviewed by Adam Barth. The objective is to pass Isolate around in V8 bindings. This patch passes Isolate to throwNotEnoughArgumentsError(). No tests. No change in behavior. * bindings/scripts/CodeGeneratorV8.pm: (GenerateArgumentsCountCheck): (GenerateEventConstructorCallback): * bindings/scripts/test/V8/V8Float64Array.cpp: (WebCore::Float64ArrayV8Internal::fooCallback): * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: (WebCore::TestActiveDOMObjectV8Internal::excitingFunctionCallback): (WebCore::TestActiveDOMObjectV8Internal::postMessageCallback): * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: (WebCore::TestCustomNamedGetterV8Internal::anotherFunctionCallback): * bindings/scripts/test/V8/V8TestEventConstructor.cpp: (WebCore::V8TestEventConstructor::constructorCallback): * bindings/scripts/test/V8/V8TestEventTarget.cpp: (WebCore::TestEventTargetV8Internal::itemCallback): (WebCore::TestEventTargetV8Internal::dispatchEventCallback): * bindings/scripts/test/V8/V8TestInterface.cpp: (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): (WebCore::V8TestInterface::constructorCallback): * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::TestMediaQueryListListenerV8Internal::methodCallback): * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: (WebCore::V8TestNamedConstructorConstructorCallback): * bindings/scripts/test/V8/V8TestObj.cpp: (WebCore::TestObjV8Internal::voidMethodWithArgsCallback): (WebCore::TestObjV8Internal::intMethodWithArgsCallback): (WebCore::TestObjV8Internal::objMethodWithArgsCallback): (WebCore::TestObjV8Internal::methodWithSequenceArgCallback): (WebCore::TestObjV8Internal::methodReturningSequenceCallback): (WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback): (WebCore::TestObjV8Internal::serializedValueCallback): (WebCore::TestObjV8Internal::idbKeyCallback): (WebCore::TestObjV8Internal::optionsObjectCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): (WebCore::TestObjV8Internal::methodWithCallbackArgCallback): (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback): (WebCore::TestObjV8Internal::overloadedMethod1Callback): (WebCore::TestObjV8Internal::overloadedMethod2Callback): (WebCore::TestObjV8Internal::overloadedMethod3Callback): (WebCore::TestObjV8Internal::overloadedMethod4Callback): (WebCore::TestObjV8Internal::overloadedMethod5Callback): (WebCore::TestObjV8Internal::overloadedMethod6Callback): (WebCore::TestObjV8Internal::overloadedMethod7Callback): (WebCore::TestObjV8Internal::overloadedMethod11Callback): (WebCore::TestObjV8Internal::overloadedMethod12Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback): (WebCore::TestObjV8Internal::convert1Callback): (WebCore::TestObjV8Internal::convert2Callback): (WebCore::TestObjV8Internal::convert3Callback): (WebCore::TestObjV8Internal::convert4Callback): (WebCore::TestObjV8Internal::convert5Callback): (WebCore::TestObjV8Internal::strictFunctionCallback): (WebCore::V8TestObj::constructorCallback): * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback): (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): * bindings/v8/ScriptController.cpp: (WebCore::setValueAndClosePopupCallback): * bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::throwNotEnoughArgumentsError): * bindings/v8/V8Proxy.h: (V8Proxy): * bindings/v8/custom/V8AudioContextCustom.cpp: (WebCore::V8AudioContext::constructorCallback): * bindings/v8/custom/V8DataViewCustom.cpp: (WebCore::V8DataView::getInt8Callback): (WebCore::V8DataView::getUint8Callback): (WebCore::V8DataView::setInt8Callback): (WebCore::V8DataView::setUint8Callback): * bindings/v8/custom/V8DirectoryEntryCustom.cpp: (WebCore::V8DirectoryEntry::getDirectoryCallback): (WebCore::V8DirectoryEntry::getFileCallback): * bindings/v8/custom/V8IntentConstructor.cpp: (WebCore::V8Intent::constructorCallback): * bindings/v8/custom/V8SVGLengthCustom.cpp: (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback): * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::getObjectParameter): (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback): (WebCore::V8WebGLRenderingContext::getExtensionCallback): (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback): (WebCore::V8WebGLRenderingContext::getParameterCallback): (WebCore::V8WebGLRenderingContext::getProgramParameterCallback): (WebCore::V8WebGLRenderingContext::getShaderParameterCallback): (WebCore::V8WebGLRenderingContext::getUniformCallback): (WebCore::vertexAttribAndUniformHelperf): (WebCore::uniformHelperi): (WebCore::uniformMatrixHelper): * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp: (WebCore::V8WebKitMutationObserver::constructorCallback): (WebCore::V8WebKitMutationObserver::observeCallback): * bindings/v8/custom/V8WebSocketCustom.cpp: (WebCore::V8WebSocket::constructorCallback): (WebCore::V8WebSocket::sendCallback): * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: (WebCore::V8XMLHttpRequest::openCallback): git-svn-id: svn://svn.chromium.org/blink/trunk@117736 bbb929c8-8fbe-4397-9dbb-9b2b20218538
v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; V8Proxy* proxy = 0; wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); if (!hasDependentLifetime) wrapperHandle.MarkIndependent(); V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapperHandle, isolate); return wrapper; }
v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; V8Proxy* proxy = 0; wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); if (!hasDependentLifetime) wrapperHandle.MarkIndependent(); V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapperHandle, isolate); return wrapper; }
C
Chrome
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.
static void json_delete_object(json_object_t *object) { hashtable_close(&object->hashtable); jsonp_free(object); }
static void json_delete_object(json_object_t *object) { hashtable_close(&object->hashtable); jsonp_free(object); }
C
jansson
0
CVE-2015-8816
https://www.cvedetails.com/cve/CVE-2015-8816/
null
https://github.com/torvalds/linux/commit/e50293ef9775c5f1cf3fcc093037dd6a8c5684ea
e50293ef9775c5f1cf3fcc093037dd6a8c5684ea
USB: fix invalid memory access in hub_activate() Commit 8520f38099cc ("USB: change hub initialization sleeps to delayed_work") changed the hub_activate() routine to make part of it run in a workqueue. However, the commit failed to take a reference to the usb_hub structure or to lock the hub interface while doing so. As a result, if a hub is plugged in and quickly unplugged before the work routine can run, the routine will try to access memory that has been deallocated. Or, if the hub is unplugged while the routine is running, the memory may be deallocated while it is in active use. This patch fixes the problem by taking a reference to the usb_hub at the start of hub_activate() and releasing it at the end (when the work is finished), and by locking the hub interface while the work routine is running. It also adds a check at the start of the routine to see if the hub has already been disconnected, in which nothing should be done. Signed-off-by: Alan Stern <[email protected]> Reported-by: Alexandru Cornea <[email protected]> Tested-by: Alexandru Cornea <[email protected]> Fixes: 8520f38099cc ("USB: change hub initialization sleeps to delayed_work") CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
void usb_disconnect(struct usb_device **pdev) { struct usb_port *port_dev = NULL; struct usb_device *udev = *pdev; struct usb_hub *hub = NULL; int port1 = 1; /* mark the device as inactive, so any further urb submissions for * this device (and any of its children) will fail immediately. * this quiesces everything except pending urbs. */ usb_set_device_state(udev, USB_STATE_NOTATTACHED); dev_info(&udev->dev, "USB disconnect, device number %d\n", udev->devnum); usb_lock_device(udev); hub_disconnect_children(udev); /* deallocate hcd/hardware state ... nuking all pending urbs and * cleaning up all state associated with the current configuration * so that the hardware is now fully quiesced. */ dev_dbg(&udev->dev, "unregistering device\n"); usb_disable_device(udev, 0); usb_hcd_synchronize_unlinks(udev); if (udev->parent) { port1 = udev->portnum; hub = usb_hub_to_struct_hub(udev->parent); port_dev = hub->ports[port1 - 1]; sysfs_remove_link(&udev->dev.kobj, "port"); sysfs_remove_link(&port_dev->dev.kobj, "device"); /* * As usb_port_runtime_resume() de-references udev, make * sure no resumes occur during removal */ if (!test_and_set_bit(port1, hub->child_usage_bits)) pm_runtime_get_sync(&port_dev->dev); } usb_remove_ep_devs(&udev->ep0); usb_unlock_device(udev); /* Unregister the device. The device driver is responsible * for de-configuring the device and invoking the remove-device * notifier chain (used by usbfs and possibly others). */ device_del(&udev->dev); /* Free the device number and delete the parent's children[] * (or root_hub) pointer. */ release_devnum(udev); /* Avoid races with recursively_mark_NOTATTACHED() */ spin_lock_irq(&device_state_lock); *pdev = NULL; spin_unlock_irq(&device_state_lock); if (port_dev && test_and_clear_bit(port1, hub->child_usage_bits)) pm_runtime_put(&port_dev->dev); hub_free_dev(udev); put_device(&udev->dev); }
void usb_disconnect(struct usb_device **pdev) { struct usb_port *port_dev = NULL; struct usb_device *udev = *pdev; struct usb_hub *hub = NULL; int port1 = 1; /* mark the device as inactive, so any further urb submissions for * this device (and any of its children) will fail immediately. * this quiesces everything except pending urbs. */ usb_set_device_state(udev, USB_STATE_NOTATTACHED); dev_info(&udev->dev, "USB disconnect, device number %d\n", udev->devnum); usb_lock_device(udev); hub_disconnect_children(udev); /* deallocate hcd/hardware state ... nuking all pending urbs and * cleaning up all state associated with the current configuration * so that the hardware is now fully quiesced. */ dev_dbg(&udev->dev, "unregistering device\n"); usb_disable_device(udev, 0); usb_hcd_synchronize_unlinks(udev); if (udev->parent) { port1 = udev->portnum; hub = usb_hub_to_struct_hub(udev->parent); port_dev = hub->ports[port1 - 1]; sysfs_remove_link(&udev->dev.kobj, "port"); sysfs_remove_link(&port_dev->dev.kobj, "device"); /* * As usb_port_runtime_resume() de-references udev, make * sure no resumes occur during removal */ if (!test_and_set_bit(port1, hub->child_usage_bits)) pm_runtime_get_sync(&port_dev->dev); } usb_remove_ep_devs(&udev->ep0); usb_unlock_device(udev); /* Unregister the device. The device driver is responsible * for de-configuring the device and invoking the remove-device * notifier chain (used by usbfs and possibly others). */ device_del(&udev->dev); /* Free the device number and delete the parent's children[] * (or root_hub) pointer. */ release_devnum(udev); /* Avoid races with recursively_mark_NOTATTACHED() */ spin_lock_irq(&device_state_lock); *pdev = NULL; spin_unlock_irq(&device_state_lock); if (port_dev && test_and_clear_bit(port1, hub->child_usage_bits)) pm_runtime_put(&port_dev->dev); hub_free_dev(udev); put_device(&udev->dev); }
C
linux
0
CVE-2018-0494
https://www.cvedetails.com/cve/CVE-2018-0494/
CWE-20
https://git.savannah.gnu.org/cgit/wget.git/commit/?id=1fc9c95ec144499e69dc8ec76dbe07799d7d82cd
1fc9c95ec144499e69dc8ec76dbe07799d7d82cd
null
http_cleanup (void) { xfree (pconn.host); if (wget_cookie_jar) cookie_jar_delete (wget_cookie_jar); }
http_cleanup (void) { xfree (pconn.host); if (wget_cookie_jar) cookie_jar_delete (wget_cookie_jar); }
C
savannah
0
CVE-2013-0349
https://www.cvedetails.com/cve/CVE-2013-0349/
CWE-200
https://github.com/torvalds/linux/commit/0a9ab9bdb3e891762553f667066190c1d22ad62b
0a9ab9bdb3e891762553f667066190c1d22ad62b
Bluetooth: Fix incorrect strncpy() in hidp_setup_hid() The length parameter should be sizeof(req->name) - 1 because there is no guarantee that string provided by userspace will contain the trailing '\0'. Can be easily reproduced by manually setting req->name to 128 non-zero bytes prior to ioctl(HIDPCONNADD) and checking the device name setup on input subsystem: $ cat /sys/devices/pnp0/00\:04/tty/ttyS0/hci0/hci0\:1/input8/name AAAAAA[...]AAAAAAAAf0:af:f0:af:f0:af ("f0:af:f0:af:f0:af" is the device bluetooth address, taken from "phys" field in struct hid_device due to overflow.) Cc: [email protected] Signed-off-by: Anderson Lizardo <[email protected]> Acked-by: Marcel Holtmann <[email protected]> Signed-off-by: Gustavo Padovan <[email protected]>
static int hidp_send_frame(struct socket *sock, unsigned char *data, int len) { struct kvec iv = { data, len }; struct msghdr msg; BT_DBG("sock %p data %p len %d", sock, data, len); if (!len) return 0; memset(&msg, 0, sizeof(msg)); return kernel_sendmsg(sock, &msg, &iv, 1, len); }
static int hidp_send_frame(struct socket *sock, unsigned char *data, int len) { struct kvec iv = { data, len }; struct msghdr msg; BT_DBG("sock %p data %p len %d", sock, data, len); if (!len) return 0; memset(&msg, 0, sizeof(msg)); return kernel_sendmsg(sock, &msg, &iv, 1, len); }
C
linux
0
CVE-2016-9588
https://www.cvedetails.com/cve/CVE-2016-9588/
CWE-388
https://github.com/torvalds/linux/commit/ef85b67385436ddc1998f45f1d6a210f935b3388
ef85b67385436ddc1998f45f1d6a210f935b3388
kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF) When L2 exits to L0 due to "exception or NMI", software exceptions (#BP and #OF) for which L1 has requested an intercept should be handled by L1 rather than L0. Previously, only hardware exceptions were forwarded to L1. Signed-off-by: Jim Mattson <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
static int nested_vmx_store_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) { u32 i; struct vmx_msr_entry e; for (i = 0; i < count; i++) { struct msr_data msr_info; if (kvm_vcpu_read_guest(vcpu, gpa + i * sizeof(e), &e, 2 * sizeof(u32))) { pr_debug_ratelimited( "%s cannot read MSR entry (%u, 0x%08llx)\n", __func__, i, gpa + i * sizeof(e)); return -EINVAL; } if (nested_vmx_store_msr_check(vcpu, &e)) { pr_debug_ratelimited( "%s check failed (%u, 0x%x, 0x%x)\n", __func__, i, e.index, e.reserved); return -EINVAL; } msr_info.host_initiated = false; msr_info.index = e.index; if (kvm_get_msr(vcpu, &msr_info)) { pr_debug_ratelimited( "%s cannot read MSR (%u, 0x%x)\n", __func__, i, e.index); return -EINVAL; } if (kvm_vcpu_write_guest(vcpu, gpa + i * sizeof(e) + offsetof(struct vmx_msr_entry, value), &msr_info.data, sizeof(msr_info.data))) { pr_debug_ratelimited( "%s cannot write MSR (%u, 0x%x, 0x%llx)\n", __func__, i, e.index, msr_info.data); return -EINVAL; } } return 0; }
static int nested_vmx_store_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) { u32 i; struct vmx_msr_entry e; for (i = 0; i < count; i++) { struct msr_data msr_info; if (kvm_vcpu_read_guest(vcpu, gpa + i * sizeof(e), &e, 2 * sizeof(u32))) { pr_debug_ratelimited( "%s cannot read MSR entry (%u, 0x%08llx)\n", __func__, i, gpa + i * sizeof(e)); return -EINVAL; } if (nested_vmx_store_msr_check(vcpu, &e)) { pr_debug_ratelimited( "%s check failed (%u, 0x%x, 0x%x)\n", __func__, i, e.index, e.reserved); return -EINVAL; } msr_info.host_initiated = false; msr_info.index = e.index; if (kvm_get_msr(vcpu, &msr_info)) { pr_debug_ratelimited( "%s cannot read MSR (%u, 0x%x)\n", __func__, i, e.index); return -EINVAL; } if (kvm_vcpu_write_guest(vcpu, gpa + i * sizeof(e) + offsetof(struct vmx_msr_entry, value), &msr_info.data, sizeof(msr_info.data))) { pr_debug_ratelimited( "%s cannot write MSR (%u, 0x%x, 0x%llx)\n", __func__, i, e.index, msr_info.data); return -EINVAL; } } return 0; }
C
linux
0
CVE-2012-2896
https://www.cvedetails.com/cve/CVE-2012-2896/
CWE-189
https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984
3aad1a37affb1ab70d1897f2b03eb8c077264984
Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98
bool GLES2DecoderImpl::DoIsProgram(GLuint client_id) { const ProgramManager::ProgramInfo* program = GetProgramInfo(client_id); return program != NULL && !program->IsDeleted(); }
bool GLES2DecoderImpl::DoIsProgram(GLuint client_id) { const ProgramManager::ProgramInfo* program = GetProgramInfo(client_id); return program != NULL && !program->IsDeleted(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e
ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e
Clean up calls like "gfx::Rect(0, 0, size().width(), size().height()". The caller can use the much shorter "gfx::Rect(size())", since gfx::Rect has a constructor that just takes a Size. BUG=none TEST=none Review URL: http://codereview.chromium.org/2204001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48283 0039d316-1c4b-4281-b951-d872f2087c98
void AeroPeekWindow::OnActivate(UINT action, BOOL minimized, HWND window) { if (action == WA_INACTIVE) return; if (delegate_) delegate_->ActivateTab(tab_id_); }
void AeroPeekWindow::OnActivate(UINT action, BOOL minimized, HWND window) { if (action == WA_INACTIVE) return; if (delegate_) delegate_->ActivateTab(tab_id_); }
C
Chrome
0
CVE-2012-1179
https://www.cvedetails.com/cve/CVE-2012-1179/
CWE-264
https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850
4a1d704194a441bf83c636004a479e01360ec850
mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [[email protected]: checkpatch fixes] Reported-by: Ulrich Obergfell <[email protected]> Signed-off-by: Andrea Arcangeli <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Dave Jones <[email protected]> Acked-by: Larry Woodman <[email protected]> Acked-by: Rik van Riel <[email protected]> Cc: Mark Salter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static void *m_start(struct seq_file *m, loff_t *pos) { struct proc_maps_private *priv = m->private; unsigned long last_addr = m->version; struct mm_struct *mm; struct vm_area_struct *vma, *tail_vma = NULL; loff_t l = *pos; /* Clear the per syscall fields in priv */ priv->task = NULL; priv->tail_vma = NULL; /* * We remember last_addr rather than next_addr to hit with * mmap_cache most of the time. We have zero last_addr at * the beginning and also after lseek. We will have -1 last_addr * after the end of the vmas. */ if (last_addr == -1UL) return NULL; priv->task = get_pid_task(priv->pid, PIDTYPE_PID); if (!priv->task) return ERR_PTR(-ESRCH); mm = mm_for_maps(priv->task); if (!mm || IS_ERR(mm)) return mm; down_read(&mm->mmap_sem); tail_vma = get_gate_vma(priv->task->mm); priv->tail_vma = tail_vma; /* Start with last addr hint */ vma = find_vma(mm, last_addr); if (last_addr && vma) { vma = vma->vm_next; goto out; } /* * Check the vma index is within the range and do * sequential scan until m_index. */ vma = NULL; if ((unsigned long)l < mm->map_count) { vma = mm->mmap; while (l-- && vma) vma = vma->vm_next; goto out; } if (l != mm->map_count) tail_vma = NULL; /* After gate vma */ out: if (vma) return vma; /* End of vmas has been reached */ m->version = (tail_vma != NULL)? 0: -1UL; up_read(&mm->mmap_sem); mmput(mm); return tail_vma; }
static void *m_start(struct seq_file *m, loff_t *pos) { struct proc_maps_private *priv = m->private; unsigned long last_addr = m->version; struct mm_struct *mm; struct vm_area_struct *vma, *tail_vma = NULL; loff_t l = *pos; /* Clear the per syscall fields in priv */ priv->task = NULL; priv->tail_vma = NULL; /* * We remember last_addr rather than next_addr to hit with * mmap_cache most of the time. We have zero last_addr at * the beginning and also after lseek. We will have -1 last_addr * after the end of the vmas. */ if (last_addr == -1UL) return NULL; priv->task = get_pid_task(priv->pid, PIDTYPE_PID); if (!priv->task) return ERR_PTR(-ESRCH); mm = mm_for_maps(priv->task); if (!mm || IS_ERR(mm)) return mm; down_read(&mm->mmap_sem); tail_vma = get_gate_vma(priv->task->mm); priv->tail_vma = tail_vma; /* Start with last addr hint */ vma = find_vma(mm, last_addr); if (last_addr && vma) { vma = vma->vm_next; goto out; } /* * Check the vma index is within the range and do * sequential scan until m_index. */ vma = NULL; if ((unsigned long)l < mm->map_count) { vma = mm->mmap; while (l-- && vma) vma = vma->vm_next; goto out; } if (l != mm->map_count) tail_vma = NULL; /* After gate vma */ out: if (vma) return vma; /* End of vmas has been reached */ m->version = (tail_vma != NULL)? 0: -1UL; up_read(&mm->mmap_sem); mmput(mm); return tail_vma; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/76f36a8362a3e817cc3ec721d591f2f8878dc0c7
76f36a8362a3e817cc3ec721d591f2f8878dc0c7
Scheduler/child/TimeSource could be replaced with base/time/DefaultTickClock. They both are totally same and TimeSource is removed. BUG=494892 [email protected], [email protected] Review URL: https://codereview.chromium.org/1163143002 Cr-Commit-Position: refs/heads/master@{#333035}
const char* TaskQueueManager::PumpPolicyToString( TaskQueueManager::PumpPolicy pump_policy) { switch (pump_policy) { case TaskQueueManager::PumpPolicy::AUTO: return "auto"; case TaskQueueManager::PumpPolicy::AFTER_WAKEUP: return "after_wakeup"; case TaskQueueManager::PumpPolicy::MANUAL: return "manual"; default: NOTREACHED(); return nullptr; } }
const char* TaskQueueManager::PumpPolicyToString( TaskQueueManager::PumpPolicy pump_policy) { switch (pump_policy) { case TaskQueueManager::PumpPolicy::AUTO: return "auto"; case TaskQueueManager::PumpPolicy::AFTER_WAKEUP: return "after_wakeup"; case TaskQueueManager::PumpPolicy::MANUAL: return "manual"; default: NOTREACHED(); return nullptr; } }
C
Chrome
0
CVE-2015-1281
https://www.cvedetails.com/cve/CVE-2015-1281/
CWE-254
https://github.com/chromium/chromium/commit/dff368031150a1033a1a3c913f8857679a0279be
dff368031150a1033a1a3c913f8857679a0279be
Correctly keep track of isolates for microtask execution BUG=487155 [email protected] Review URL: https://codereview.chromium.org/1161823002 git-svn-id: svn://svn.chromium.org/blink/trunk@195985 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool layoutTestMode() { return LayoutTestSupport::isRunningLayoutTest(); }
bool layoutTestMode() { return LayoutTestSupport::isRunningLayoutTest(); }
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 <[email protected]> Reviewed-by: Sylvain Defresne <[email protected]> Cr-Commit-Position: refs/heads/master@{#514861}
void DeleteURL(const GURL& url) { history_service()->DeleteURL(url); }
void DeleteURL(const GURL& url) { history_service()->DeleteURL(url); }
C
Chrome
0