instruction
stringclasses
1 value
input
stringlengths
64
129k
output
int64
0
1
__index_level_0__
int64
0
30k
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: bt_status_t btsock_rfc_init(int poll_thread_handle) { pth = poll_thread_handle; memset(rfc_slots, 0, sizeof(rfc_slots)); for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i) { rfc_slots[i].scn = -1; rfc_slots[i].sdp_handle = 0; rfc_slots[i].fd = INVALID_FD; rfc_slots[i].app_fd = INVALID_FD; ...
0
19,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: my_object_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { ENUM_ENTRY (MY_OBJECT_ERROR_FOO, "Foo"), ENUM_ENTRY (MY_OBJECT_ERROR_BAR, "Bar"), { 0, 0, 0 } }; etype = g_enum_register_static ("MyObjectError", values); } return etype; } Commi...
1
18,056
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 lock_pi_update_atomic(u32 __user *uaddr, u32 uval, u32 newval) { u32 uninitialized_var(curval); if (unlikely(should_fail_futex(true))) return -EFAULT; if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))) return -EFAULT; /* If user space value changed, let the caller retry ...
0
16,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: static int tls12_get_pkey_idx(unsigned char sig_alg) { switch(sig_alg) { #ifndef OPENSSL_NO_RSA case TLSEXT_signature_rsa: return SSL_PKEY_RSA_SIGN; #endif #ifndef OPENSSL_NO_DSA case TLSEXT_signature_dsa: return SSL_PKEY_DSA_SIGN; #endif #ifndef OPENSSL_NO_ECDSA case TLSEXT_signature_ecdsa: return S...
0
15,373
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: COMPAT_SYSCALL_DEFINE5(execveat, int, fd, const char __user *, filename, const compat_uptr_t __user *, argv, const compat_uptr_t __user *, envp, int, flags) { int lookup_flags = (flags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; return compat_do_execveat(fd, getname_flags(fi...
0
9,790
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 registerErrorURL(const char* file, int statusCode) { WebURLError error; error.reason = 0xdead + statusCode; error.domain = "PageSerializerTest"; WebURLResponse response; response.initialize(); response.setMIMEType("text/html"); response.setHTTP...
0
6,790
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 inline struct msg_queue *msq_obtain_object_check(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&msg_ids(ns), id); if (IS_ERR(ipcp)) return ERR_CAST(ipcp); return container_of(ipcp, struct msg_queue, q_perm); } Commit Message: Initialize msg/shm IPC ...
0
4,091
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 ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *fpos) { struct seq_file *m = filp->private_data; struct trace_array *tr = m->private; char buf[64]; const char *clockstr; int ret; if (cnt >= sizeof(buf)) return -EINVAL; if (copy_from_user(buf, ub...
0
22,750
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: sg_add_sfp(Sg_device * sdp) { Sg_fd *sfp; unsigned long iflags; int bufflen; sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); if (!sfp) return ERR_PTR(-ENOMEM); init_waitqueue_head(&sfp->read_wait); rwlock_init(&sfp->rq_list_lock); kref_init(&sfp->f_ref); sfp->timeout = SG_DEFAULT_TIMEOUT; s...
0
17,872
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 RenderFrameImpl::OnCommitNavigation( const ResourceResponseHead& response, const GURL& stream_url, const CommonNavigationParams& common_params, const RequestNavigationParams& request_params) { CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigat...
0
1,756
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 ssize_t proc_fault_inject_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task; char buffer[PROC_NUMBUF]; int make_it_fail; int rv; if (!capable(CAP_SYS_RESOURCE)) return -EPERM; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) ...
0
13,676
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: int32_t AXTree::GetNextNegativeInternalNodeId() { int32_t return_value = next_negative_internal_node_id_; next_negative_internal_node_id_--; if (next_negative_internal_node_id_ > 0) next_negative_internal_node_id_ = -1; return return_value; } Commit Message: Position info (item n of m) incorrect if h...
0
22,520
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 CLASS sony_arw_load_raw() { ushort huff[32768]; static const ushort tab[18] = { 0xf11,0xf10,0xe0f,0xd0e,0xc0d,0xb0c,0xa0b,0x90a,0x809, 0x708,0x607,0x506,0x405,0x304,0x303,0x300,0x202,0x201 }; int i, c, n, col, row, len, diff, sum=0; for (n=i=0; i < 18; i++) FORC(32768 >> (tab[i] >> 8)) huf...
0
19,880
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 show_stack(struct task_struct *tsk, unsigned long *stack) { unsigned long sp, ip, lr, newsp; int count = 0; int firstframe = 1; #ifdef CONFIG_FUNCTION_GRAPH_TRACER int curr_frame = current->curr_ret_stack; extern void return_to_handler(void); unsigned long rth = (unsigned long)return_to_handler; unsig...
0
16,776
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: nfsd4_layoutcommit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_layoutcommit *lcp) { const struct nfsd4_layout_seg *seg = &lcp->lc_seg; struct svc_fh *current_fh = &cstate->current_fh; const struct nfsd4_layout_ops *ops; loff_t new_size = lcp->lc_last_wr + 1; struct inode *in...
0
12,777
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: gx_device_set_procs(gx_device * dev) { if (dev->static_procs != 0) { /* 0 if already populated */ dev->procs = *dev->static_procs; dev->static_procs = 0; } } Commit Message: CWE ID: CWE-78
0
1,671
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 const IntSize MaxDragImageSize(float device_scale_factor) { #if defined(OS_MACOSX) static const IntSize kMaxDragImageSize(400, 400); #else static const IntSize kMaxDragImageSize(200, 200); #endif IntSize max_size_in_pixels = kMaxDragImageSize; max_size_in_pixels.Scale(device_scale_factor); return...
0
13,678
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 RenderView::RunJavaScriptMessage(int type, const string16& message, const string16& default_value, const GURL& frame_url, string16* result) { bool success ...
0
21,320
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 GLES2DecoderImpl::DoUniform3fv( GLint location, GLsizei count, const GLfloat* value) { GLenum type = 0; if (!PrepForSetUniformByLocation(location, "glUniform3fv", &type, &count)) { return; } if (type == GL_BOOL_VEC3) { GLsizei num_values = count * 3; scoped_array<GLint> temp(new GLint...
0
9,099
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: read_Times(struct archive_read *a, struct _7z_header_info *h, int type) { struct _7zip *zip = (struct _7zip *)a->format->data; const unsigned char *p; struct _7zip_entry *entries = zip->entries; unsigned char *timeBools; int allAreDefined; unsigned i; timeBools = calloc((size_t)zip->numFiles, sizeof(*time...
0
26,926
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 RenderMessageFilter::OnGetProcessMemorySizes( size_t* private_bytes, size_t* shared_bytes) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); using base::ProcessMetrics; #if !defined(OS_MACOSX) || defined(OS_IOS) scoped_ptr<ProcessMetrics> metrics( ProcessMetrics::CreateProcessMetrics(p...
0
10,711
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: AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& axObjectCache) : AXObject(axObjectCache), m_ariaRole(UnknownRole), m_childrenDirty(false), m_node(node) { } Commit Message: Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview...
0
9,953
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 UINT drdynvc_virtual_channel_event_attached(drdynvcPlugin* drdynvc) { int i; DVCMAN* dvcman; if (!drdynvc) return CHANNEL_RC_BAD_CHANNEL_HANDLE; dvcman = (DVCMAN*) drdynvc->channel_mgr; if (!dvcman) return CHANNEL_RC_BAD_CHANNEL_HANDLE; for (i = 0; i < dvcman->num_plugins; i++) { UINT erro...
0
5,410
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 curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS) { zval *res; if (zend_parse_parameters_none() == FAILURE) { return; } res = zend_read_property(curl_CURLFile_class, getThis(), name, strlen(name), 1 TSRMLS_CC); *return_value = *res; zval_copy_ctor(return_value); INIT_PZVAL(retur...
0
23,075
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: __ap_send(ap_qid_t qid, unsigned long long psmid, void *msg, size_t length, unsigned int special) { typedef struct { char _[length]; } msgblock; register unsigned long reg0 asm ("0") = qid | 0x40000000UL; register struct ap_queue_status reg1 asm ("1"); register unsigned long reg2 asm ("2") = (unsigned long...
0
26,300
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 GDataFileSystem::OnTransferCompleted( const FileOperationCallback& callback, GDataFileError error, scoped_ptr<UploadFileInfo> upload_file_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); if (error == GDATA_FILE_OK && upload_file_info->entry.get...
0
18,559
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: ALWAYS_INLINE error::Error GLES2DecoderImpl::DoMultiDrawArrays( const char* function_name, bool instanced, GLenum mode, const GLint* firsts, const GLsizei* counts, const GLsizei* primcounts, GLsizei drawcount) { error::Error error = WillAccessBoundFramebufferForDraw(); if (error !=...
0
1,705
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 SyncTest::SetUpCommandLine(CommandLine* cl) { AddTestSwitches(cl); AddOptionalTypesToCommandLine(cl); } Commit Message: [Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com/10443046 git-svn-id: svn://svn.chromium.org...
0
3,041
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: xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { xmlChar *version; /* * This value for standalone indicates that the document has an * XML declaration but it does not have a standalone attribute. * It will be overwritten later if a standalone attribute is found. */ ctxt->input->standalone...
0
22,668
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 ttusbdecfe_dvbt_read_status(struct dvb_frontend *fe, fe_status_t *status) { struct ttusbdecfe_state* state = fe->demodulator_priv; u8 b[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; u8 result[4]; int len, ret; *status=0; ret=state->config->send_command(fe, 0x73, sizeof(b), b, &l...
0
7,577
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 ssize_t lbs_wrmac_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; ssize_t res, buf_size; u32 offset, value; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; if (!buf) return...
0
25,918
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: T1_Set_Var_Design( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) { FT_Long lcoords[4]; /* maximum axis count is 4 */ FT_UInt i; FT_Error error; error = FT_ERR( Invalid_Argument ); if ( num_coords <= 4 && num_coord...
0
21,129
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 LockContentsView::OnEasyUnlockIconHovered() { LoginBigUserView* big_view = CurrentBigUserView(); if (!big_view->auth_user()) return; UserState* state = FindStateForUser(big_view->GetCurrentUser()->basic_user_info->account_id); DCHECK(state); mojom::EasyUnlockIconOptionsPtr& easy_unlock_s...
0
7,148
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: SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, unsigned int, flags, struct sockaddr __user *, addr, int __user *, addr_len) { struct socket *sock; struct iovec iov; struct msghdr msg; struct sockaddr_storage address; int err, err2; int fput_needed; err = import_single_range(READ...
0
26,387
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_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { const int num = avio_rb32(pb); const int den = avio_rb32(pb); AVStream *st; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if ((st->sample_aspect_ratio.den != 1 || st->sample_...
0
15,592
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 php_zip_status_sys(struct zip *za TSRMLS_DC) /* {{{ */ { int zep, syp; zip_error_get(za, &zep, &syp); return syp; } /* }}} */ Commit Message: Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize CWE ID: CWE-416
0
11,323
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 size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count) /* {{{ */ { return 0; } /* }}} */ Commit Message: CWE ID:
0
16,241
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 ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta) { u8 ignore_for_response = sta->sta.uapsd_queues; /* * If all ACs are delivery-enabled then we should reply * from any of them, if only some are enabled we reply * only from the non-enabled ones. */ if (ignore_for_response == BIT(IEEE80...
0
12,634
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 PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { if (extension->location() == Manifest::COMPONENT) return true; const ExtensionsClient::ScriptingWhitelist& whitelist = ExtensionsClient::Get()->GetScriptingWhitelist(); return base::ContainsValue(whitelist, extension-...
0
12,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: int restrict_link_reject(struct key *keyring, const struct key_type *type, const union key_payload *payload, struct key *restriction_key) { return -EPERM; } Commit Message: KEYS: Fix race between updating and finding a negative key Consolidate KEY_FLAG_INSTANTIATED, KEY_FLAG_NEGATIVE and the reject...
0
7,485
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 TabStripModel::WillContextMenuPin(int index) { std::vector<int> indices = GetIndicesForCommand(index); bool all_pinned = true; for (size_t i = 0; i < indices.size() && all_pinned; ++i) { if (!IsAppTab(index)) // We never change app tabs. all_pinned = IsTabPinned(indices[i]); } return !al...
0
20,555
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 addArgumentToVtab(Parse *pParse){ if( pParse->sArg.z && pParse->pNewTable ){ const char *z = (const char*)pParse->sArg.z; int n = pParse->sArg.n; sqlite3 *db = pParse->db; addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n)); } } Commit Message: sqlite: safely move...
0
18,717
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 des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); crypt_s390_km(KM_DEA_ENCRYPT, ctx->key, out, in, DES_BLOCK_SIZE); } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" ...
0
19,131
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 TestBlinkPlatformSupport::cryptographicallyRandomValues( unsigned char* buffer, size_t length) { } Commit Message: Add assertions that the empty Platform::cryptographicallyRandomValues() overrides are not being used. These implementations are not safe and look scary if not accompanied by an ass...
1
2,910
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: EntrySync* EntrySync::create(EntryBase* entry) { if (entry->isFile()) return FileEntrySync::create(entry->m_fileSystem, entry->m_fullPath); return DirectoryEntrySync::create(entry->m_fileSystem, entry->m_fullPath); } Commit Message: Oilpan: Ship Oilpan for SyncCallbackHelper, CreateFileResult and...
0
22,142
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 WebGLRenderingContextBase::bufferSubData(GLenum target, int64_t offset, DOMArrayBuffer* data) { if (isContextLost()) return; DCHECK(data); BufferSubDataImpl(target, offset, data->ByteLength(), data->Data());...
0
7,970
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 install_session_keyring(struct key *keyring) { struct cred *new; int ret; new = prepare_creds(); if (!new) return -ENOMEM; ret = install_session_keyring_to_cred(new, keyring); if (ret < 0) { abort_creds(new); return ret; } return commit_creds(new); } Commit Message: keys: fix race wit...
0
7,697
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: jas_image_t *pnm_decode(jas_stream_t *in, char *opts) { pnm_hdr_t hdr; jas_image_t *image; jas_image_cmptparm_t cmptparms[3]; jas_image_cmptparm_t *cmptparm; int i; JAS_DBGLOG(10, ("pnm_decode(%p, \"%s\")\n", in, opts ? opts : "")); if (opts) { jas_eprintf("warning: ignoring options\n"); } /* Read t...
0
2,162
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: GetWord(Buffer *buf) { int b, e; char *p; if ((p = getCurWord(buf, &b, &e)) != NULL) { return Strnew_charp_n(p, e - b)->ptr; } return NULL; } Commit Message: Make temporary directory safely when ~/.w3m is unwritable CWE ID: CWE-59
0
27,529
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 ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) { ENTER(); if (!opts || !*opts) return 0; for (;;) { unsigned long value; char *eq, *comma; /* Option limit */ comma = strchr(opts, ','); if (comma) *comma = 0; /* Value limit */ eq = strchr(opts, '='); if (unlikel...
0
16,301
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: hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, struct sshkey *key) { struct ssh *ssh = active_state; /* XXX */ const char *resolvedname, *ipaddr, *lookup, *reason; HostStatus host_status; int len; char *fp; if (auth_key_is_revoked(key)) return 0; resolvedname = auth_get_ca...
0
18,251
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::DestroyBrowser() { browser_.reset(); } 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-...
0
24,380
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 oz_clean_endpoints_for_interface(struct usb_hcd *hcd, struct oz_port *port, int if_ix) { struct oz_hcd *ozhcd = port->ozhcd; unsigned mask; int i; LIST_HEAD(ep_list); struct oz_endpoint *ep, *n; oz_dbg(ON, "Deleting endpoints for interface %d\n", if_ix); if (if_ix >= port->num_iface) retu...
0
6,477
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: irc_ctcp_display_request (struct t_irc_server *server, time_t date, const char *command, struct t_irc_channel *channel, const char *nick, const char *address, ...
0
752
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 StreamTcpTest22 (void) { StreamTcpThread stt; struct in_addr addr; char os_policy_name[10] = "windows"; const char *ip_addr; TcpStream stream; Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; int ret = 0; memset(&addr, ...
0
24,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: TemplateURLRef::TemplateURLRef(const TemplateURL* owner, Type type) : owner_(owner), type_(type), index_in_owner_(0), parsed_(false), valid_(false), supports_replacements_(false), search_term_position_in_path_(std::string::npos), search_term_key_location_(url::Parsed:...
0
18,726
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_postload() { LOG_DEBUG("%s posting postload work item", __func__); thread_post(thread, event_postload, NULL); } Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta...
0
29,300
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 SendAutomationJSONRequest(AutomationMessageSender* sender, const DictionaryValue& request_dict, DictionaryValue* reply_dict, std::string* error_msg) { std::string request, reply; base::JSONWriter::Write(&reque...
1
21,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 void __exit bt_exit(void) { sco_exit(); l2cap_exit(); hci_sock_cleanup(); sock_unregister(PF_BLUETOOTH); bt_sysfs_cleanup(); debugfs_remove_recursive(bt_debugfs); } Commit Message: net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. re...
0
29,037
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_process_dhkey_check(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t* p = (uint8_t*)p_data; uint8_t reason = SMP_INVALID_PARAMETERS; SMP_TRACE_DEBUG("%s", __func__); if (smp_command_has_invalid_parameters(p_cb)) { smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); return; } if (p != NULL) { ...
0
17,739
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 GpuCommandBufferStub::SetPreemptByCounter( scoped_refptr<gpu::RefCountedCounter> counter) { preempt_by_counter_ = counter; if (scheduler_.get()) scheduler_->SetPreemptByCounter(preempt_by_counter_); } Commit Message: Sizes going across an IPC should be uint32. BUG=164946 Review URL: https://ch...
0
27,146
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 WebGraphicsContext3DCommandBufferImpl::bindFramebuffer( WGC3Denum target, WebGLId framebuffer) { gl_->BindFramebuffer(target, framebuffer); bound_fbo_ = framebuffer; } Commit Message: Convert plugin and GPU process to brokered handle duplication. BUG=119250 Review URL: https://chromiumcoderevie...
0
16,806
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 ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_down) { struct ieee80211_local *local = sdata->local; unsigned long flags; struct sk_buff *skb, *tmp; u32 hw_reconf_flags = 0; int i; enum nl80211_channel_type orig_ct; clear_bit(SDATA_STATE_RUNNING, &sdata->state); i...
0
21,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 php_session_rfc1867_callback(unsigned int event, void *event_data, void **extra TSRMLS_DC) /* {{{ */ { php_session_rfc1867_progress *progress; int retval = SUCCESS; if (php_session_rfc1867_orig_callback) { retval = php_session_rfc1867_orig_callback(event, event_data, extra TSRMLS_CC); } if (!PS...
0
6,498
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 snd_timer_notify1(struct snd_timer_instance *ti, int event) { struct snd_timer *timer; unsigned long flags; unsigned long resolution = 0; struct snd_timer_instance *ts; struct timespec tstamp; if (timer_tstamp_monotonic) ktime_get_ts(&tstamp); else getnstimeofday(&tstamp); if (snd_BUG_ON(...
0
7,110
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: __xml_log_element(int log_level, const char *file, const char *function, int line, const char *prefix, xmlNode * data, int depth, int options) { int max = 0; int offset = 0; const char *name = NULL; const char *hidden = NULL; xmlNode *child = NULL; xmlAttrPtr pIter = NUL...
0
16,426
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 add_to_common_flags2(uint32 v) { common_flags2 |= v; } Commit Message: CWE ID:
0
12,964
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 OMX::invalidateNodeID_l(node_id node) { mNodeIDToInstance.removeItem(node); } Commit Message: Add VPX output buffer size check and handle dead observers more gracefully Bug: 27597103 Change-Id: Id7acb25d5ef69b197da15ec200a9e4f9e7b03518 CWE ID: CWE-264
0
26,968
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 AudioFlinger::EffectChain::isNonOffloadableEnabled() { Mutex::Autolock _l(mLock); size_t size = mEffects.size(); for (size_t i = 0; i < size; i++) { if (mEffects[i]->isEnabled() && !mEffects[i]->isOffloadable()) { return true; } } return false; } Commit Message: Add EFFECT_CMD_SET_PARAM parameter ch...
0
24,344
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: ~FPDF_SYSFONTINFO_WITHMETRICS() { FPDF_FreeDefaultSystemFontInfo(default_sysfontinfo); } Commit Message: [pdf] Use a temporary list when unloading pages When traversing the |deferred_page_unloads_| list and handling the unloads it's possible for new pages to get added to the list which will invalidate t...
0
28,635
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 try_to_simplify_commit(struct rev_info *revs, struct commit *commit) { struct commit_list **pp, *parent; struct treesame_state *ts = NULL; int relevant_change = 0, irrelevant_change = 0; int relevant_parents, nth_parent; /* * If we don't do pruning, everything is interesting */ if (!revs->p...
0
3,621
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 unsigned lodepng_get_bpp_lct(LodePNGColorType colortype, unsigned bitdepth) { /*bits per pixel is amount of channels * bits per channel*/ return getNumColorChannels(colortype) * bitdepth; } Commit Message: Fixed #5645: realloc return handling CWE ID: CWE-772
0
23,251
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_wakeup(void) { reschedule_timeout(MAXTIMEOUT, "do wakeup"); cont = NULL; command_status += 2; wake_up(&command_done); } Commit Message: floppy: don't write kernel-only members to FDRAWCMD ioctl output Do not leak kernel-only floppy_raw_cmd structure members to userspace. This includes the lin...
0
1,405
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 fetchargs_fini (struct fetchargs *fa) { section_list_free(fa->binsections); section_list_free(fa->sizesections); section_list_free(fa->bodysections); freefieldlist(fa->fsections); strarray_fini(&fa->headers); strarray_fini(&fa->headers_not); strarray_fini(&fa->entries); ...
0
604
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: maybe_enqueue_incoming_job(conn c) { job j = c->in_job; /* do we have a complete job? */ if (c->in_job_read == j->body_size) return enqueue_incoming_job(c); /* otherwise we have incomplete data, so just keep waiting */ c->state = STATE_WANTDATA; } Commit Message: Discard job body bytes if t...
0
5,156
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 reds_handle_new_link(RedLinkInfo *link) { AsyncRead *obj = &link->async_read; obj->opaque = link; obj->stream = link->stream; obj->now = (uint8_t *)&link->link_header; obj->end = (uint8_t *)((SpiceLinkHeader *)&link->link_header + 1); obj->done = reds_handle_read_header_done; ...
0
17,070
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 RunAllPending(content::WebContents* web_contents) { if (!content::ExecuteScript(web_contents, "1 == 1;")) return false; base::RunLoop().RunUntilIdle(); return true; } Commit Message: Extensions: Prevent content script injection in the New tab Page. r487664 disallowed content script injection in t...
0
16,671
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 ssl3_send_next_proto(SSL *s) { unsigned int len, padding_len; unsigned char *d; if (s->state == SSL3_ST_CW_NEXT_PROTO_A) { len = s->next_proto_negotiated_len; padding_len = 32 - ((len + 2) % 32); d = (unsigned char *)s->init_buf->data; d[4] = len; memcpy(d + 5, s->next_proto_negotiated, len);...
0
27,958
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 balloon_process(struct work_struct *work) { enum bp_state state = BP_DONE; long credit; do { mutex_lock(&balloon_mutex); credit = current_credit(); if (credit > 0) { if (balloon_is_inflated()) state = increase_reservation(credit); else state = reserve_additional_memory(); ...
1
1,704
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 sock *netlink_getsockbypid(struct sock *ssk, u32 pid) { struct sock *sock; struct netlink_sock *nlk; sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, pid); if (!sock) return ERR_PTR(-ECONNREFUSED); /* Don't bother queuing skb if kernel socket has no input function */ nlk = nlk_sk(soc...
0
28,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: int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, __be32 saddr, __be32 daddr, struct ip_options_rcu *opt) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = skb_rtable(skb); struct iphdr *iph; /* Build the IP header. */ skb_push(skb, sizeof(struct iphdr) + (opt ? opt->opt.optlen ...
0
14,249
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: INST_HANDLER (mulsu) { // MULSU Rd, Rr int d = (buf[0] >> 4 & 0x07) + 16; int r = (buf[0] & 0x07) + 16; ESIL_A ("r%d,", r); // unsigned Rr ESIL_A ("r%d,DUP,0x80,&,?{,0xffff00,|,},", d); // sign extension Rd ESIL_A ("*,"); // 0: (Rd*Rr) ESIL_A ("DUP,0xff,&,r0,=,"); // r0 = LO(0) ESIL_A ("8,0,RPICK...
0
6,322
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 __net_init int sysctl_route_net_init(struct net *net) { struct ctl_table *tbl; tbl = ipv4_route_flush_table; if (!net_eq(net, &init_net)) { tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); if (!tbl) goto err_dup; /* Don't export sysctls to unprivileged users */ if (net->user_...
0
26,969
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 HasAccessorsImpl(JSObject* holder, FixedArrayBase* backing_store) { FixedArray* parameter_map = FixedArray::cast(backing_store); FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1)); return ArgumentsAccessor::HasAccessorsImpl(holder, arguments); } Commit Message: Backport: Fi...
0
17,244
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 bdrv_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) { BlockDriver *drv = bs->drv; int ret; /* Backing file format doesn't make sense without a backing file */ if (backing_fmt && !backing_file) { return -EINVAL; } if (drv->bdrv...
0
4,554
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: SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid) { struct user_namespace *ns = current_user_ns(); const struct cred *old; struct cred *new; int retval; kgid_t krgid, kegid; krgid = make_kgid(ns, rgid); kegid = make_kgid(ns, egid); if ((rgid != (gid_t) -1) && !gid_valid(krgid)) return -EINVAL; if (...
0
25,356
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 pdf_run_Bstar(fz_context *ctx, pdf_processor *proc) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_show_path(ctx, pr, 0, 1, 1, 1); } Commit Message: CWE ID: CWE-416
0
25,119
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::SetSuggestedText(const string16& text) { window()->GetLocationBar()->SetSuggestedText(text); } Commit Message: Rename the TabContentWrapper pieces to be "TabHelper"s. (Except for the PasswordManager... for now.) Also, just pre-create them up-front. It saves us effort, as they're all going to be e...
0
24,426
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 ProcessSGListHandler( IN PDEVICE_OBJECT pDO, IN PVOID Reserved, IN PSCATTER_GATHER_LIST pSGL, IN PVOID Context ) { UNREFERENCED_PARAMETER(Reserved); UNREFERENCED_PARAMETER(pDO); auto NBHolder = static_cast<CNB*>(Context); NBHolder->MappingDone(pSGL); } Commit Message...
0
15,510
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: ProcXF86DRICreateContext(register ClientPtr client) { xXF86DRICreateContextReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; ScreenPtr pScreen; REQUEST(xXF86DRICreateContextReq); REQUEST_SIZE_MATCH(xXF86DRICreateContextReq); if (stuf...
0
10,639
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: sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t len) { SF_PRIVATE *psf ; sf_count_t count, extra ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (len % psf->sf.channels) { psf->error = SFE_BAD_READ_ALI...
0
1,821
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 InitFromDBCallback(GDataFileError expected_error, GDataFileError actual_error) { EXPECT_EQ(expected_error, actual_error); } Commit Message: Remove parent* arg from GDataEntry ctor. * Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromD...
0
24,524
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 sock_warn_obsolete_bsdism(const char *name) { static int warned; static char warncomm[TASK_COMM_LEN]; if (strcmp(warncomm, current->comm) && warned < 5) { strcpy(warncomm, current->comm); pr_warn("process `%s' is using obsolete %s SO_BSDCOMPAT\n", warncomm, name); warned++; } } Commit M...
0
12,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: virDomainIsActive(virDomainPtr dom) { VIR_DEBUG("dom=%p", dom); virResetLastError(); virCheckDomainReturn(dom, -1); if (dom->conn->driver->domainIsActive) { int ret; ret = dom->conn->driver->domainIsActive(dom); if (ret < 0) goto error; return ret; ...
0
17,026
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 __exit snd_card_info_done(void) { snd_info_free_entry(snd_card_info_entry); #ifdef MODULE snd_info_free_entry(snd_card_module_info_entry); #endif return 0; } Commit Message: ALSA: control: Protect user controls against concurrent access The user-control put and get handlers as well as the tlv do not prot...
0
5,804
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 RenderViewImpl::UpdateBrowserControlsState( BrowserControlsState constraints, BrowserControlsState current, bool animate) { if (GetWebWidget()) { GetWebWidget()->UpdateBrowserControlsState(ContentToCc(constraints), ContentToCc(current), animate...
0
14,735
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 TabStripModel::ForgetAllOpeners() { TabContentsDataVector::const_iterator iter = contents_data_.begin(); for (; iter != contents_data_.end(); ++iter) (*iter)->ForgetOpener(); } Commit Message: chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP when closing window with > 1 tab....
0
3,859
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 ring_buffer_print_page_header(struct trace_seq *s) { struct buffer_data_page field; trace_seq_printf(s, "\tfield: u64 timestamp;\t" "offset:0;\tsize:%u;\tsigned:%u;\n", (unsigned int)sizeof(field.time_stamp), (unsigned int)is_signed_type(u64)); trace_seq_printf(s, "\tfield: local_t commit;\t"...
0
23,774
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 LocalDOMWindow::webkitRequestAnimationFrame( V8FrameRequestCallback* callback) { FrameRequestCallbackCollection::V8FrameCallback* frame_callback = FrameRequestCallbackCollection::V8FrameCallback::Create(callback); frame_callback->SetUseLegacyTimeBase(true); if (Document* document = this->docum...
0
11,676
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: SyncBackendHost::SyncBackendHost(Profile* profile) : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), sync_thread_("Chrome_SyncThread"), frontend_loop_(MessageLoop::current()), profile_(profile), name_("Unknown"), initialization_state_(NOT_ATTEMPTED), chrome_sync_no...
0
4,719