instruction
stringclasses
1 value
input
stringlengths
56
241k
output
int64
0
1
__index_level_0__
int64
0
175k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void cm_release_port_obj(struct kobject *obj) { struct cm_port *cm_port; cm_port = container_of(obj, struct cm_port, port_obj); kfree(cm_port); } Commit Message: IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler The code that resolves the passive side source MAC within the rdma_cm connection request handler was both redundant and buggy, so remove it. It was redundant since later, when an RC QP is modified to RTR state, the resolution will take place in the ib_core module. It was buggy because this callback also deals with UD SIDR exchange, for which we incorrectly looked at the REQ member of the CM event and dereferenced a random value. Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures") Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> CWE ID: CWE-20
0
38,414
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void CL_Video_f( void ) { char filename[ MAX_OSPATH ]; int i, last; if( !clc.demoplaying ) { Com_Printf( "The video command can only be used when playing back demos\n" ); return; } if( Cmd_Argc( ) == 2 ) { Com_sprintf( filename, MAX_OSPATH, "videos/%s.avi", Cmd_Argv( 1 ) ); } else { for( i = 0; i <= 9999; i++ ) { int a, b, c, d; last = i; a = last / 1000; last -= a * 1000; b = last / 100; last -= b * 100; c = last / 10; last -= c * 10; d = last; Com_sprintf( filename, MAX_OSPATH, "videos/video%d%d%d%d.avi", a, b, c, d ); if( !FS_FileExists( filename ) ) break; // file doesn't exist } if( i > 9999 ) { Com_Printf( S_COLOR_RED "ERROR: no free file names to create video\n" ); return; } } CL_OpenAVIForWriting( filename ); } Commit Message: All: Don't load .pk3s as .dlls, and don't load user config files from .pk3s CWE ID: CWE-269
0
95,745
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned stackDepth() const { return m_stack.size(); } Commit Message: Replace further questionable HashMap::add usages in bindings BUG=390928 R=dcarney@chromium.org Review URL: https://codereview.chromium.org/411273002 git-svn-id: svn://svn.chromium.org/blink/trunk@178823 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID:
0
120,531
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void ssl_write_extended_ms_ext( mbedtls_ssl_context *ssl, unsigned char *buf, size_t *olen ) { unsigned char *p = buf; if( ssl->handshake->extended_ms == MBEDTLS_SSL_EXTENDED_MS_DISABLED || ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) { *olen = 0; return; } MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, adding extended master secret " "extension" ) ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET ) & 0xFF ); *p++ = 0x00; *p++ = 0x00; *olen = 4; } Commit Message: Prevent bounds check bypass through overflow in PSK identity parsing The check `if( *p + n > end )` in `ssl_parse_client_psk_identity` is unsafe because `*p + n` might overflow, thus bypassing the check. As `n` is a user-specified value up to 65K, this is relevant if the library happens to be located in the last 65K of virtual memory. This commit replaces the check by a safe version. CWE ID: CWE-190
0
86,144
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool AutocompleteEditModel::MaybeAcceptKeywordBySpace( const string16& new_text) { size_t keyword_length = new_text.length() - 1; return (paste_state_ == NONE) && is_keyword_hint_ && !keyword_.empty() && inline_autocomplete_text_.empty() && (keyword_.length() == keyword_length) && IsSpaceCharForAcceptingKeyword(new_text[keyword_length]) && !new_text.compare(0, keyword_length, keyword_, 0, keyword_length) && AcceptKeyword(); } Commit Message: Adds per-provider information to omnibox UMA logs. Adds a fairly general structure to omnibox logs that can be used to pass information (that's not per-result information) from providers to the UMA logs. Right now it's only used to pass whether the asynchronous pass of a provider has finished, but it will probably be used for other things in the future. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10380007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137288 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
103,847
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ContentEncoding::ContentEncryption::ContentEncryption() : algo(0), key_id(NULL), key_id_len(0), signature(NULL), signature_len(0), sig_key_id(NULL), sig_key_id_len(0), sig_algo(0), sig_hash_algo(0) {} Commit Message: external/libvpx/libwebm: Update snapshot Update libwebm snapshot. This update contains security fixes from upstream. Upstream git hash: 229f49347d19b0ca0941e072b199a242ef6c5f2b BUG=23167726 Change-Id: Id3e140e7b31ae11294724b1ecfe2e9c83b4d4207 (cherry picked from commit d0281a15b3c6bd91756e453cc9398c5ef412d99a) CWE ID: CWE-20
0
160,714
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) { CRYPTO_RWLOCK *lock; *(unsigned int *)lock = 1; return lock; } Commit Message: CWE ID: CWE-330
0
12,044
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool ContextualSearchFieldTrial::HasSwitch(const std::string& name) { return base::CommandLine::ForCurrentProcess()->HasSwitch(name); } Commit Message: [Contextual Search] Change "Now on Tap" to "Contextual Cards" BUG=644934 Review-Url: https://codereview.chromium.org/2361163003 Cr-Commit-Position: refs/heads/master@{#420899} CWE ID:
0
120,258
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct vmcs *alloc_vmcs(void) { return alloc_vmcs_cpu(raw_smp_processor_id()); } Commit Message: x86,kvm,vmx: Preserve CR4 across VM entry CR4 isn't constant; at least the TSD and PCE bits can vary. TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct. This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Cc: stable@vger.kernel.org Cc: Petr Matousek <pmatouse@redhat.com> Cc: Gleb Natapov <gleb@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-399
0
36,986
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: EOFStream::~EOFStream() { delete str; } Commit Message: CWE ID: CWE-119
0
4,069
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Profile* ProfileForWebContents(content::WebContents* web_contents) { if (!web_contents) return NULL; return Profile::FromBrowserContext(web_contents->GetBrowserContext()); } Commit Message: Make the webstore inline install dialog be tab-modal Also clean up a few minor lint errors while I'm in here. BUG=550047 Review URL: https://codereview.chromium.org/1496033003 Cr-Commit-Position: refs/heads/master@{#363925} CWE ID: CWE-17
0
131,709
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int scan(struct ctl_table_header *head, struct ctl_table *table, unsigned long *pos, struct file *file, struct dir_context *ctx) { bool res; if ((*pos)++ < ctx->pos) return true; if (unlikely(S_ISLNK(table->mode))) res = proc_sys_link_fill_cache(file, ctx, head, table); else res = proc_sys_fill_cache(file, ctx, head, table); if (res) ctx->pos = *pos; return res; } Commit Message: sysctl: Drop reference added by grab_header in proc_sys_readdir Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any path called unregister_sysctl_table will wait forever. The calltrace of CVE-2016-9191: [ 5535.960522] Call Trace: [ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0 [ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0 [ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130 [ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130 [ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80 [ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0 [ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0 [ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0 [ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0 [ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40 [ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450 [ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0 [ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0 [ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210 [ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60 [ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10 [ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220 [ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60 [ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220 [ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710 [ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710 [ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0 [ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710 [ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120 [ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40 [ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230 One cgroup maintainer mentioned that "cgroup is trying to offline a cpuset css, which takes place under cgroup_mutex. The offlining ends up trying to drain active usages of a sysctl table which apprently is not happening." The real reason is that proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. So this cpuset offline path will wait here forever. See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13 Fixes: f0c3b5093add ("[readdir] convert procfs") Cc: stable@vger.kernel.org Reported-by: CAI Qian <caiqian@redhat.com> Tested-by: Yang Shukui <yangshukui@huawei.com> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com> Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> CWE ID: CWE-20
0
48,495
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_timer_user *tu; void __user *argp = (void __user *)arg; int __user *p = argp; tu = file->private_data; switch (cmd) { case SNDRV_TIMER_IOCTL_PVERSION: return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0; case SNDRV_TIMER_IOCTL_NEXT_DEVICE: return snd_timer_user_next_device(argp); case SNDRV_TIMER_IOCTL_TREAD: { int xarg; mutex_lock(&tu->tread_sem); if (tu->timeri) { /* too late */ mutex_unlock(&tu->tread_sem); return -EBUSY; } if (get_user(xarg, p)) { mutex_unlock(&tu->tread_sem); return -EFAULT; } tu->tread = xarg ? 1 : 0; mutex_unlock(&tu->tread_sem); return 0; } case SNDRV_TIMER_IOCTL_GINFO: return snd_timer_user_ginfo(file, argp); case SNDRV_TIMER_IOCTL_GPARAMS: return snd_timer_user_gparams(file, argp); case SNDRV_TIMER_IOCTL_GSTATUS: return snd_timer_user_gstatus(file, argp); case SNDRV_TIMER_IOCTL_SELECT: return snd_timer_user_tselect(file, argp); case SNDRV_TIMER_IOCTL_INFO: return snd_timer_user_info(file, argp); case SNDRV_TIMER_IOCTL_PARAMS: return snd_timer_user_params(file, argp); case SNDRV_TIMER_IOCTL_STATUS: return snd_timer_user_status(file, argp); case SNDRV_TIMER_IOCTL_START: case SNDRV_TIMER_IOCTL_START_OLD: return snd_timer_user_start(file); case SNDRV_TIMER_IOCTL_STOP: case SNDRV_TIMER_IOCTL_STOP_OLD: return snd_timer_user_stop(file); case SNDRV_TIMER_IOCTL_CONTINUE: case SNDRV_TIMER_IOCTL_CONTINUE_OLD: return snd_timer_user_continue(file); case SNDRV_TIMER_IOCTL_PAUSE: case SNDRV_TIMER_IOCTL_PAUSE_OLD: return snd_timer_user_pause(file); } return -ENOTTY; } Commit Message: ALSA: timer: Fix race among timer ioctls ALSA timer ioctls have an open race and this may lead to a use-after-free of timer instance object. A simplistic fix is to make each ioctl exclusive. We have already tread_sem for controlling the tread, and extend this as a global mutex to be applied to each ioctl. The downside is, of course, the worse concurrency. But these ioctls aren't to be parallel accessible, in anyway, so it should be fine to serialize there. Reported-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> CWE ID: CWE-362
1
167,404
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BlobURLRegistry::registerURL(SecurityOrigin* origin, const KURL& publicURL, URLRegistrable* blob) { ASSERT(&blob->registry() == this); ThreadableBlobRegistry::registerBlobURL(origin, publicURL, static_cast<Blob*>(blob)->url()); } Commit Message: Remove BlobRegistry indirection since there is only one implementation. BUG= Review URL: https://chromiumcodereview.appspot.com/15851008 git-svn-id: svn://svn.chromium.org/blink/trunk@152746 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID:
1
170,677
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void TestSubsequenceBecomesEmpty() { FakeDisplayItemClient target("target"); GraphicsContext context(GetPaintController()); InitRootChunk(); { SubsequenceRecorder r(context, target); DrawRect(context, target, kBackgroundType, FloatRect(100, 100, 300, 300)); } GetPaintController().CommitNewDisplayItems(); InitRootChunk(); { EXPECT_FALSE( SubsequenceRecorder::UseCachedSubsequenceIfPossible(context, target)); SubsequenceRecorder r(context, target); } GetPaintController().CommitNewDisplayItems(); } Commit Message: Reland "[CI] Make paint property nodes non-ref-counted" This reverts commit 887383b30842d9d9006e11bb6932660a3cb5b1b7. Reason for revert: Retry in M69. Original change's description: > Revert "[CI] Make paint property nodes non-ref-counted" > > This reverts commit 70fc0b018c9517558b7aa2be00edf2debb449123. > > Reason for revert: Caused bugs found by clusterfuzz > > Original change's description: > > [CI] Make paint property nodes non-ref-counted > > > > Now all paint property nodes are owned by ObjectPaintProperties > > (and LocalFrameView temporarily before removing non-RLS mode). > > Others just use raw pointers or references. > > > > Bug: 833496 > > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > > Change-Id: I2d544fe153bb94698623248748df63c8aa2081ae > > Reviewed-on: https://chromium-review.googlesource.com/1031101 > > Reviewed-by: Tien-Ren Chen <trchen@chromium.org> > > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#554626} > > TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org > > Change-Id: I02bb50d6744cb81a797246a0116b677e80a3c69f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 833496,837932,837943 > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > Reviewed-on: https://chromium-review.googlesource.com/1034292 > Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > Cr-Commit-Position: refs/heads/master@{#554653} TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 833496, 837932, 837943 Change-Id: I0b4ef70db1f1f211ba97c30d617225355c750992 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Reviewed-on: https://chromium-review.googlesource.com/1083491 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/master@{#563930} CWE ID:
0
125,694
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void ext4_i_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); } Commit Message: ext4: fix races between page faults and hole punching Currently, page faults and hole punching are completely unsynchronized. This can result in page fault faulting in a page into a range that we are punching after truncate_pagecache_range() has been called and thus we can end up with a page mapped to disk blocks that will be shortly freed. Filesystem corruption will shortly follow. Note that the same race is avoided for truncate by checking page fault offset against i_size but there isn't similar mechanism available for punching holes. Fix the problem by creating new rw semaphore i_mmap_sem in inode and grab it for writing over truncate, hole punching, and other functions removing blocks from extent tree and for read over page faults. We cannot easily use i_data_sem for this since that ranks below transaction start and we need something ranking above it so that it can be held over the whole truncate / hole punching operation. Also remove various workarounds we had in the code to reduce race window when page fault could have created pages with stale mapping information. Signed-off-by: Jan Kara <jack@suse.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> CWE ID: CWE-362
0
56,672
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PanoramiXRenderSetPictureTransform (ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client); if(result != Success) break; } return result; } Commit Message: CWE ID: CWE-20
0
14,046
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2Implementation::CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei image_size, const void* data) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG( "[" << GetLogPrefix() << "] glCompressedTexImage3D(" << GLES2Util::GetStringTexture3DTarget(target) << ", " << level << ", " << GLES2Util::GetStringCompressedTextureFormat(internalformat) << ", " << width << ", " << height << ", " << depth << ", " << border << ", " << image_size << ", " << static_cast<const void*>(data) << ")"); if (width < 0 || height < 0 || depth < 0 || level < 0) { SetGLError(GL_INVALID_VALUE, "glCompressedTexImage3D", "dimension < 0"); return; } if (border != 0) { SetGLError(GL_INVALID_VALUE, "glCompressedTexImage3D", "border != 0"); return; } if (bound_pixel_unpack_transfer_buffer_id_) { GLuint offset = ToGLuint(data); BufferTracker::Buffer* buffer = GetBoundPixelTransferBufferIfValid( bound_pixel_unpack_transfer_buffer_id_, "glCompressedTexImage3D", offset, image_size); if (buffer && buffer->shm_id() != -1) { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, buffer->shm_id(), buffer->shm_offset() + offset); buffer->set_last_usage_token(helper_->InsertToken()); } return; } if (bound_pixel_unpack_buffer_) { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, 0, ToGLuint(data)); } else if (data) { SetBucketContents(kResultBucketId, data, image_size); helper_->CompressedTexImage3DBucket(target, level, internalformat, width, height, depth, kResultBucketId); helper_->SetBucketSize(kResultBucketId, 0); } else { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, 0, 0); } CheckGLError(); } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#657568} CWE ID: CWE-416
0
140,899
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Profile* ExtensionBrowserTest::profile() { if (!profile_) { if (browser()) profile_ = browser()->profile(); else profile_ = ProfileManager::GetActiveUserProfile(); } return profile_; } Commit Message: [Extensions] Update navigations across hypothetical extension extents Update code to treat navigations across hypothetical extension extents (e.g. for nonexistent extensions) the same as we do for navigations crossing installed extension extents. Bug: 598265 Change-Id: Ibdf2f563ce1fd108ead279077901020a24de732b Reviewed-on: https://chromium-review.googlesource.com/617180 Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Cr-Commit-Position: refs/heads/master@{#495779} CWE ID:
0
151,045
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: add_mlist(struct mlist *mlp, struct magic_map *map, size_t idx) { struct mlist *ml; if ((ml = CAST(struct mlist *, emalloc(sizeof(*ml)))) == NULL) return -1; ml->map = idx == 0 ? map : NULL; ml->magic = map->magic[idx]; ml->nmagic = map->nmagic[idx]; mlp->prev->next = ml; ml->prev = mlp->prev; ml->next = mlp; mlp->prev = ml; return 0; } Commit Message: CWE ID: CWE-17
0
7,369
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) { uint64_t res = NO_SUCH_LUN; int addressing_method; if (unlikely(len < 2)) { pr_err("Illegal LUN length %d, expected 2 bytes or more\n", len); goto out; } switch (len) { case 8: if ((*((__be64 *)lun) & cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) goto out_err; break; case 4: if (*((__be16 *)&lun[2]) != 0) goto out_err; break; case 6: if (*((__be32 *)&lun[2]) != 0) goto out_err; break; case 2: break; default: goto out_err; } addressing_method = (*lun) >> 6; /* highest two bits of byte 0 */ switch (addressing_method) { case SCSI_LUN_ADDR_METHOD_PERIPHERAL: case SCSI_LUN_ADDR_METHOD_FLAT: case SCSI_LUN_ADDR_METHOD_LUN: res = *(lun + 1) | (((*lun) & 0x3f) << 8); break; case SCSI_LUN_ADDR_METHOD_EXTENDED_LUN: default: pr_err("Unimplemented LUN addressing method %u\n", addressing_method); break; } out: return res; out_err: pr_err("Support for multi-level LUNs has not yet been implemented\n"); goto out; } Commit Message: IB/srpt: Simplify srpt_handle_tsk_mgmt() Let the target core check task existence instead of the SRP target driver. Additionally, let the target core check the validity of the task management request instead of the ib_srpt driver. This patch fixes the following kernel crash: BUG: unable to handle kernel NULL pointer dereference at 0000000000000001 IP: [<ffffffffa0565f37>] srpt_handle_new_iu+0x6d7/0x790 [ib_srpt] Oops: 0002 [#1] SMP Call Trace: [<ffffffffa05660ce>] srpt_process_completion+0xde/0x570 [ib_srpt] [<ffffffffa056669f>] srpt_compl_thread+0x13f/0x160 [ib_srpt] [<ffffffff8109726f>] kthread+0xcf/0xe0 [<ffffffff81613cfc>] ret_from_fork+0x7c/0xb0 Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Fixes: 3e4f574857ee ("ib_srpt: Convert TMR path to target_submit_tmr") Tested-by: Alex Estrin <alex.estrin@intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Nicholas Bellinger <nab@linux-iscsi.org> Cc: Sagi Grimberg <sagig@mellanox.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> CWE ID: CWE-476
0
50,718
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PasswordAutofillAgent::FillPasswordForm( const PasswordFormFillData& form_data) { DCHECK(form_data.has_renderer_ids); std::unique_ptr<RendererSavePasswordProgressLogger> logger; if (logging_state_active_) { logger.reset(new RendererSavePasswordProgressLogger( GetPasswordManagerDriver().get())); logger->LogMessage(Logger::STRING_ON_FILL_PASSWORD_FORM_METHOD); } bool username_password_fields_not_set = form_data.username_field.unique_renderer_id == FormFieldData::kNotSetFormControlRendererId && form_data.password_field.unique_renderer_id == FormFieldData::kNotSetFormControlRendererId; if (username_password_fields_not_set) { MaybeStoreFallbackData(form_data); return; } WebInputElement username_element, password_element; std::tie(username_element, password_element) = FindUsernamePasswordElements(form_data); bool is_single_username_fill = form_data.password_field.unique_renderer_id == FormFieldData::kNotSetFormControlRendererId; WebElement main_element = is_single_username_fill ? username_element : password_element; if (main_element.IsNull()) { MaybeStoreFallbackData(form_data); LogFirstFillingResult(form_data, FillingResult::kNoPasswordElement); return; } StoreDataForFillOnAccountSelect(form_data, username_element, password_element); if (form_data.wait_for_username) { LogFirstFillingResult(form_data, FillingResult::kWaitForUsername); return; } FillUserNameAndPassword(username_element, password_element, form_data, logger.get()); } Commit Message: [Android][TouchToFill] Use FindPasswordInfoForElement for triggering Use for TouchToFill the same triggering logic that is used for regular suggestions. Bug: 1010233 Change-Id: I111d4eac4ce94dd94b86097b6b6c98e08875e11a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834230 Commit-Queue: Boris Sazonov <bsazonov@chromium.org> Reviewed-by: Vadym Doroshenko <dvadym@chromium.org> Cr-Commit-Position: refs/heads/master@{#702058} CWE ID: CWE-125
0
137,611
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void sctp_v6_from_skb(union sctp_addr *addr, struct sk_buff *skb, int is_saddr) { /* Always called on head skb, so this is safe */ struct sctphdr *sh = sctp_hdr(skb); struct sockaddr_in6 *sa = &addr->v6; addr->v6.sin6_family = AF_INET6; addr->v6.sin6_flowinfo = 0; /* FIXME */ addr->v6.sin6_scope_id = ((struct inet6_skb_parm *)skb->cb)->iif; if (is_saddr) { sa->sin6_port = sh->source; sa->sin6_addr = ipv6_hdr(skb)->saddr; } else { sa->sin6_port = sh->dest; sa->sin6_addr = ipv6_hdr(skb)->daddr; } } Commit Message: sctp: do not inherit ipv6_{mc|ac|fl}_list from parent SCTP needs fixes similar to 83eaddab4378 ("ipv6/dccp: do not inherit ipv6_mc_list from parent"), otherwise bad things can happen. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Andrey Konovalov <andreyknvl@google.com> Tested-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID:
0
65,166
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void NetworkHandler::SetRenderer(RenderProcessHost* process_host, RenderFrameHostImpl* frame_host) { process_ = process_host; host_ = frame_host; } Commit Message: DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to resolve UAF of RenderProcessHost upon closure of DevTools front-end. Bug: 801117, 783067, 780694 Change-Id: I6c2cca60cc0c29f0949d189cf918769059f80c1b Reviewed-on: https://chromium-review.googlesource.com/876657 Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#531157} CWE ID: CWE-20
1
172,763
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ServiceManagerConnectionImpl::RemoveConnectionFilter(int filter_id) { context_->RemoveConnectionFilter(filter_id); } Commit Message: media: Support hosting mojo CDM in a standalone service Currently when mojo CDM is enabled it is hosted in the MediaService running in the process specified by "mojo_media_host". However, on some platforms we need to run mojo CDM and other mojo media services in different processes. For example, on desktop platforms, we want to run mojo video decoder in the GPU process, but run the mojo CDM in the utility process. This CL adds a new build flag "enable_standalone_cdm_service". When enabled, the mojo CDM service will be hosted in a standalone "cdm" service running in the utility process. All other mojo media services will sill be hosted in the "media" servie running in the process specified by "mojo_media_host". BUG=664364 TEST=Encrypted media browser tests using mojo CDM is still working. Change-Id: I95be6e05adc9ebcff966b26958ef1d7becdfb487 Reviewed-on: https://chromium-review.googlesource.com/567172 Commit-Queue: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Dan Sanders <sandersd@chromium.org> Cr-Commit-Position: refs/heads/master@{#486947} CWE ID: CWE-119
0
127,475
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static MagickBooleanType WritePNGImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { MagickBooleanType excluding, logging, status; MngInfo *mng_info; const char *value; int source; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter WritePNGImage()"); /* Allocate a MngInfo structure. */ mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* Initialize members of the MngInfo structure. */ (void) memset(mng_info,0,sizeof(MngInfo)); mng_info->image=image; mng_info->equal_backgrounds=MagickTrue; /* See if user has requested a specific PNG subformat */ mng_info->write_png8=LocaleCompare(image_info->magick,"PNG8") == 0; mng_info->write_png24=LocaleCompare(image_info->magick,"PNG24") == 0; mng_info->write_png32=LocaleCompare(image_info->magick,"PNG32") == 0; mng_info->write_png48=LocaleCompare(image_info->magick,"PNG48") == 0; mng_info->write_png64=LocaleCompare(image_info->magick,"PNG64") == 0; value=GetImageOption(image_info,"png:format"); if (value != (char *) NULL || LocaleCompare(image_info->magick,"PNG00") == 0) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Format=%s",value); mng_info->write_png8 = MagickFalse; mng_info->write_png24 = MagickFalse; mng_info->write_png32 = MagickFalse; mng_info->write_png48 = MagickFalse; mng_info->write_png64 = MagickFalse; if (LocaleCompare(value,"png8") == 0) mng_info->write_png8 = MagickTrue; else if (LocaleCompare(value,"png24") == 0) mng_info->write_png24 = MagickTrue; else if (LocaleCompare(value,"png32") == 0) mng_info->write_png32 = MagickTrue; else if (LocaleCompare(value,"png48") == 0) mng_info->write_png48 = MagickTrue; else if (LocaleCompare(value,"png64") == 0) mng_info->write_png64 = MagickTrue; else if ((LocaleCompare(value,"png00") == 0) || LocaleCompare(image_info->magick,"PNG00") == 0) { /* Retrieve png:IHDR.bit-depth-orig and png:IHDR.color-type-orig. */ value=GetImageProperty(image,"png:IHDR.bit-depth-orig",exception); if (value != (char *) NULL) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png00 inherited bit depth=%s",value); if (LocaleCompare(value,"1") == 0) mng_info->write_png_depth = 1; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_depth = 2; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_depth = 4; else if (LocaleCompare(value,"8") == 0) mng_info->write_png_depth = 8; else if (LocaleCompare(value,"16") == 0) mng_info->write_png_depth = 16; } value=GetImageProperty(image,"png:IHDR.color-type-orig",exception); if (value != (char *) NULL) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png00 inherited color type=%s",value); if (LocaleCompare(value,"0") == 0) mng_info->write_png_colortype = 1; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_colortype = 3; else if (LocaleCompare(value,"3") == 0) mng_info->write_png_colortype = 4; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_colortype = 5; else if (LocaleCompare(value,"6") == 0) mng_info->write_png_colortype = 7; } } } if (mng_info->write_png8) { mng_info->write_png_colortype = /* 3 */ 4; mng_info->write_png_depth = 8; image->depth = 8; } if (mng_info->write_png24) { mng_info->write_png_colortype = /* 2 */ 3; mng_info->write_png_depth = 8; image->depth = 8; if (image->alpha_trait != UndefinedPixelTrait) (void) SetImageType(image,TrueColorAlphaType,exception); else (void) SetImageType(image,TrueColorType,exception); (void) SyncImage(image,exception); } if (mng_info->write_png32) { mng_info->write_png_colortype = /* 6 */ 7; mng_info->write_png_depth = 8; image->depth = 8; image->alpha_trait = BlendPixelTrait; (void) SetImageType(image,TrueColorAlphaType,exception); (void) SyncImage(image,exception); } if (mng_info->write_png48) { mng_info->write_png_colortype = /* 2 */ 3; mng_info->write_png_depth = 16; image->depth = 16; if (image->alpha_trait != UndefinedPixelTrait) (void) SetImageType(image,TrueColorAlphaType,exception); else (void) SetImageType(image,TrueColorType,exception); (void) SyncImage(image,exception); } if (mng_info->write_png64) { mng_info->write_png_colortype = /* 6 */ 7; mng_info->write_png_depth = 16; image->depth = 16; image->alpha_trait = BlendPixelTrait; (void) SetImageType(image,TrueColorAlphaType,exception); (void) SyncImage(image,exception); } value=GetImageOption(image_info,"png:bit-depth"); if (value != (char *) NULL) { if (LocaleCompare(value,"1") == 0) mng_info->write_png_depth = 1; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_depth = 2; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_depth = 4; else if (LocaleCompare(value,"8") == 0) mng_info->write_png_depth = 8; else if (LocaleCompare(value,"16") == 0) mng_info->write_png_depth = 16; else (void) ThrowMagickException(exception, GetMagickModule(),CoderWarning, "ignoring invalid defined png:bit-depth", "=%s",value); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:bit-depth=%d was defined.\n",mng_info->write_png_depth); } value=GetImageOption(image_info,"png:color-type"); if (value != (char *) NULL) { /* We must store colortype+1 because 0 is a valid colortype */ if (LocaleCompare(value,"0") == 0) mng_info->write_png_colortype = 1; else if (LocaleCompare(value,"1") == 0) mng_info->write_png_colortype = 2; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_colortype = 3; else if (LocaleCompare(value,"3") == 0) mng_info->write_png_colortype = 4; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_colortype = 5; else if (LocaleCompare(value,"6") == 0) mng_info->write_png_colortype = 7; else (void) ThrowMagickException(exception, GetMagickModule(),CoderWarning, "ignoring invalid defined png:color-type", "=%s",value); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:color-type=%d was defined.\n", mng_info->write_png_colortype-1); } /* Check for chunks to be excluded: * * The default is to not exclude any known chunks except for any * listed in the "unused_chunks" array, above. * * Chunks can be listed for exclusion via a "png:exclude-chunk" * define (in the image properties or in the image artifacts) * or via a mng_info member. For convenience, in addition * to or instead of a comma-separated list of chunks, the * "exclude-chunk" string can be simply "all" or "none". * * Note that the "-strip" option provides a convenient way of * doing the equivalent of * * -define png:exclude-chunk="bKGD,caNv,cHRM,eXIf,gAMA,iCCP, * iTXt,pHYs,sRGB,tEXt,zCCP,zTXt,date" * * The exclude-chunk define takes priority over the mng_info. * * A "png:include-chunk" define takes priority over both the * mng_info and the "png:exclude-chunk" define. Like the * "exclude-chunk" string, it can define "all" or "none" as * well as a comma-separated list. Chunks that are unknown to * ImageMagick are always excluded, regardless of their "copy-safe" * status according to the PNG specification, and even if they * appear in the "include-chunk" list. Such defines appearing among * the image options take priority over those found among the image * artifacts. * * Finally, all chunks listed in the "unused_chunks" array are * automatically excluded, regardless of the other instructions * or lack thereof. * * if you exclude sRGB but not gAMA (recommended), then sRGB chunk * will not be written and the gAMA chunk will only be written if it * is not between .45 and .46, or approximately (1.0/2.2). * * If you exclude tRNS and the image has transparency, the colortype * is forced to be 4 or 6 (GRAY_ALPHA or RGB_ALPHA). * * The -strip option causes StripImage() to set the png:include-chunk * artifact to "none,trns,gama". */ mng_info->ping_exclude_bKGD=MagickFalse; mng_info->ping_exclude_caNv=MagickFalse; mng_info->ping_exclude_cHRM=MagickFalse; mng_info->ping_exclude_date=MagickFalse; mng_info->ping_exclude_eXIf=MagickFalse; mng_info->ping_exclude_EXIF=MagickFalse; /* hex-encoded EXIF in zTXt */ mng_info->ping_exclude_gAMA=MagickFalse; mng_info->ping_exclude_iCCP=MagickFalse; /* mng_info->ping_exclude_iTXt=MagickFalse; */ mng_info->ping_exclude_oFFs=MagickFalse; mng_info->ping_exclude_pHYs=MagickFalse; mng_info->ping_exclude_sRGB=MagickFalse; mng_info->ping_exclude_tEXt=MagickFalse; mng_info->ping_exclude_tIME=MagickFalse; mng_info->ping_exclude_tRNS=MagickFalse; mng_info->ping_exclude_zCCP=MagickFalse; /* hex-encoded iCCP in zTXt */ mng_info->ping_exclude_zTXt=MagickFalse; mng_info->ping_preserve_colormap=MagickFalse; value=GetImageOption(image_info,"png:preserve-colormap"); if (value == NULL) value=GetImageArtifact(image,"png:preserve-colormap"); if (value != NULL) mng_info->ping_preserve_colormap=MagickTrue; mng_info->ping_preserve_iCCP=MagickFalse; value=GetImageOption(image_info,"png:preserve-iCCP"); if (value == NULL) value=GetImageArtifact(image,"png:preserve-iCCP"); if (value != NULL) mng_info->ping_preserve_iCCP=MagickTrue; /* These compression-level, compression-strategy, and compression-filter * defines take precedence over values from the -quality option. */ value=GetImageOption(image_info,"png:compression-level"); if (value == NULL) value=GetImageArtifact(image,"png:compression-level"); if (value != NULL) { /* We have to add 1 to everything because 0 is a valid input, * and we want to use 0 (the default) to mean undefined. */ if (LocaleCompare(value,"0") == 0) mng_info->write_png_compression_level = 1; else if (LocaleCompare(value,"1") == 0) mng_info->write_png_compression_level = 2; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_compression_level = 3; else if (LocaleCompare(value,"3") == 0) mng_info->write_png_compression_level = 4; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_compression_level = 5; else if (LocaleCompare(value,"5") == 0) mng_info->write_png_compression_level = 6; else if (LocaleCompare(value,"6") == 0) mng_info->write_png_compression_level = 7; else if (LocaleCompare(value,"7") == 0) mng_info->write_png_compression_level = 8; else if (LocaleCompare(value,"8") == 0) mng_info->write_png_compression_level = 9; else if (LocaleCompare(value,"9") == 0) mng_info->write_png_compression_level = 10; else (void) ThrowMagickException(exception, GetMagickModule(),CoderWarning, "ignoring invalid defined png:compression-level", "=%s",value); } value=GetImageOption(image_info,"png:compression-strategy"); if (value == NULL) value=GetImageArtifact(image,"png:compression-strategy"); if (value != NULL) { if (LocaleCompare(value,"0") == 0) mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1; else if (LocaleCompare(value,"1") == 0) mng_info->write_png_compression_strategy = Z_FILTERED+1; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1; else if (LocaleCompare(value,"3") == 0) #ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */ mng_info->write_png_compression_strategy = Z_RLE+1; #else mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1; #endif else if (LocaleCompare(value,"4") == 0) #ifdef Z_FIXED /* Z_FIXED was added to zlib-1.2.2.2 */ mng_info->write_png_compression_strategy = Z_FIXED+1; #else mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1; #endif else (void) ThrowMagickException(exception, GetMagickModule(),CoderWarning, "ignoring invalid defined png:compression-strategy", "=%s",value); } value=GetImageOption(image_info,"png:compression-filter"); if (value == NULL) value=GetImageArtifact(image,"png:compression-filter"); if (value != NULL) { /* To do: combinations of filters allowed by libpng * masks 0x08 through 0xf8 * * Implement this as a comma-separated list of 0,1,2,3,4,5 * where 5 is a special case meaning PNG_ALL_FILTERS. */ if (LocaleCompare(value,"0") == 0) mng_info->write_png_compression_filter = 1; else if (LocaleCompare(value,"1") == 0) mng_info->write_png_compression_filter = 2; else if (LocaleCompare(value,"2") == 0) mng_info->write_png_compression_filter = 3; else if (LocaleCompare(value,"3") == 0) mng_info->write_png_compression_filter = 4; else if (LocaleCompare(value,"4") == 0) mng_info->write_png_compression_filter = 5; else if (LocaleCompare(value,"5") == 0) mng_info->write_png_compression_filter = 6; else (void) ThrowMagickException(exception, GetMagickModule(),CoderWarning, "ignoring invalid defined png:compression-filter", "=%s",value); } for (source=0; source<8; source++) { value = NULL; if (source == 0) value=GetImageOption(image_info,"png:exclude-chunks"); if (source == 1) value=GetImageArtifact(image,"png:exclude-chunks"); if (source == 2) value=GetImageOption(image_info,"png:exclude-chunk"); if (source == 3) value=GetImageArtifact(image,"png:exclude-chunk"); if (source == 4) value=GetImageOption(image_info,"png:include-chunks"); if (source == 5) value=GetImageArtifact(image,"png:include-chunks"); if (source == 6) value=GetImageOption(image_info,"png:include-chunk"); if (source == 7) value=GetImageArtifact(image,"png:include-chunk"); if (value == NULL) continue; if (source < 4) excluding = MagickTrue; else excluding = MagickFalse; if (logging != MagickFalse) { if (source == 0 || source == 2) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:exclude-chunk=%s found in image options.\n", value); else if (source == 1 || source == 3) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:exclude-chunk=%s found in image artifacts.\n", value); else if (source == 4 || source == 6) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:include-chunk=%s found in image options.\n", value); else /* if (source == 5 || source == 7) */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), " png:include-chunk=%s found in image artifacts.\n", value); } if (IsOptionMember("all",value) != MagickFalse) { mng_info->ping_exclude_bKGD=excluding; mng_info->ping_exclude_caNv=excluding; mng_info->ping_exclude_cHRM=excluding; mng_info->ping_exclude_date=excluding; mng_info->ping_exclude_EXIF=excluding; mng_info->ping_exclude_eXIf=excluding; mng_info->ping_exclude_gAMA=excluding; mng_info->ping_exclude_iCCP=excluding; /* mng_info->ping_exclude_iTXt=excluding; */ mng_info->ping_exclude_oFFs=excluding; mng_info->ping_exclude_pHYs=excluding; mng_info->ping_exclude_sRGB=excluding; mng_info->ping_exclude_tEXt=excluding; mng_info->ping_exclude_tIME=excluding; mng_info->ping_exclude_tRNS=excluding; mng_info->ping_exclude_zCCP=excluding; mng_info->ping_exclude_zTXt=excluding; } if (IsOptionMember("none",value) != MagickFalse) { mng_info->ping_exclude_bKGD=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_caNv=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_cHRM=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_date=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_eXIf=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_EXIF=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_gAMA=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_iCCP=excluding != MagickFalse ? MagickFalse : MagickTrue; /* mng_info->ping_exclude_iTXt=!excluding; */ mng_info->ping_exclude_oFFs=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_pHYs=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_sRGB=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_tEXt=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_tIME=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_tRNS=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_zCCP=excluding != MagickFalse ? MagickFalse : MagickTrue; mng_info->ping_exclude_zTXt=excluding != MagickFalse ? MagickFalse : MagickTrue; } if (IsOptionMember("bkgd",value) != MagickFalse) mng_info->ping_exclude_bKGD=excluding; if (IsOptionMember("caNv",value) != MagickFalse) mng_info->ping_exclude_caNv=excluding; if (IsOptionMember("chrm",value) != MagickFalse) mng_info->ping_exclude_cHRM=excluding; if (IsOptionMember("date",value) != MagickFalse) mng_info->ping_exclude_date=excluding; if (IsOptionMember("exif",value) != MagickFalse) { mng_info->ping_exclude_EXIF=excluding; mng_info->ping_exclude_eXIf=excluding; } if (IsOptionMember("gama",value) != MagickFalse) mng_info->ping_exclude_gAMA=excluding; if (IsOptionMember("iccp",value) != MagickFalse) mng_info->ping_exclude_iCCP=excluding; #if 0 if (IsOptionMember("itxt",value) != MagickFalse) mng_info->ping_exclude_iTXt=excluding; #endif if (IsOptionMember("offs",value) != MagickFalse) mng_info->ping_exclude_oFFs=excluding; if (IsOptionMember("phys",value) != MagickFalse) mng_info->ping_exclude_pHYs=excluding; if (IsOptionMember("srgb",value) != MagickFalse) mng_info->ping_exclude_sRGB=excluding; if (IsOptionMember("text",value) != MagickFalse) mng_info->ping_exclude_tEXt=excluding; if (IsOptionMember("time",value) != MagickFalse) mng_info->ping_exclude_tIME=excluding; if (IsOptionMember("trns",value) != MagickFalse) mng_info->ping_exclude_tRNS=excluding; if (IsOptionMember("zccp",value) != MagickFalse) mng_info->ping_exclude_zCCP=excluding; if (IsOptionMember("ztxt",value) != MagickFalse) mng_info->ping_exclude_zTXt=excluding; } if (logging != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Chunks to be excluded from the output png:"); if (mng_info->ping_exclude_bKGD != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " bKGD"); if (mng_info->ping_exclude_caNv != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " caNv"); if (mng_info->ping_exclude_cHRM != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " cHRM"); if (mng_info->ping_exclude_date != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " date"); if (mng_info->ping_exclude_EXIF != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " EXIF"); if (mng_info->ping_exclude_eXIf != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " eXIf"); if (mng_info->ping_exclude_gAMA != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " gAMA"); if (mng_info->ping_exclude_iCCP != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " iCCP"); #if 0 if (mng_info->ping_exclude_iTXt != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " iTXt"); #endif if (mng_info->ping_exclude_oFFs != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " oFFs"); if (mng_info->ping_exclude_pHYs != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " pHYs"); if (mng_info->ping_exclude_sRGB != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " sRGB"); if (mng_info->ping_exclude_tEXt != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " tEXt"); if (mng_info->ping_exclude_tIME != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " tIME"); if (mng_info->ping_exclude_tRNS != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " tRNS"); if (mng_info->ping_exclude_zCCP != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " zCCP"); if (mng_info->ping_exclude_zTXt != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " zTXt"); } mng_info->need_blob = MagickTrue; status=WriteOnePNGImage(mng_info,image_info,image,exception); mng_info=MngInfoFreeStruct(mng_info); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit WritePNGImage()"); return(status); } Commit Message: https://github.com/ImageMagick/ImageMagick/issues/1201 CWE ID: CWE-772
0
78,008
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void _free_ptr(zend_rsrc_list_entry *rsrc TSRMLS_DC) { pgLofp *lofp = (pgLofp *)rsrc->ptr; efree(lofp); } Commit Message: CWE ID:
0
14,773
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data) { u32 val; int i; val = ((u32)(reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT; ATL2_WRITE_REG(hw, REG_MDIO_CTRL, val); wmb(); for (i = 0; i < MDIO_WAIT_TIMES; i++) { udelay(2); val = ATL2_READ_REG(hw, REG_MDIO_CTRL); if (!(val & (MDIO_START | MDIO_BUSY))) break; wmb(); } if (!(val & (MDIO_START | MDIO_BUSY))) { *phy_data = (u16)val; return 0; } return ATLX_ERR_PHY; } Commit Message: atl2: Disable unimplemented scatter/gather feature atl2 includes NETIF_F_SG in hw_features even though it has no support for non-linear skbs. This bug was originally harmless since the driver does not claim to implement checksum offload and that used to be a requirement for SG. Now that SG and checksum offload are independent features, if you explicitly enable SG *and* use one of the rare protocols that can use SG without checkusm offload, this potentially leaks sensitive information (before you notice that it just isn't working). Therefore this obscure bug has been designated CVE-2016-2117. Reported-by: Justin Yackoski <jyackoski@crypto-nite.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Fixes: ec5f06156423 ("net: Kill link between CSUM and SG features.") Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-200
0
55,328
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static av_always_inline int smk_get_code(BitstreamContext *bc, int *recode, int *last) { register int *table = recode; int v; while(*table & SMK_NODE) { if (bitstream_read_bit(bc)) table += (*table) & (~SMK_NODE); table++; } v = *table; if(v != recode[last[0]]) { recode[last[2]] = recode[last[1]]; recode[last[1]] = recode[last[0]]; recode[last[0]] = v; } return v; } Commit Message: smacker: add sanity check for length in smacker_decode_tree() Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Bug-Id: 1098 Cc: libav-stable@libav.org Signed-off-by: Sean McGovern <gseanmcg@gmail.com> CWE ID: CWE-119
0
59,728
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_MINFO_FUNCTION(mb_regex) { char buf[32]; php_info_print_table_start(); php_info_print_table_row(2, "Multibyte (japanese) regex support", "enabled"); snprintf(buf, sizeof(buf), "%d.%d.%d", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); #ifdef PHP_ONIG_BUNDLED #ifdef USE_COMBINATION_EXPLOSION_CHECK php_info_print_table_row(2, "Multibyte regex (oniguruma) backtrack check", "On"); #else /* USE_COMBINATION_EXPLOSION_CHECK */ php_info_print_table_row(2, "Multibyte regex (oniguruma) backtrack check", "Off"); #endif /* USE_COMBINATION_EXPLOSION_CHECK */ #endif /* PHP_BUNDLED_ONIG */ php_info_print_table_row(2, "Multibyte regex (oniguruma) version", buf); php_info_print_table_end(); } Commit Message: Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free CWE ID: CWE-415
0
51,389
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void _cg_memcpy(void *dest, const void *src, unsigned int n, const char *file, const char *func, const int line) { if (unlikely(n < 1 || n > (1ul << 31))) { applog(LOG_ERR, "ERR: Asked to memcpy %u bytes from %s %s():%d", n, file, func, line); return; } memcpy(dest, src, n); } Commit Message: Do some random sanity checking for stratum message parsing CWE ID: CWE-119
0
36,652
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: noinline void btrfs_set_path_blocking(struct btrfs_path *p) { int i; for (i = 0; i < BTRFS_MAX_LEVEL; i++) { if (!p->nodes[i] || !p->locks[i]) continue; btrfs_set_lock_blocking_rw(p->nodes[i], p->locks[i]); if (p->locks[i] == BTRFS_READ_LOCK) p->locks[i] = BTRFS_READ_LOCK_BLOCKING; else if (p->locks[i] == BTRFS_WRITE_LOCK) p->locks[i] = BTRFS_WRITE_LOCK_BLOCKING; } } Commit Message: 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 <oliva@gnu.org> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com> CWE ID: CWE-362
0
45,325
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: vips_foreign_load_gif_buffer_class_init( VipsForeignLoadGifBufferClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; VipsForeignLoadGifClass *gif_class = (VipsForeignLoadGifClass *) class; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "gifload_buffer"; object_class->description = _( "load GIF with giflib" ); load_class->is_a_buffer = vips_foreign_load_gif_is_a_buffer; gif_class->open = vips_foreign_load_gif_buffer_open; VIPS_ARG_BOXED( class, "buffer", 1, _( "Buffer" ), _( "Buffer to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsForeignLoadGifBuffer, buf ), VIPS_TYPE_BLOB ); } Commit Message: fetch map after DGifGetImageDesc() Earlier refactoring broke GIF map fetch. CWE ID:
0
87,338
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: LUA_API int lua_yield (lua_State *L, int nresults) { luai_userstateyield(L, nresults); lua_lock(L); if (L->nCcalls > L->baseCcalls) luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); L->base = L->top - nresults; /* protect stack slots below */ L->status = LUA_YIELD; lua_unlock(L); return -1; } Commit Message: disable loading lua bytecode CWE ID: CWE-17
0
43,055
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderView::OnDelete() { if (!webview()) return; webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST= Review URL: http://codereview.chromium.org/7461019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93596 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
98,934
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int handle_invlpg(struct kvm_vcpu *vcpu) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); kvm_mmu_invlpg(vcpu, exit_qualification); skip_emulated_instruction(vcpu); return 1; } Commit Message: x86,kvm,vmx: Preserve CR4 across VM entry CR4 isn't constant; at least the TSD and PCE bits can vary. TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct. This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Cc: stable@vger.kernel.org Cc: Petr Matousek <pmatouse@redhat.com> Cc: Gleb Natapov <gleb@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-399
0
37,076
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int send_cmd(struct usb_device *dev, __u8 command, __u8 moduleid, __u16 value, u8 *data, int size) { return ti_vsend_sync(dev, command, value, moduleid, data, size); } Commit Message: USB: io_ti: Fix NULL dereference in chase_port() The tty is NULL when the port is hanging up. chase_port() needs to check for this. This patch is intended for stable series. The behavior was observed and tested in Linux 3.2 and 3.7.1. Johan Hovold submitted a more elaborate patch for the mainline kernel. [ 56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84 [ 56.278811] usb 1-1: USB disconnect, device number 3 [ 56.278856] usb 1-1: edge_bulk_in_callback - stopping read! [ 56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8 [ 56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0 [ 56.282085] Oops: 0002 [#1] SMP [ 56.282744] Modules linked in: [ 56.283512] CPU 1 [ 56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox [ 56.283512] RIP: 0010:[<ffffffff8144e62a>] [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.283512] RSP: 0018:ffff88001fa99ab0 EFLAGS: 00010046 [ 56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064 [ 56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8 [ 56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000 [ 56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0 [ 56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4 [ 56.283512] FS: 0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000 [ 56.283512] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0 [ 56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80) [ 56.283512] Stack: [ 56.283512] 0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c [ 56.283512] ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001 [ 56.283512] ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296 [ 56.283512] Call Trace: [ 56.283512] [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c [ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28 [ 56.283512] [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6 [ 56.283512] [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199 [ 56.283512] [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298 [ 56.283512] [<ffffffff81300171>] ? edge_close+0x64/0x129 [ 56.283512] [<ffffffff810612f7>] ? __wake_up+0x35/0x46 [ 56.283512] [<ffffffff8106135b>] ? should_resched+0x5/0x23 [ 56.283512] [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44 [ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28 [ 56.283512] [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351 [ 56.283512] [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed [ 56.283512] [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35 [ 56.283512] [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2 [ 56.283512] [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131 [ 56.283512] [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5 [ 56.283512] [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25 [ 56.283512] [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7 [ 56.283512] [<ffffffff8128b7a3>] ? device_del+0x119/0x167 [ 56.283512] [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180 [ 56.283512] [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6 [ 56.283512] [<ffffffff812e4435>] ? hub_thread+0x577/0xe82 [ 56.283512] [<ffffffff8144daa7>] ? __schedule+0x490/0x4be [ 56.283512] [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79 [ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f [ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f [ 56.283512] [<ffffffff810570b4>] ? kthread+0x81/0x89 [ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c [ 56.283512] [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0 [ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c [ 56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00 <f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66 [ 56.283512] RIP [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.283512] RSP <ffff88001fa99ab0> [ 56.283512] CR2: 00000000000001c8 [ 56.283512] ---[ end trace 49714df27e1679ce ]--- Signed-off-by: Wolfgang Frisch <wfpub@roembden.net> Cc: Johan Hovold <jhovold@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> CWE ID: CWE-264
0
33,361
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int handle_ept_violation(struct kvm_vcpu *vcpu) { unsigned long exit_qualification; gpa_t gpa; u64 error_code; exit_qualification = vmcs_readl(EXIT_QUALIFICATION); /* * EPT violation happened while executing iret from NMI, * "blocked by NMI" bit has to be set before next VM entry. * There are errata that may cause this bit to not be set: * AAK134, BY25. */ if (!(to_vmx(vcpu)->idt_vectoring_info & VECTORING_INFO_VALID_MASK) && enable_vnmi && (exit_qualification & INTR_INFO_UNBLOCK_NMI)) vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI); gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); trace_kvm_page_fault(gpa, exit_qualification); /* Is it a read fault? */ error_code = (exit_qualification & EPT_VIOLATION_ACC_READ) ? PFERR_USER_MASK : 0; /* Is it a write fault? */ error_code |= (exit_qualification & EPT_VIOLATION_ACC_WRITE) ? PFERR_WRITE_MASK : 0; /* Is it a fetch fault? */ error_code |= (exit_qualification & EPT_VIOLATION_ACC_INSTR) ? PFERR_FETCH_MASK : 0; /* ept page table entry is present? */ error_code |= (exit_qualification & (EPT_VIOLATION_READABLE | EPT_VIOLATION_WRITABLE | EPT_VIOLATION_EXECUTABLE)) ? PFERR_PRESENT_MASK : 0; error_code |= (exit_qualification & 0x100) != 0 ? PFERR_GUEST_FINAL_MASK : PFERR_GUEST_PAGE_MASK; vcpu->arch.exit_qualification = exit_qualification; return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0); } Commit Message: 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: stable@vger.kernel.org Signed-off-by: Felix Wilhelm <fwilhelm@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID:
0
80,950
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int get_ctty(pid_t pid, dev_t *ret_devnr, char **ret) { _cleanup_free_ char *fn = NULL, *b = NULL; dev_t devnr; int r; r = get_ctty_devnr(pid, &devnr); if (r < 0) return r; r = device_path_make_canonical(S_IFCHR, devnr, &fn); if (r < 0) { if (r != -ENOENT) /* No symlink for this in /dev/char/? */ return r; if (major(devnr) == 136) { /* This is an ugly hack: PTY devices are not listed in /dev/char/, as they don't follow the * Linux device model. This means we have no nice way to match them up against their actual * device node. Let's hence do the check by the fixed, assigned major number. Normally we try * to avoid such fixed major/minor matches, but there appears to nother nice way to handle * this. */ if (asprintf(&b, "pts/%u", minor(devnr)) < 0) return -ENOMEM; } else { /* Probably something similar to the ptys which have no symlink in /dev/char/. Let's return * something vaguely useful. */ r = device_path_make_major_minor(S_IFCHR, devnr, &fn); if (r < 0) return r; } } if (!b) { const char *w; w = path_startswith(fn, "/dev/"); if (w) { b = strdup(w); if (!b) return -ENOMEM; } else b = TAKE_PTR(fn); } if (ret) *ret = TAKE_PTR(b); if (ret_devnr) *ret_devnr = devnr; return 0; } Commit Message: Merge pull request #12378 from rbalint/vt-kbd-reset-check VT kbd reset check CWE ID: CWE-255
0
92,389
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BrowserWindowGtk::UnMaximize() { gtk_window_util::UnMaximize(window_, bounds_, restored_bounds_); } Commit Message: Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
118,029
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned lodepng_read32bitInt(const unsigned char* buffer) { return (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]); } Commit Message: Fixed #5645: realloc return handling CWE ID: CWE-772
0
87,568
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool Document::hasValidNamespaceForElements(const QualifiedName& qName) { if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createElementNS(null, "html:div") return false; if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS("http://www.example.com", "xml:lang") return false; if (qName.prefix() == xmlnsAtom || (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom)) return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI; return qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI; } Commit Message: Change Document::detach() to RELEASE_ASSERT all subframes are gone. BUG=556724,577105 Review URL: https://codereview.chromium.org/1667573002 Cr-Commit-Position: refs/heads/master@{#373642} CWE ID: CWE-264
0
124,395
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool CNB::FillDescriptorSGList(CTXDescriptor &Descriptor, ULONG ParsedHeadersLength) const { return Descriptor.SetupHeaders(ParsedHeadersLength) && MapDataToVirtioSGL(Descriptor, ParsedHeadersLength + NET_BUFFER_DATA_OFFSET(m_NB)); } Commit Message: NetKVM: BZ#1169718: Checking the length only on read Signed-off-by: Joseph Hindin <yhindin@rehat.com> CWE ID: CWE-20
0
96,311
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool Document::IsSlotAssignmentOrLegacyDistributionDirty() { if (ChildNeedsDistributionRecalc()) return true; if (GetSlotAssignmentEngine().HasPendingSlotAssignmentRecalc()) { return true; } return false; } Commit Message: Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing context). Bug: 799747 Change-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02 Reviewed-on: https://chromium-review.googlesource.com/c/1234337 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/master@{#597889} CWE ID:
0
144,000
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Browser::ShowFindBar() { GetFindBarController()->Show(); } Commit Message: 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 CWE ID: CWE-119
0
97,378
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int writeToFile(PlatformFileHandle handle, const char* data, int length) { if (!isHandleValid(handle)) return -1; DWORD bytesWritten; bool success = WriteFile(handle, data, length, &bytesWritten, 0); if (!success) return -1; return static_cast<int>(bytesWritten); } Commit Message: [WIN] Implement WebCore::fileSystemRepresentation() for !USE(CF) https://bugs.webkit.org/show_bug.cgi?id=104456 Reviewed by Brent Fulgham. Convert the UTF-16 path to the system default Windows ANSI code page (usually Windows Latin1). * platform/win/FileSystemWin.cpp: (WebCore::fileSystemRepresentation): git-svn-id: svn://svn.chromium.org/blink/trunk@137547 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID:
0
103,901
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void *private) { /* If the constant flag is set or if not size is avalaible at * the end of the buffer, copy the string in other buffer * before decoding. */ if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.len) { struct chunk *str = get_trash_chunk(); memcpy(str->str, smp->data.u.str.str, smp->data.u.str.len); smp->data.u.str.str = str->str; smp->data.u.str.size = str->size; smp->flags &= ~SMP_F_CONST; } /* Add final \0 required by url_decode(), and convert the input string. */ smp->data.u.str.str[smp->data.u.str.len] = '\0'; smp->data.u.str.len = url_decode(smp->data.u.str.str); return (smp->data.u.str.len >= 0); } Commit Message: CWE ID: CWE-200
0
6,885
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int cmd_resize(void *data, const char *input) { RCore *core = (RCore *)data; ut64 oldsize, newsize = 0; st64 delta = 0; int grow, ret; if (core->file && core->file->desc) oldsize = r_io_desc_size (core->io, core->file->desc); else oldsize = 0; switch (*input) { case '2': r_sys_cmdf ("radare%s", input); return true; case 'm': if (input[1] == ' ') r_file_rm (input + 2); else eprintf ("Usage: rm [file] # removes a file\n"); return true; case '\0': if (core->file && core->file->desc) { if (oldsize != -1) { r_cons_printf ("%"PFMT64d"\n", oldsize); } } return true; case '+': case '-': delta = (st64)r_num_math (core->num, input); newsize = oldsize + delta; break; case ' ': newsize = r_num_math (core->num, input + 1); if (newsize == 0) { if (input[1] == '0') eprintf ("Invalid size\n"); return false; } break; default: case '?':{ const char* help_msg[] = { "Usage:", "r[+-][ size]", "Resize file", "r", "", "display file size", "r", " size", "expand or truncate file to given size", "r-", "num", "remove num bytes, move following data down", "r+", "num", "insert num bytes, move following data up", "rm" ," [file]", "remove file", "r2" ," [file]", "launch r2", NULL}; r_core_cmd_help (core, help_msg); } return true; } grow = (newsize > oldsize); if (grow) { ret = r_io_resize (core->io, newsize); if (ret < 1) eprintf ("r_io_resize: cannot resize\n"); } if (delta && core->offset < newsize) r_io_shift (core->io, core->offset, grow?newsize:oldsize, delta); if (!grow) { ret = r_io_resize (core->io, newsize); if (ret < 1) eprintf ("r_io_resize: cannot resize\n"); } if (newsize < core->offset+core->blocksize || oldsize < core->offset + core->blocksize) { r_core_block_read (core); } return true; } Commit Message: Fix #7727 - undefined pointers and out of band string access fixes CWE ID: CWE-119
0
64,353
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ModuleExport void UnregisterFPXImage(void) { (void) UnregisterMagickInfo("FPX"); } Commit Message: CWE ID: CWE-119
0
71,551
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int HttpStreamParser::ParseResponseHeaders() { int end_offset = -1; if (response_header_start_offset_ < 0) { response_header_start_offset_ = HttpUtil::LocateStartOfStatusLine( read_buf_->StartOfBuffer() + read_buf_unused_offset_, read_buf_->offset() - read_buf_unused_offset_); } if (response_header_start_offset_ >= 0) { end_offset = HttpUtil::LocateEndOfHeaders( read_buf_->StartOfBuffer() + read_buf_unused_offset_, read_buf_->offset() - read_buf_unused_offset_, response_header_start_offset_); } else if (read_buf_->offset() - read_buf_unused_offset_ >= 8) { end_offset = 0; } if (end_offset == -1) return -1; int rv = DoParseResponseHeaders(end_offset); if (rv < 0) return rv; return end_offset + read_buf_unused_offset_; } Commit Message: net: don't process truncated headers on HTTPS connections. This change causes us to not process any headers unless they are correctly terminated with a \r\n\r\n sequence. BUG=244260 Review URL: https://chromiumcodereview.appspot.com/15688012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202927 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
112,797
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: stringprep_find_character_in_table (uint32_t ucs4, const Stringprep_table_element * table) { ssize_t i; /* This is where typical uses of Libidn spends very close to all CPU time and causes most cache misses. One could easily do a binary search instead. Before rewriting this, I want hard evidence this slowness is at all relevant in typical applications. (I don't dispute optimization may improve matters significantly, I'm mostly interested in having someone give real-world benchmark on the impact of libidn.) */ for (i = 0; table[i].start || table[i].end; i++) if (ucs4 >= table[i].start && ucs4 <= (table[i].end ? table[i].end : table[i].start)) return i; return -1; } Commit Message: CWE ID: CWE-119
0
4,782
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Compositor::Compositor(const viz::FrameSinkId& frame_sink_id, ui::ContextFactory* context_factory, ui::ContextFactoryPrivate* context_factory_private, scoped_refptr<base::SingleThreadTaskRunner> task_runner, bool enable_surface_synchronization, bool enable_pixel_canvas, bool external_begin_frames_enabled, bool force_software_compositor, const char* trace_environment_name) : context_factory_(context_factory), context_factory_private_(context_factory_private), frame_sink_id_(frame_sink_id), task_runner_(task_runner), vsync_manager_(new CompositorVSyncManager()), external_begin_frames_enabled_(external_begin_frames_enabled), force_software_compositor_(force_software_compositor), layer_animator_collection_(this), is_pixel_canvas_(enable_pixel_canvas), lock_manager_(task_runner), trace_environment_name_(trace_environment_name ? trace_environment_name : kDefaultTraceEnvironmentName), context_creation_weak_ptr_factory_(this) { if (context_factory_private) { auto* host_frame_sink_manager = context_factory_private_->GetHostFrameSinkManager(); host_frame_sink_manager->RegisterFrameSinkId( frame_sink_id_, this, viz::ReportFirstSurfaceActivation::kYes); host_frame_sink_manager->SetFrameSinkDebugLabel(frame_sink_id_, "Compositor"); } root_web_layer_ = cc::Layer::Create(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); cc::LayerTreeSettings settings; settings.layers_always_allowed_lcd_text = true; settings.use_occlusion_for_tile_prioritization = true; refresh_rate_ = context_factory_->GetRefreshRate(); settings.main_frame_before_activation_enabled = false; settings.delegated_sync_points_required = context_factory_->SyncTokensRequiredForDisplayCompositor(); settings.enable_edge_anti_aliasing = false; if (command_line->HasSwitch(switches::kLimitFps)) { std::string fps_str = command_line->GetSwitchValueASCII(switches::kLimitFps); double fps; if (base::StringToDouble(fps_str, &fps) && fps > 0) { forced_refresh_rate_ = fps; } } if (command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders)) { std::string layer_borders_string = command_line->GetSwitchValueASCII( cc::switches::kUIShowCompositedLayerBorders); std::vector<base::StringPiece> entries = base::SplitStringPiece( layer_borders_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); if (entries.empty()) { settings.initial_debug_state.show_debug_borders.set(); } else { for (const auto& entry : entries) { const struct { const char* name; cc::DebugBorderType type; } kBorders[] = {{cc::switches::kCompositedRenderPassBorders, cc::DebugBorderType::RENDERPASS}, {cc::switches::kCompositedSurfaceBorders, cc::DebugBorderType::SURFACE}, {cc::switches::kCompositedLayerBorders, cc::DebugBorderType::LAYER}}; for (const auto& border : kBorders) { if (border.name == entry) { settings.initial_debug_state.show_debug_borders.set(border.type); break; } } } } } settings.initial_debug_state.show_fps_counter = command_line->HasSwitch(cc::switches::kUIShowFPSCounter); settings.initial_debug_state.show_layer_animation_bounds_rects = command_line->HasSwitch(cc::switches::kUIShowLayerAnimationBounds); settings.initial_debug_state.show_paint_rects = command_line->HasSwitch(switches::kUIShowPaintRects); settings.initial_debug_state.show_property_changed_rects = command_line->HasSwitch(cc::switches::kUIShowPropertyChangedRects); settings.initial_debug_state.show_surface_damage_rects = command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); settings.initial_debug_state.show_screen_space_rects = command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); settings.initial_debug_state.SetRecordRenderingStats( command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); settings.enable_surface_synchronization = enable_surface_synchronization; settings.build_hit_test_data = features::IsVizHitTestingSurfaceLayerEnabled(); settings.use_zero_copy = IsUIZeroCopyEnabled(); settings.use_layer_lists = command_line->HasSwitch(cc::switches::kUIEnableLayerLists); settings.use_partial_raster = !settings.use_zero_copy; settings.use_rgba_4444 = command_line->HasSwitch(switches::kUIEnableRGBA4444Textures); #if defined(OS_MACOSX) settings.resource_settings.use_gpu_memory_buffer_resources = settings.use_zero_copy; settings.enable_elastic_overscroll = true; #endif settings.memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; settings.memory_policy.priority_cutoff_when_visible = gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; settings.disallow_non_exact_resource_reuse = command_line->HasSwitch(switches::kDisallowNonExactResourceReuse); if (command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)) { settings.wait_for_all_pipeline_stages_before_draw = true; settings.enable_latency_recovery = false; } settings.always_request_presentation_time = command_line->HasSwitch(cc::switches::kAlwaysRequestPresentationTime); animation_host_ = cc::AnimationHost::CreateMainInstance(); cc::LayerTreeHost::InitParams params; params.client = this; params.task_graph_runner = context_factory_->GetTaskGraphRunner(); params.settings = &settings; params.main_task_runner = task_runner_; params.mutator_host = animation_host_.get(); host_ = cc::LayerTreeHost::CreateSingleThreaded(this, std::move(params)); if (base::FeatureList::IsEnabled(features::kUiCompositorScrollWithLayers) && host_->GetInputHandler()) { scroll_input_handler_.reset( new ScrollInputHandler(host_->GetInputHandler())); } animation_timeline_ = cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); animation_host_->AddAnimationTimeline(animation_timeline_.get()); host_->SetHasGpuRasterizationTrigger(features::IsUiGpuRasterizationEnabled()); host_->SetRootLayer(root_web_layer_); host_->SetVisible(true); if (command_line->HasSwitch(switches::kUISlowAnimations)) { slow_animations_ = std::make_unique<ScopedAnimationDurationScaleMode>( ScopedAnimationDurationScaleMode::SLOW_DURATION); } } Commit Message: Don't report OnFirstSurfaceActivation for ui::Compositor Bug: 893850 Change-Id: Iee754cefbd083d0a21a2b672fb8e837eaab81c43 Reviewed-on: https://chromium-review.googlesource.com/c/1293712 Reviewed-by: Antoine Labour <piman@chromium.org> Commit-Queue: Saman Sami <samans@chromium.org> Cr-Commit-Position: refs/heads/master@{#601629} CWE ID: CWE-20
1
172,562
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int __dm_resume(struct mapped_device *md, struct dm_table *map) { if (map) { int r = dm_table_resume_targets(map); if (r) return r; } dm_queue_flush(md); /* * Flushing deferred I/Os must be done after targets are resumed * so that mapping of targets can work correctly. * Request-based dm is queueing the deferred I/Os in its request_queue. */ if (dm_request_based(md)) dm_start_queue(md->queue); unlock_fs(md); return 0; } Commit Message: dm: fix race between dm_get_from_kobject() and __dm_destroy() The following BUG_ON was hit when testing repeat creation and removal of DM devices: kernel BUG at drivers/md/dm.c:2919! CPU: 7 PID: 750 Comm: systemd-udevd Not tainted 4.1.44 Call Trace: [<ffffffff81649e8b>] dm_get_from_kobject+0x34/0x3a [<ffffffff81650ef1>] dm_attr_show+0x2b/0x5e [<ffffffff817b46d1>] ? mutex_lock+0x26/0x44 [<ffffffff811df7f5>] sysfs_kf_seq_show+0x83/0xcf [<ffffffff811de257>] kernfs_seq_show+0x23/0x25 [<ffffffff81199118>] seq_read+0x16f/0x325 [<ffffffff811de994>] kernfs_fop_read+0x3a/0x13f [<ffffffff8117b625>] __vfs_read+0x26/0x9d [<ffffffff8130eb59>] ? security_file_permission+0x3c/0x44 [<ffffffff8117bdb8>] ? rw_verify_area+0x83/0xd9 [<ffffffff8117be9d>] vfs_read+0x8f/0xcf [<ffffffff81193e34>] ? __fdget_pos+0x12/0x41 [<ffffffff8117c686>] SyS_read+0x4b/0x76 [<ffffffff817b606e>] system_call_fastpath+0x12/0x71 The bug can be easily triggered, if an extra delay (e.g. 10ms) is added between the test of DMF_FREEING & DMF_DELETING and dm_get() in dm_get_from_kobject(). To fix it, we need to ensure the test of DMF_FREEING & DMF_DELETING and dm_get() are done in an atomic way, so _minor_lock is used. The other callers of dm_get() have also been checked to be OK: some callers invoke dm_get() under _minor_lock, some callers invoke it under _hash_lock, and dm_start_request() invoke it after increasing md->open_count. Cc: stable@vger.kernel.org Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> CWE ID: CWE-362
0
85,841
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CronTab::validateParameter( int attribute_idx, const char *parameter, MyString &error ) { bool ret = true; MyString temp(parameter); if ( CronTab::regex.match( temp ) ) { error = "Invalid parameter value '"; error += parameter; error += "' for "; error += CronTab::attributes[attribute_idx]; ret = false; } return ( ret ); } Commit Message: CWE ID: CWE-134
0
16,548
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, HB_UShort feature_index, HB_UInt property ) { HB_UShort i; HB_Feature feature; HB_UInt* properties; HB_UShort* index; HB_UShort lookup_count; /* Each feature can only be added once */ if ( !gpos || feature_index >= gpos->FeatureList.FeatureCount || gpos->FeatureList.ApplyCount == gpos->FeatureList.FeatureCount ) return ERR(HB_Err_Invalid_Argument); gpos->FeatureList.ApplyOrder[gpos->FeatureList.ApplyCount++] = feature_index; properties = gpos->LookupList.Properties; feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; index = feature.LookupListIndex; lookup_count = gpos->LookupList.LookupCount; for ( i = 0; i < feature.LookupListCount; i++ ) { HB_UShort lookup_index = index[i]; if (lookup_index < lookup_count) properties[lookup_index] |= property; } return HB_Err_Ok; } Commit Message: CWE ID: CWE-119
0
13,556
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gpc_Pre(Pixel *out, const Pixel *in, const Background *back) { (void)back; out->r = ilineara_g22(in->r, in->a); if (in->g == in->r) { out->g = out->r; if (in->b == in->r) out->b = out->r; else out->b = ilineara_g22(in->b, in->a); } else { out->g = ilineara_g22(in->g, in->a); if (in->b == in->r) out->b = out->r; else if (in->b == in->g) out->b = out->g; else out->b = ilineara_g22(in->b, in->a); } out->a = in->a * 257; } Commit Message: DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b63bc0bf46084833 (cherry picked from commit bbe98b40cda082024b669fa508931042eed18f82) CWE ID:
0
159,899
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid) { int32_t datalen; int lun; SCSIDevice *current_lun; trace_esp_do_busid_cmd(busid); lun = busid & 7; current_lun = scsi_device_find(&s->bus, 0, s->current_dev->id, lun); s->current_req = scsi_req_new(current_lun, 0, lun, buf, s); datalen = scsi_req_enqueue(s->current_req); s->ti_size = datalen; if (datalen != 0) { s->rregs[ESP_RSTAT] = STAT_TC; s->dma_left = 0; s->dma_counter = 0; if (datalen > 0) { s->rregs[ESP_RSTAT] |= STAT_DI; } else { s->rregs[ESP_RSTAT] |= STAT_DO; } scsi_req_continue(s->current_req); } s->rregs[ESP_RINTR] = INTR_BS | INTR_FC; s->rregs[ESP_RSEQ] = SEQ_CD; esp_raise_irq(s); } Commit Message: CWE ID: CWE-787
0
9,314
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void FrameView::scrollContentsIfNeeded() { bool didScroll = !pendingScrollDelta().isZero(); ScrollView::scrollContentsIfNeeded(); if (didScroll) updateFixedElementPaintInvalidationRectsAfterScroll(); } Commit Message: Defer call to updateWidgetPositions() outside of RenderLayerScrollableArea. updateWidgetPositions() can destroy the render tree, so it should never be called from inside RenderLayerScrollableArea. Leaving it there allows for the potential of use-after-free bugs. BUG=402407 R=vollick@chromium.org Review URL: https://codereview.chromium.org/490473003 git-svn-id: svn://svn.chromium.org/blink/trunk@180681 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-416
0
119,906
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err rely_Read(GF_Box *s, GF_BitStream *bs) { GF_RelyHintBox *ptr = (GF_RelyHintBox *)s; ptr->reserved = gf_bs_read_int(bs, 6); ptr->prefered = gf_bs_read_int(bs, 1); ptr->required = gf_bs_read_int(bs, 1); return GF_OK; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,349
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ServiceManagerConnectionImpl::AddServiceRequestHandler( const std::string& name, const ServiceRequestHandler& handler) { context_->AddServiceRequestHandler(name, handler); } Commit Message: media: Support hosting mojo CDM in a standalone service Currently when mojo CDM is enabled it is hosted in the MediaService running in the process specified by "mojo_media_host". However, on some platforms we need to run mojo CDM and other mojo media services in different processes. For example, on desktop platforms, we want to run mojo video decoder in the GPU process, but run the mojo CDM in the utility process. This CL adds a new build flag "enable_standalone_cdm_service". When enabled, the mojo CDM service will be hosted in a standalone "cdm" service running in the utility process. All other mojo media services will sill be hosted in the "media" servie running in the process specified by "mojo_media_host". BUG=664364 TEST=Encrypted media browser tests using mojo CDM is still working. Change-Id: I95be6e05adc9ebcff966b26958ef1d7becdfb487 Reviewed-on: https://chromium-review.googlesource.com/567172 Commit-Queue: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Dan Sanders <sandersd@chromium.org> Cr-Commit-Position: refs/heads/master@{#486947} CWE ID: CWE-119
0
127,464
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ServiceWorkerContextCore::ScheduleDeleteAndStartOver() const { storage_->Disable(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&ServiceWorkerContextWrapper::DeleteAndStartOver, wrapper_)); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <lowell@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Cr-Commit-Position: refs/heads/master@{#653137} CWE ID: CWE-416
0
139,489
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, unsigned size) { if (unlikely(ctxt->fetch.end - ctxt->fetch.ptr < size)) return __do_insn_fetch_bytes(ctxt, size); else return X86EMUL_CONTINUE; } Commit Message: KVM: x86: Handle errors when RIP is set during far jumps Far jmp/call/ret may fault while loading a new RIP. Currently KVM does not handle this case, and may result in failed vm-entry once the assignment is done. The tricky part of doing so is that loading the new CS affects the VMCS/VMCB state, so if we fail during loading the new RIP, we are left in unconsistent state. Therefore, this patch saves on 64-bit the old CS descriptor and restores it if loading RIP failed. This fixes CVE-2014-3647. Cc: stable@vger.kernel.org Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-264
0
37,370
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_GSHUTDOWN_FUNCTION(phar) /* {{{ */ { zend_hash_destroy(&phar_globals->mime_types); } /* }}} */ Commit Message: CWE ID: CWE-125
0
4,444
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct fib6_node * fib6_locate_1(struct fib6_node *root, const struct in6_addr *addr, int plen, int offset) { struct fib6_node *fn; for (fn = root; fn ; ) { struct rt6key *key = (struct rt6key *)((u8 *)fn->leaf + offset); /* * Prefix match */ if (plen < fn->fn_bit || !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit)) return NULL; if (plen == fn->fn_bit) return fn; /* * We have more bits to go */ if (addr_bit_set(addr, fn->fn_bit)) fn = fn->right; else fn = fn->left; } return NULL; } Commit Message: net: fib: fib6_add: fix potential NULL pointer dereference When the kernel is compiled with CONFIG_IPV6_SUBTREES, and we return with an error in fn = fib6_add_1(), then error codes are encoded into the return pointer e.g. ERR_PTR(-ENOENT). In such an error case, we write the error code into err and jump to out, hence enter the if(err) condition. Now, if CONFIG_IPV6_SUBTREES is enabled, we check for: if (pn != fn && pn->leaf == rt) ... if (pn != fn && !pn->leaf && !(pn->fn_flags & RTN_RTINFO)) ... Since pn is NULL and fn is f.e. ERR_PTR(-ENOENT), then pn != fn evaluates to true and causes a NULL-pointer dereference on further checks on pn. Fix it, by setting both NULL in error case, so that pn != fn already evaluates to false and no further dereference takes place. This was first correctly implemented in 4a287eba2 ("IPv6 routing, NLM_F_* flag support: REPLACE and EXCL flags support, warn about missing CREATE flag"), but the bug got later on introduced by 188c517a0 ("ipv6: return errno pointers consistently for fib6_add_1()"). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Lin Ming <mlin@ss.pku.edu.cn> Cc: Matti Vaittinen <matti.vaittinen@nsn.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: Matti Vaittinen <matti.vaittinen@nsn.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-264
0
28,416
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: double LocalDOMWindow::devicePixelRatio() const { if (!GetFrame()) return 0.0; return GetFrame()->DevicePixelRatio(); } Commit Message: MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <mblsha@yandex-team.ru> Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#542517} CWE ID:
0
125,933
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: three_to_four (char *from, char *to) { static const char tab64[64]= { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; to[0] = tab64 [ (from[0] >> 2) & 63 ]; to[1] = tab64 [ ((from[0] << 4) | (from[1] >> 4)) & 63 ]; to[2] = tab64 [ ((from[1] << 2) | (from[2] >> 6)) & 63 ]; to[3] = tab64 [ from[2] & 63 ]; }; Commit Message: ssl: Validate hostnames Closes #524 CWE ID: CWE-310
0
58,467
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int get_smi_info(void *send_info, struct ipmi_smi_info *data) { struct smi_info *smi = send_info; data->addr_src = smi->io.addr_source; data->dev = smi->io.dev; data->addr_info = smi->io.addr_info; get_device(smi->io.dev); return 0; } Commit Message: ipmi_si: fix use-after-free of resource->name When we excute the following commands, we got oops rmmod ipmi_si cat /proc/ioports [ 1623.482380] Unable to handle kernel paging request at virtual address ffff00000901d478 [ 1623.482382] Mem abort info: [ 1623.482383] ESR = 0x96000007 [ 1623.482385] Exception class = DABT (current EL), IL = 32 bits [ 1623.482386] SET = 0, FnV = 0 [ 1623.482387] EA = 0, S1PTW = 0 [ 1623.482388] Data abort info: [ 1623.482389] ISV = 0, ISS = 0x00000007 [ 1623.482390] CM = 0, WnR = 0 [ 1623.482393] swapper pgtable: 4k pages, 48-bit VAs, pgdp = 00000000d7d94a66 [ 1623.482395] [ffff00000901d478] pgd=000000dffbfff003, pud=000000dffbffe003, pmd=0000003f5d06e003, pte=0000000000000000 [ 1623.482399] Internal error: Oops: 96000007 [#1] SMP [ 1623.487407] Modules linked in: ipmi_si(E) nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm dm_mirror dm_region_hash dm_log iw_cm dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ses ghash_ce sha2_ce enclosure sha256_arm64 sg sha1_ce hisi_sas_v2_hw hibmc_drm sbsa_gwdt hisi_sas_main ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe mdio hns_dsaf ipmi_devintf hns_enet_drv ipmi_msghandler hns_mdio [last unloaded: ipmi_si] [ 1623.532410] CPU: 30 PID: 11438 Comm: cat Kdump: loaded Tainted: G E 5.0.0-rc3+ #168 [ 1623.541498] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017 [ 1623.548822] pstate: a0000005 (NzCv daif -PAN -UAO) [ 1623.553684] pc : string+0x28/0x98 [ 1623.557040] lr : vsnprintf+0x368/0x5e8 [ 1623.560837] sp : ffff000013213a80 [ 1623.564191] x29: ffff000013213a80 x28: ffff00001138abb5 [ 1623.569577] x27: ffff000013213c18 x26: ffff805f67d06049 [ 1623.574963] x25: 0000000000000000 x24: ffff00001138abb5 [ 1623.580349] x23: 0000000000000fb7 x22: ffff0000117ed000 [ 1623.585734] x21: ffff000011188fd8 x20: ffff805f67d07000 [ 1623.591119] x19: ffff805f67d06061 x18: ffffffffffffffff [ 1623.596505] x17: 0000000000000200 x16: 0000000000000000 [ 1623.601890] x15: ffff0000117ed748 x14: ffff805f67d07000 [ 1623.607276] x13: ffff805f67d0605e x12: 0000000000000000 [ 1623.612661] x11: 0000000000000000 x10: 0000000000000000 [ 1623.618046] x9 : 0000000000000000 x8 : 000000000000000f [ 1623.623432] x7 : ffff805f67d06061 x6 : fffffffffffffffe [ 1623.628817] x5 : 0000000000000012 x4 : ffff00000901d478 [ 1623.634203] x3 : ffff0a00ffffff04 x2 : ffff805f67d07000 [ 1623.639588] x1 : ffff805f67d07000 x0 : ffffffffffffffff [ 1623.644974] Process cat (pid: 11438, stack limit = 0x000000008d4cbc10) [ 1623.651592] Call trace: [ 1623.654068] string+0x28/0x98 [ 1623.657071] vsnprintf+0x368/0x5e8 [ 1623.660517] seq_vprintf+0x70/0x98 [ 1623.668009] seq_printf+0x7c/0xa0 [ 1623.675530] r_show+0xc8/0xf8 [ 1623.682558] seq_read+0x330/0x440 [ 1623.689877] proc_reg_read+0x78/0xd0 [ 1623.697346] __vfs_read+0x60/0x1a0 [ 1623.704564] vfs_read+0x94/0x150 [ 1623.711339] ksys_read+0x6c/0xd8 [ 1623.717939] __arm64_sys_read+0x24/0x30 [ 1623.725077] el0_svc_common+0x120/0x148 [ 1623.732035] el0_svc_handler+0x30/0x40 [ 1623.738757] el0_svc+0x8/0xc [ 1623.744520] Code: d1000406 aa0103e2 54000149 b4000080 (39400085) [ 1623.753441] ---[ end trace f91b6a4937de9835 ]--- [ 1623.760871] Kernel panic - not syncing: Fatal exception [ 1623.768935] SMP: stopping secondary CPUs [ 1623.775718] Kernel Offset: disabled [ 1623.781998] CPU features: 0x002,21006008 [ 1623.788777] Memory Limit: none [ 1623.798329] Starting crashdump kernel... [ 1623.805202] Bye! If io_setup is called successful in try_smi_init() but try_smi_init() goes out_err before calling ipmi_register_smi(), so ipmi_unregister_smi() will not be called while removing module. It leads to the resource that allocated in io_setup() can not be freed, but the name(DEVICE_NAME) of resource is freed while removing the module. It causes use-after-free when cat /proc/ioports. Fix this by calling io_cleanup() while try_smi_init() goes to out_err. and don't call io_cleanup() until io_setup() returns successful to avoid warning prints. Fixes: 93c303d2045b ("ipmi_si: Clean up shutdown a bit") Cc: stable@vger.kernel.org Reported-by: NuoHan Qiao <qiaonuohan@huawei.com> Suggested-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> CWE ID: CWE-416
0
90,220
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: base::i18n::TextDirection WebTextDirectionToChromeTextDirection( WebKit::WebTextDirection dir) { switch (dir) { case WebKit::WebTextDirectionLeftToRight: return base::i18n::LEFT_TO_RIGHT; case WebKit::WebTextDirectionRightToLeft: return base::i18n::RIGHT_TO_LEFT; default: NOTREACHED(); return base::i18n::UNKNOWN_DIRECTION; } } Commit Message: Filter more incoming URLs in the CreateWindow path. BUG=170532 Review URL: https://chromiumcodereview.appspot.com/12036002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178728 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
117,309
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SharedWorkerDevToolsAgentHost::AttachSession(DevToolsSession* session) { session->AddHandler(std::make_unique<protocol::InspectorHandler>()); session->AddHandler(std::make_unique<protocol::NetworkHandler>(GetId())); session->AddHandler(std::make_unique<protocol::SchemaHandler>()); session->SetRenderer(worker_host_ ? worker_host_->process_id() : -1, nullptr); if (state_ == WORKER_READY) session->AttachToAgent(EnsureAgent()); } Commit Message: [DevTools] Do not allow chrome.debugger to attach to web ui pages If the page navigates to web ui, we force detach the debugger extension. TBR=alexclarke@chromium.org Bug: 798222 Change-Id: Idb46c2f59e839388397a8dfa6ce2e2a897698df3 Reviewed-on: https://chromium-review.googlesource.com/935961 Commit-Queue: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Cr-Commit-Position: refs/heads/master@{#540916} CWE ID: CWE-20
1
173,252
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int area_io(struct pstore *ps, int rw) { int r; chunk_t chunk; chunk = area_location(ps, ps->current_area); r = chunk_io(ps, ps->area, chunk, rw, 0); if (r) return r; return 0; } Commit Message: dm snapshot: fix data corruption This patch fixes a particular type of data corruption that has been encountered when loading a snapshot's metadata from disk. When we allocate a new chunk in persistent_prepare, we increment ps->next_free and we make sure that it doesn't point to a metadata area by further incrementing it if necessary. When we load metadata from disk on device activation, ps->next_free is positioned after the last used data chunk. However, if this last used data chunk is followed by a metadata area, ps->next_free is positioned erroneously to the metadata area. A newly-allocated chunk is placed at the same location as the metadata area, resulting in data or metadata corruption. This patch changes the code so that ps->next_free skips the metadata area when metadata are loaded in function read_exceptions. The patch also moves a piece of code from persistent_prepare_exception to a separate function skip_metadata to avoid code duplication. CVE-2013-4299 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Cc: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> CWE ID: CWE-264
0
29,665
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pte_t pte, pte_t *ptep, pmd_t *pmd) { struct page *page = NULL; spinlock_t *ptl; int current_nid = -1; int target_nid; bool migrated = false; /* * The "pte" at this point cannot be used safely without * validation through pte_unmap_same(). It's of NUMA type but * the pfn may be screwed if the read is non atomic. * * ptep_modify_prot_start is not called as this is clearing * the _PAGE_NUMA bit and it is not really expected that there * would be concurrent hardware modifications to the PTE. */ ptl = pte_lockptr(mm, pmd); spin_lock(ptl); if (unlikely(!pte_same(*ptep, pte))) { pte_unmap_unlock(ptep, ptl); goto out; } pte = pte_mknonnuma(pte); set_pte_at(mm, addr, ptep, pte); update_mmu_cache(vma, addr, ptep); page = vm_normal_page(vma, addr, pte); if (!page) { pte_unmap_unlock(ptep, ptl); return 0; } current_nid = page_to_nid(page); target_nid = numa_migrate_prep(page, vma, addr, current_nid); pte_unmap_unlock(ptep, ptl); if (target_nid == -1) { /* * Account for the fault against the current node if it not * being replaced regardless of where the page is located. */ current_nid = numa_node_id(); put_page(page); goto out; } /* Migrate to the requested node */ migrated = migrate_misplaced_page(page, target_nid); if (migrated) current_nid = target_nid; out: if (current_nid != -1) task_numa_fault(current_nid, 1, migrated); return 0; } Commit Message: vm: add vm_iomap_memory() helper function Various drivers end up replicating the code to mmap() their memory buffers into user space, and our core memory remapping function may be very flexible but it is unnecessarily complicated for the common cases to use. Our internal VM uses pfn's ("page frame numbers") which simplifies things for the VM, and allows us to pass physical addresses around in a denser and more efficient format than passing a "phys_addr_t" around, and having to shift it up and down by the page size. But it just means that drivers end up doing that shifting instead at the interface level. It also means that drivers end up mucking around with internal VM things like the vma details (vm_pgoff, vm_start/end) way more than they really need to. So this just exports a function to map a certain physical memory range into user space (using a phys_addr_t based interface that is much more natural for a driver) and hides all the complexity from the driver. Some drivers will still end up tweaking the vm_page_prot details for things like prefetching or cacheability etc, but that's actually relevant to the driver, rather than caring about what the page offset of the mapping is into the particular IO memory region. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-189
0
94,444
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void kvm_destroy_devices(struct kvm *kvm) { struct list_head *node, *tmp; list_for_each_safe(node, tmp, &kvm->devices) { struct kvm_device *dev = list_entry(node, struct kvm_device, vm_node); list_del(node); dev->ops->destroy(dev); } } Commit Message: KVM: Improve create VCPU parameter (CVE-2013-4587) In multiple functions the vcpu_id is used as an offset into a bitfield. Ag malicious user could specify a vcpu_id greater than 255 in order to set or clear bits in kernel memory. This could be used to elevate priveges in the kernel. This patch verifies that the vcpu_id provided is less than 255. The api documentation already specifies that the vcpu_id must be less than max_vcpus, but this is currently not checked. Reported-by: Andrew Honig <ahonig@google.com> Cc: stable@vger.kernel.org Signed-off-by: Andrew Honig <ahonig@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-20
0
29,315
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void apparmor_cred_free(struct cred *cred) { aa_free_task_context(cred->security); cred->security = NULL; } Commit Message: AppArmor: fix oops in apparmor_setprocattr When invalid parameters are passed to apparmor_setprocattr a NULL deref oops occurs when it tries to record an audit message. This is because it is passing NULL for the profile parameter for aa_audit. But aa_audit now requires that the profile passed is not NULL. Fix this by passing the current profile on the task that is trying to setprocattr. Signed-off-by: Kees Cook <kees@ubuntu.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Cc: stable@kernel.org Signed-off-by: James Morris <jmorris@namei.org> CWE ID: CWE-20
0
34,783
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SecureProxyChecker::SecureProxyChecker( scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) : url_loader_factory_(std::move(url_loader_factory)) {} Commit Message: Disable all DRP URL fetches when holdback is enabled Disable secure proxy checker, warmup url fetcher and client config fetch when the client is in DRP (Data Reduction Proxy) holdback. This CL does not disable pingbacks when client is in the holdback, but the pingback code is going away soon. Change-Id: Icbb59d814d1452123869c609e0770d1439c1db51 Bug: 984964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1709965 Commit-Queue: Tarun Bansal <tbansal@chromium.org> Reviewed-by: Robert Ogden <robertogden@chromium.org> Cr-Commit-Position: refs/heads/master@{#679649} CWE ID: CWE-416
1
172,423
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int jas_iccputsint(jas_stream_t *out, int n, longlong val) { ulonglong tmp; tmp = (val < 0) ? (abort(), 0) : val; return jas_iccputuint(out, n, tmp); } Commit Message: The generation of the configuration file jas_config.h has been completely reworked in order to avoid pollution of the global namespace. Some problematic types like uchar, ulong, and friends have been replaced with names with a jas_ prefix. An option max_samples has been added to the BMP and JPEG decoders to restrict the maximum size of image that they can decode. This change was made as a (possibly temporary) fix to address security concerns. A max_samples command-line option has also been added to imginfo. Whether an image component (for jas_image_t) is stored in memory or on disk is now based on the component size (rather than the image size). Some debug log message were added. Some new integer overflow checks were added. Some new safe integer add/multiply functions were added. More pre-C99 cruft was removed. JasPer has numerous "hacks" to handle pre-C99 compilers. JasPer now assumes C99 support. So, this pre-C99 cruft is unnecessary and can be removed. The regression jasper-doublefree-mem_close.jpg has been re-enabled. Theoretically, it should work more predictably now. CWE ID: CWE-190
1
168,689
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BlobStorageContext::OnEnoughSpaceForCopies(const std::string& uuid, bool success) { if (!success) { CancelBuildingBlob(uuid, BlobStatus::ERR_OUT_OF_MEMORY); return; } BlobEntry* entry = registry_.GetEntry(uuid); if (!entry) return; if (entry->CanFinishBuilding()) FinishBuilding(entry); } Commit Message: [BlobStorage] Fixing potential overflow Bug: 779314 Change-Id: I74612639d20544e4c12230569c7b88fbe669ec03 Reviewed-on: https://chromium-review.googlesource.com/747725 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Daniel Murphy <dmurph@chromium.org> Cr-Commit-Position: refs/heads/master@{#512977} CWE ID: CWE-119
0
150,295
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: decode_OFPAT_RAW_SET_TP_DST(ovs_be16 port, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { ofpact_put_SET_L4_DST_PORT(out)->port = ntohs(port); return 0; } Commit Message: ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org> CWE ID:
0
76,845
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; u32 eax, ebx, ecx, edx; /* * syscall should always be enabled in longmode - so only become * vendor specific (cpuid) if other modes are active... */ if (ctxt->mode == X86EMUL_MODE_PROT64) return true; eax = 0x00000000; ecx = 0x00000000; ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx); /* * Intel ("GenuineIntel") * remark: Intel CPUs only support "syscall" in 64bit * longmode. Also an 64bit guest with a * 32bit compat-app running will #UD !! While this * behaviour can be fixed (by emulating) into AMD * response - CPUs of AMD can't behave like Intel. */ if (ebx == X86EMUL_CPUID_VENDOR_GenuineIntel_ebx && ecx == X86EMUL_CPUID_VENDOR_GenuineIntel_ecx && edx == X86EMUL_CPUID_VENDOR_GenuineIntel_edx) return false; /* AMD ("AuthenticAMD") */ if (ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx && ecx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx && edx == X86EMUL_CPUID_VENDOR_AuthenticAMD_edx) return true; /* AMD ("AMDisbetter!") */ if (ebx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx && ecx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx && edx == X86EMUL_CPUID_VENDOR_AMDisbetterI_edx) return true; /* default: (not Intel, not AMD), apply Intel's stricter rules... */ return false; } Commit Message: KVM: emulate: avoid accessing NULL ctxt->memopp A failure to decode the instruction can cause a NULL pointer access. This is fixed simply by moving the "done" label as close as possible to the return. This fixes CVE-2014-8481. Reported-by: Andy Lutomirski <luto@amacapital.net> Cc: stable@vger.kernel.org Fixes: 41061cdb98a0bec464278b4db8e894a3121671f5 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-399
0
35,556
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void __exit floppy_module_exit(void) { int drive; blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); unregister_blkdev(FLOPPY_MAJOR, "fd"); platform_driver_unregister(&floppy_driver); destroy_workqueue(floppy_wq); for (drive = 0; drive < N_DRIVE; drive++) { del_timer_sync(&motor_off_timer[drive]); if (floppy_available(drive)) { del_gendisk(disks[drive]); platform_device_unregister(&floppy_device[drive]); } blk_cleanup_queue(disks[drive]->queue); blk_mq_free_tag_set(&tag_sets[drive]); /* * These disks have not called add_disk(). Don't put down * queue reference in put_disk(). */ if (!(allowed_drive_mask & (1 << drive)) || fdc_state[FDC(drive)].version == FDC_NONE) disks[drive]->queue = NULL; put_disk(disks[drive]); } cancel_delayed_work_sync(&fd_timeout); cancel_delayed_work_sync(&fd_timer); if (atomic_read(&usage_count)) floppy_release_irq_and_dma(); /* eject disk, if any */ fd_eject(0); } Commit Message: floppy: fix div-by-zero in setup_format_params This fixes a divide by zero error in the setup_format_params function of the floppy driver. Two consecutive ioctls can trigger the bug: The first one should set the drive geometry with such .sect and .rate values for the F_SECT_PER_TRACK to become zero. Next, the floppy format operation should be called. A floppy disk is not required to be inserted. An unprivileged user could trigger the bug if the device is accessible. The patch checks F_SECT_PER_TRACK for a non-zero value in the set_geometry function. The proper check should involve a reasonable upper limit for the .sect and .rate fields, but it could change the UAPI. The patch also checks F_SECT_PER_TRACK in the setup_format_params, and cancels the formatting operation in case of zero. The bug was found by syzkaller. Signed-off-by: Denis Efremov <efremov@ispras.ru> Tested-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-369
0
88,830
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int x509_get_key_usage( unsigned char **p, const unsigned char *end, unsigned int *key_usage) { int ret; size_t i; mbedtls_x509_bitstring bs = { 0, 0, NULL }; if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 ) return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); if( bs.len < 1 ) return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_INVALID_LENGTH ); /* Get actual bitstring */ *key_usage = 0; for( i = 0; i < bs.len && i < sizeof( unsigned int ); i++ ) { *key_usage |= (unsigned int) bs.p[i] << (8*i); } return( 0 ); } Commit Message: Improve behaviour on fatal errors If we didn't walk the whole chain, then there may be any kind of errors in the part of the chain we didn't check, so setting all flags looks like the safe thing to do. CWE ID: CWE-287
0
61,933
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void OmniboxViewWin::OnRButtonDown(UINT /*keys*/, const CPoint& point) { TrackMousePosition(kRight, point); tracking_double_click_ = false; possible_drag_ = false; gaining_focus_.reset(); SetMsgHandled(false); } Commit Message: Change omnibox behavior when stripping javascript schema to navigate after stripping the schema on drag drop. BUG=109245 TEST=N/A Review URL: http://codereview.chromium.org/9116016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116692 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
107,504
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client) { unsigned char *sigalgs, *sptr; int rhash, rsign; size_t i; if (salglen & 1) return 0; sigalgs = OPENSSL_malloc(salglen); if (sigalgs == NULL) return 0; for (i = 0, sptr = sigalgs; i < salglen; i+=2) { rhash = tls12_find_id(*psig_nids++, tls12_md, sizeof(tls12_md)/sizeof(tls12_lookup)); rsign = tls12_find_id(*psig_nids++, tls12_sig, sizeof(tls12_sig)/sizeof(tls12_lookup)); if (rhash == -1 || rsign == -1) goto err; *sptr++ = rhash; *sptr++ = rsign; } if (client) { if (c->client_sigalgs) OPENSSL_free(c->client_sigalgs); c->client_sigalgs = sigalgs; c->client_sigalgslen = salglen; } else { if (c->conf_sigalgs) OPENSSL_free(c->conf_sigalgs); c->conf_sigalgs = sigalgs; c->conf_sigalgslen = salglen; } return 1; err: OPENSSL_free(sigalgs); return 0; } Commit Message: CWE ID:
0
10,836
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int intel_pmu_cpu_prepare(int cpu) { struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); if (!(x86_pmu.extra_regs || x86_pmu.lbr_sel_map)) return NOTIFY_OK; cpuc->shared_regs = allocate_shared_regs(cpu); if (!cpuc->shared_regs) return NOTIFY_BAD; return NOTIFY_OK; } Commit Message: perf/x86: Fix offcore_rsp valid mask for SNB/IVB The valid mask for both offcore_response_0 and offcore_response_1 was wrong for SNB/SNB-EP, IVB/IVB-EP. It was possible to write to reserved bit and cause a GP fault crashing the kernel. This patch fixes the problem by correctly marking the reserved bits in the valid mask for all the processors mentioned above. A distinction between desktop and server parts is introduced because bits 24-30 are only available on the server parts. This version of the patch is just a rebase to perf/urgent tree and should apply to older kernels as well. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: peterz@infradead.org Cc: jolsa@redhat.com Cc: gregkh@linuxfoundation.org Cc: security@kernel.org Cc: ak@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org> CWE ID: CWE-20
0
31,673
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: linux_lvm2_vg_start_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { dbus_g_method_return (context); } else { if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, "Job was cancelled"); } else { throw_error (context, ERROR_FAILED, "Error starting LVM2 Volume Group: vgchange exited with exit code %d: %s", WEXITSTATUS (status), stderr); } } } Commit Message: CWE ID: CWE-200
0
11,741
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int64_t ComputeResponsePadding(const std::string& response_url, const crypto::SymmetricKey* padding_key, bool has_metadata) { DCHECK(!response_url.empty()); crypto::HMAC hmac(crypto::HMAC::SHA256); CHECK(hmac.Init(padding_key)); std::string key = has_metadata ? response_url + "METADATA" : response_url; uint64_t digest_start; CHECK(hmac.Sign(key, reinterpret_cast<uint8_t*>(&digest_start), sizeof(digest_start))); return digest_start % kPaddingRange; } Commit Message: Reland "AppCache: Add padding to cross-origin responses." This is a reland of 85b389caa7d725cdd31f59e9a2b79ff54804b7b7 Initialized CacheRecord::padding_size to 0. Original change's description: > AppCache: Add padding to cross-origin responses. > > Bug: 918293 > Change-Id: I4f16640f06feac009d6bbbb624951da6d2669f6c > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488059 > Commit-Queue: Staphany Park <staphany@chromium.org> > Reviewed-by: Victor Costan <pwnall@chromium.org> > Reviewed-by: Marijn Kruisselbrink <mek@chromium.org> > Cr-Commit-Position: refs/heads/master@{#644624} Bug: 918293 Change-Id: Ie1d3f99c7e8a854d33255a4d66243da2ce16441c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539906 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Staphany Park <staphany@chromium.org> Cr-Commit-Position: refs/heads/master@{#644719} CWE ID: CWE-200
0
151,442
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: String HTMLMediaElement::canPlayType(const String& mimeType) const { MIMETypeRegistry::SupportsType support = supportsType(ContentType(mimeType)); String canPlay; switch (support) { case MIMETypeRegistry::IsNotSupported: canPlay = emptyString; break; case MIMETypeRegistry::MayBeSupported: canPlay = "maybe"; break; case MIMETypeRegistry::IsSupported: canPlay = "probably"; break; } BLINK_MEDIA_LOG << "canPlayType(" << (void*)this << ", " << mimeType << ") -> " << canPlay; return canPlay; } Commit Message: [Blink>Media] Allow autoplay muted on Android by default There was a mistake causing autoplay muted is shipped on Android but it will be disabled if the chromium embedder doesn't specify content setting for "AllowAutoplay" preference. This CL makes the AllowAutoplay preference true by default so that it is allowed by embedders (including AndroidWebView) unless they explicitly disable it. Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/Q1cnzNI2GpI/AL_eyUNABgAJ BUG=689018 Review-Url: https://codereview.chromium.org/2677173002 Cr-Commit-Position: refs/heads/master@{#448423} CWE ID: CWE-119
0
128,753
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void notEnumerableLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueInt(info, imp->notEnumerableLongAttribute()); } Commit Message: document.location bindings fix BUG=352374 R=jochen@chromium.org Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-399
0
122,420
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: KeyboardOverlayHandler::KeyboardOverlayHandler(Profile* profile) : profile_(profile) { } Commit Message: Add missing shortcut keys to the keyboard overlay. This CL adds the following shortcuts to the keyboard overlay. * Alt - 1, Alt - 2, .., Alt - 8: go to the window at the specified position * Alt - 9: go to the last window open * Ctrl - Forward: switches focus to the next keyboard-accessible pane * Ctrl - Back: switches focus to the previous keyboard-accessible pane * Ctrl - Right: move the text cursor to the end of the next word * Ctrl - Left: move the text cursor to the start of the previous word * Ctrl - Alt - Z: enable or disable accessibility features * Ctrl - Shift - Maximize: take a screenshot of the selected region * Ctrl - Shift - O: open the Bookmark Manager I also deleted a duplicated entry of "Close window". BUG=chromium-os:17152 TEST=Manually checked on chromebook Review URL: http://codereview.chromium.org/7489040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93906 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
99,059
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderThreadImpl::RecordAction(const base::UserMetricsAction& action) { Send(new ViewHostMsg_UserMetricsRecordAction(action.str_)); } Commit Message: Suspend shared timers while blockingly closing databases BUG=388771 R=michaeln@chromium.org Review URL: https://codereview.chromium.org/409863002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284785 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-362
0
111,165
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "keyframe_count = %u\n", entries); if (!entries) { sc->keyframe_absent = 1; if (!st->need_parsing && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (sc->keyframes) av_log(c->fc, AV_LOG_WARNING, "Duplicated STSS atom\n"); if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; av_freep(&sc->keyframes); sc->keyframe_count = 0; sc->keyframes = av_malloc_array(entries, sizeof(*sc->keyframes)); if (!sc->keyframes) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->keyframes[i] = avio_rb32(pb); } sc->keyframe_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; } Commit Message: avformat/mov: Fix DoS in read_tfra() Fixes: Missing EOF check in loop No testcase Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> CWE ID: CWE-834
0
61,465
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int sample_conv_http_date(const struct arg *args, struct sample *smp) { const char day[7][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct chunk *temp; struct tm *tm; time_t curr_date = smp->data.uint; /* add offset */ if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT)) curr_date += args[0].data.sint; tm = gmtime(&curr_date); temp = get_trash_chunk(); temp->len = snprintf(temp->str, temp->size - temp->len, "%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon], 1900+tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); smp->data.str = *temp; smp->type = SMP_T_STR; return 1; } Commit Message: CWE ID: CWE-189
0
9,831
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: person_set_color(person_t* person, color_t mask) { person->mask = mask; } Commit Message: Fix integer overflow in layer_resize in map_engine.c (#268) * Fix integer overflow in layer_resize in map_engine.c There's a buffer overflow bug in the function layer_resize. It allocates a buffer `tilemap` with size `x_size * y_size * sizeof(struct map_tile)`. But it didn't check for integer overflow, so if x_size and y_size are very large, it's possible that the buffer size is smaller than needed, causing a buffer overflow later. PoC: `SetLayerSize(0, 0x7FFFFFFF, 0x7FFFFFFF);` * move malloc to a separate line CWE ID: CWE-190
0
75,105
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int sctp_getsockopt_associnfo(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_assocparams assocparams; struct sctp_association *asoc; struct list_head *pos; int cnt = 0; if (len != sizeof (struct sctp_assocparams)) return -EINVAL; if (copy_from_user(&assocparams, optval, sizeof (struct sctp_assocparams))) return -EFAULT; asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id); if (!asoc && assocparams.sasoc_assoc_id && sctp_style(sk, UDP)) return -EINVAL; /* Values correspoinding to the specific association */ if (asoc) { assocparams.sasoc_asocmaxrxt = asoc->max_retrans; assocparams.sasoc_peer_rwnd = asoc->peer.rwnd; assocparams.sasoc_local_rwnd = asoc->a_rwnd; assocparams.sasoc_cookie_life = (asoc->cookie_life.tv_sec * 1000) + (asoc->cookie_life.tv_usec / 1000); list_for_each(pos, &asoc->peer.transport_addr_list) { cnt ++; } assocparams.sasoc_number_peer_destinations = cnt; } else { /* Values corresponding to the endpoint */ struct sctp_sock *sp = sctp_sk(sk); assocparams.sasoc_asocmaxrxt = sp->assocparams.sasoc_asocmaxrxt; assocparams.sasoc_peer_rwnd = sp->assocparams.sasoc_peer_rwnd; assocparams.sasoc_local_rwnd = sp->assocparams.sasoc_local_rwnd; assocparams.sasoc_cookie_life = sp->assocparams.sasoc_cookie_life; assocparams.sasoc_number_peer_destinations = sp->assocparams. sasoc_number_peer_destinations; } if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, &assocparams, len)) return -EFAULT; return 0; } Commit Message: [SCTP]: Fix assertion (!atomic_read(&sk->sk_rmem_alloc)) failed message In current implementation, LKSCTP does receive buffer accounting for data in sctp_receive_queue and pd_lobby. However, LKSCTP don't do accounting for data in frag_list when data is fragmented. In addition, LKSCTP doesn't do accounting for data in reasm and lobby queue in structure sctp_ulpq. When there are date in these queue, assertion failed message is printed in inet_sock_destruct because sk_rmem_alloc of oldsk does not become 0 when socket is destroyed. Signed-off-by: Tsutomu Fujii <t-fujii@nb.jp.nec.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID:
0
35,007
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int list_to_usage(const char *list, int *flag) { int mask = 0; const char *word = NULL, *p = list; if (p && strncmp(p, "no", 2) == 0) { *flag = BLKID_FLTR_NOTIN; p += 2; } if (!p || !*p) goto err; while(p) { word = p; p = strchr(p, ','); if (p) p++; if (!strncmp(word, "filesystem", 10)) mask |= BLKID_USAGE_FILESYSTEM; else if (!strncmp(word, "raid", 4)) mask |= BLKID_USAGE_RAID; else if (!strncmp(word, "crypto", 6)) mask |= BLKID_USAGE_CRYPTO; else if (!strncmp(word, "other", 5)) mask |= BLKID_USAGE_OTHER; else goto err; } return mask; err: *flag = 0; fprintf(stderr, "unknown keyword in -u <list> argument: '%s'\n", word ? word : list); exit(BLKID_EXIT_OTHER); } Commit Message: libblkid: care about unsafe chars in cache The high-level libblkid API uses /run/blkid/blkid.tab cache to store probing results. The cache format is <device NAME="value" ...>devname</device> and unfortunately the cache code does not escape quotation marks: # mkfs.ext4 -L 'AAA"BBB' # cat /run/blkid/blkid.tab ... <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device> such string is later incorrectly parsed and blkid(8) returns nonsenses. And for use-cases like # eval $(blkid -o export /dev/sdb1) it's also insecure. Note that mount, udevd and blkid -p are based on low-level libblkid API, it bypass the cache and directly read data from the devices. The current udevd upstream does not depend on blkid(8) output at all, it's directly linked with the library and all unsafe chars are encoded by \x<hex> notation. # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1 # udevadm info --export-db | grep LABEL ... E: ID_FS_LABEL=X__/tmp/foo___ E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22 Signed-off-by: Karel Zak <kzak@redhat.com> CWE ID: CWE-77
0
74,630
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebRunnerBrowserContext::CreateMediaRequestContext() { DCHECK(url_request_getter_.get()); return url_request_getter_.get(); } Commit Message: [fuchsia] Implement browser tests for WebRunner Context service. Tests may interact with the WebRunner FIDL services and the underlying browser objects for end to end testing of service and browser functionality. * Add a browser test launcher main() for WebRunner. * Add some simple navigation tests. * Wire up GoBack()/GoForward() FIDL calls. * Add embedded test server resources and initialization logic. * Add missing deletion & notification calls to BrowserContext dtor. * Use FIDL events for navigation state changes. * Bug fixes: ** Move BrowserContext and Screen deletion to PostMainMessageLoopRun(), so that they may use the MessageLoop during teardown. ** Fix Frame dtor to allow for null WindowTreeHosts (headless case) ** Fix std::move logic in Frame ctor which lead to no WebContents observer being registered. Bug: 871594 Change-Id: I36bcbd2436d534d366c6be4eeb54b9f9feadd1ac Reviewed-on: https://chromium-review.googlesource.com/1164539 Commit-Queue: Kevin Marshall <kmarshall@chromium.org> Reviewed-by: Wez <wez@chromium.org> Reviewed-by: Fabrice de Gans-Riberi <fdegans@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/master@{#584155} CWE ID: CWE-264
0
131,214
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ResourceLoaderBrowserTest() {} Commit Message: Revert "Don't sniff HTML from documents delivered via the file protocol" This reverts commit 3519e867dc606437f804561f889d7ed95b95876a. Reason for revert: crbug.com/786150. Application compatibility for Android WebView applications means we need to allow sniffing on that platform. Original change's description: > Don't sniff HTML from documents delivered via the file protocol > > To reduce attack surface, Chrome should not MIME-sniff to text/html for > any document delivered via the file protocol. This change only impacts > the file protocol (documents served via HTTP/HTTPS/etc are unaffected). > > Bug: 777737 > Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet > Change-Id: I7086454356b8d2d092be9e1bca0f5ff6dd3b62c0 > Reviewed-on: https://chromium-review.googlesource.com/751402 > Reviewed-by: Ben Wells <benwells@chromium.org> > Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> > Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> > Reviewed-by: Asanka Herath <asanka@chromium.org> > Reviewed-by: Matt Menke <mmenke@chromium.org> > Commit-Queue: Eric Lawrence <elawrence@chromium.org> > Cr-Commit-Position: refs/heads/master@{#514372} TBR=achuith@chromium.org,benwells@chromium.org,mmenke@chromium.org,sdefresne@chromium.org,asanka@chromium.org,elawrence@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 777737 Change-Id: I864ae060ce3277d41ea257ae75e0b80c51f3ea98 Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet Reviewed-on: https://chromium-review.googlesource.com/790790 Reviewed-by: Eric Lawrence <elawrence@chromium.org> Reviewed-by: Matt Menke <mmenke@chromium.org> Commit-Queue: Eric Lawrence <elawrence@chromium.org> Cr-Commit-Position: refs/heads/master@{#519347} CWE ID:
0
148,385
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SampleIterator::reset() { mSampleToChunkIndex = 0; mFirstChunk = 0; mFirstChunkSampleIndex = 0; mStopChunk = 0; mStopChunkSampleIndex = 0; mSamplesPerChunk = 0; mChunkDesc = 0; } Commit Message: SampleIterator: clear members on seekTo error Bug: 31091777 Change-Id: Iddf99d0011961d0fd3d755e57db4365b6a6a1193 (cherry picked from commit 03237ce0f9584c98ccda76c2474a4ae84c763f5b) CWE ID: CWE-200
0
157,700
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static __always_inline void __vma_unlink_common(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev, bool has_prev, struct vm_area_struct *ignore) { struct vm_area_struct *next; vma_rb_erase_ignore(vma, &mm->mm_rb, ignore); next = vma->vm_next; if (has_prev) prev->vm_next = next; else { prev = vma->vm_prev; if (prev) prev->vm_next = next; else mm->mmap = next; } if (next) next->vm_prev = prev; /* Kill the cache */ vmacache_invalidate(mm); } Commit Message: coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping The core dumping code has always run without holding the mmap_sem for writing, despite that is the only way to ensure that the entire vma layout will not change from under it. Only using some signal serialization on the processes belonging to the mm is not nearly enough. This was pointed out earlier. For example in Hugh's post from Jul 2017: https://lkml.kernel.org/r/alpine.LSU.2.11.1707191716030.2055@eggly.anvils "Not strictly relevant here, but a related note: I was very surprised to discover, only quite recently, how handle_mm_fault() may be called without down_read(mmap_sem) - when core dumping. That seems a misguided optimization to me, which would also be nice to correct" In particular because the growsdown and growsup can move the vm_start/vm_end the various loops the core dump does around the vma will not be consistent if page faults can happen concurrently. Pretty much all users calling mmget_not_zero()/get_task_mm() and then taking the mmap_sem had the potential to introduce unexpected side effects in the core dumping code. Adding mmap_sem for writing around the ->core_dump invocation is a viable long term fix, but it requires removing all copy user and page faults and to replace them with get_dump_page() for all binary formats which is not suitable as a short term fix. For the time being this solution manually covers the places that can confuse the core dump either by altering the vma layout or the vma flags while it runs. Once ->core_dump runs under mmap_sem for writing the function mmget_still_valid() can be dropped. Allowing mmap_sem protected sections to run in parallel with the coredump provides some minor parallelism advantage to the swapoff code (which seems to be safe enough by never mangling any vma field and can keep doing swapins in parallel to the core dumping) and to some other corner case. In order to facilitate the backporting I added "Fixes: 86039bd3b4e6" however the side effect of this same race condition in /proc/pid/mem should be reproducible since before 2.6.12-rc2 so I couldn't add any other "Fixes:" because there's no hash beyond the git genesis commit. Because find_extend_vma() is the only location outside of the process context that could modify the "mm" structures under mmap_sem for reading, by adding the mmget_still_valid() check to it, all other cases that take the mmap_sem for reading don't need the new check after mmget_not_zero()/get_task_mm(). The expand_stack() in page fault context also doesn't need the new check, because all tasks under core dumping are frozen. Link: http://lkml.kernel.org/r/20190325224949.11068-1-aarcange@redhat.com Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reported-by: Jann Horn <jannh@google.com> Suggested-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Jann Horn <jannh@google.com> Acked-by: Jason Gunthorpe <jgg@mellanox.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-362
0
90,537
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void smp_start_passkey_verification(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t* p = NULL; SMP_TRACE_DEBUG("%s", __func__); p = p_cb->local_random; UINT32_TO_STREAM(p, p_data->passkey); p = p_cb->peer_random; UINT32_TO_STREAM(p, p_data->passkey); p_cb->round = 0; smp_start_nonce_generation(p_cb); } Commit Message: Checks the SMP length to fix OOB read Bug: 111937065 Test: manual Change-Id: I330880a6e1671d0117845430db4076dfe1aba688 Merged-In: I330880a6e1671d0117845430db4076dfe1aba688 (cherry picked from commit fceb753bda651c4135f3f93a510e5fcb4c7542b8) CWE ID: CWE-200
0
162,793
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ChromeWebContentsDelegateAndroid::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_FIND_RESULT_AVAILABLE: OnFindResultAvailable( content::Source<WebContents>(source).ptr(), content::Details<FindNotificationDetails>(details).ptr()); break; default: NOTREACHED() << "Unexpected notification: " << type; break; } } Commit Message: Revert "Load web contents after tab is created." This reverts commit 4c55f398def3214369aefa9f2f2e8f5940d3799d. BUG=432562 TBR=tedchoc@chromium.org,jbudorick@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/894003005 Cr-Commit-Position: refs/heads/master@{#314469} CWE ID: CWE-399
0
109,861