instruction
stringclasses
1 value
input
stringlengths
56
235k
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int xfer_addusermbox(const mbentry_t *mbentry, void *rock) { struct xfer_header *xfer = (struct xfer_header *)rock; /* Skip remote mailbox */ if (mbentry->mbtype & MBTYPE_REMOTE) return 0; struct xfer_item *item = xzmalloc(sizeof(struct xfer_item)); int r = mboxlist_lookup(mbentry->name, &item->mbentry, 0); if (r) return r; char *extname = mboxname_to_external(item->mbentry->name, &imapd_namespace, imapd_userid); strncpy(item->extname, extname, sizeof(item->extname)); free(extname); item->mailbox = NULL; item->state = 0; /* and link on to the list (reverse order) */ item->next = xfer->items; xfer->items = item; return 0; } Commit Message: imapd: check for isadmin BEFORE parsing sync lines CWE ID: CWE-20
0
95,271
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'. Remember, I want response in '1' or '0', No explanation.
Code: sockaddr_setport(struct sockaddr *sa, ev_uint16_t port) { if (sa->sa_family == AF_INET) { ((struct sockaddr_in *)sa)->sin_port = htons(port); } else if (sa->sa_family == AF_INET6) { ((struct sockaddr_in6 *)sa)->sin6_port = htons(port); } } Commit Message: evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the _Tor bug bounty program_. Please credit Guido accordingly. ## Bug report The DNS code of Libevent contains this rather obvious OOB read: ```c static char * search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; ``` If the length of ```base_name``` is 0, then line 3125 reads 1 byte before the buffer. This will trigger a crash on ASAN-protected builds. To reproduce: Build libevent with ASAN: ``` $ CFLAGS='-fomit-frame-pointer -fsanitize=address' ./configure && make -j4 ``` Put the attached ```resolv.conf``` and ```poc.c``` in the source directory and then do: ``` $ gcc -fsanitize=address -fomit-frame-pointer poc.c .libs/libevent.a $ ./a.out ================================================================= ==22201== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060000efdf at pc 0x4429da bp 0x7ffe1ed47300 sp 0x7ffe1ed472f8 READ of size 1 at 0x60060000efdf thread T0 ``` P.S. we can add a check earlier, but since this is very uncommon, I didn't add it. Fixes: #332 CWE ID: CWE-125
0
70,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'. Remember, I want response in '1' or '0', No explanation.
Code: int cert_id() { return cert_id_; } Commit Message: Fix UAF in Origin Info Bubble and permission settings UI. In addition to fixing the UAF, will this also fix the problem of the bubble showing over the previous tab (if the bubble is open when the tab it was opened for closes). BUG=490492 TBR=tedchoc Review URL: https://codereview.chromium.org/1317443002 Cr-Commit-Position: refs/heads/master@{#346023} CWE ID:
0
125,260
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'. Remember, I want response in '1' or '0', No explanation.
Code: void LayerTreeHostImpl::FrameData::AsValueInto( base::trace_event::TracedValue* value) const { value->SetBoolean("has_no_damage", has_no_damage); bool quads_enabled; TRACE_EVENT_CATEGORY_GROUP_ENABLED( TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), &quads_enabled); if (quads_enabled) { value->BeginArray("render_passes"); for (size_t i = 0; i < render_passes.size(); ++i) { value->BeginDictionary(); render_passes[i]->AsValueInto(value); value->EndDictionary(); } value->EndArray(); } } Commit Message: (Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954} CWE ID: CWE-362
0
137,216
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'. Remember, I want response in '1' or '0', No explanation.
Code: set_taglength_tlv(u8 *buffer, unsigned int tag, size_t length) { u8 *p = buffer; assert(tag <= 0xffff); if (tag > 0xff) *p++ = (tag >> 8) & 0xFF; *p++ = tag; if (length < 128) *p++ = (u8)length; else if (length < 256) { *p++ = 0x81; *p++ = (u8)length; } else { if (length > 0xffff) length = 0xffff; *p++ = 0x82; *p++ = (length >> 8) & 0xFF; *p++ = length & 0xFF; } return p - buffer; } Commit Message: fixed out of bounds reads Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting and suggesting security fixes. CWE ID: CWE-125
0
78,619
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'. Remember, I want response in '1' or '0', No explanation.
Code: initializeEncoding(XML_Parser parser) { const char *s; #ifdef XML_UNICODE char encodingBuf[128]; /* See comments abount `protoclEncodingName` in parserInit() */ if (! parser->m_protocolEncodingName) s = NULL; else { int i; for (i = 0; parser->m_protocolEncodingName[i]; i++) { if (i == sizeof(encodingBuf) - 1 || (parser->m_protocolEncodingName[i] & ~0x7f) != 0) { encodingBuf[0] = '\0'; break; } encodingBuf[i] = (char)parser->m_protocolEncodingName[i]; } encodingBuf[i] = '\0'; s = encodingBuf; } #else s = parser->m_protocolEncodingName; #endif if ((parser->m_ns ? XmlInitEncodingNS : XmlInitEncoding)( &parser->m_initEncoding, &parser->m_encoding, s)) return XML_ERROR_NONE; return handleUnknownEncoding(parser, parser->m_protocolEncodingName); } Commit Message: xmlparse.c: Deny internal entities closing the doctype CWE ID: CWE-611
0
88,282
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'. Remember, I want response in '1' or '0', No explanation.
Code: LocalFrame::GetRemoteNavigationAssociatedInterfaces() { DCHECK(Client()); return Client()->GetRemoteNavigationAssociatedInterfaces(); } Commit Message: Prevent sandboxed documents from reusing the default window Bug: 377995 Change-Id: Iff66c6d214dfd0cb7ea9c80f83afeedfff703541 Reviewed-on: https://chromium-review.googlesource.com/983558 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/master@{#567663} CWE ID: CWE-285
0
154,848
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'. Remember, I want response in '1' or '0', No explanation.
Code: PreresolveInfo::PreresolveInfo(const GURL& url, size_t count) : url(url), queued_count(count), inflight_count(0), was_canceled(false), stats(std::make_unique<PreconnectStats>(url)) {} Commit Message: Origins should be represented as url::Origin (not as GURL). As pointed out in //docs/security/origin-vs-url.md, origins should be represented as url::Origin (not as GURL). This CL applies this guideline to predictor-related code and changes the type of the following fields from GURL to url::Origin: - OriginRequestSummary::origin - PreconnectedRequestStats::origin - PreconnectRequest::origin The old code did not depend on any non-origin parts of GURL (like path and/or query). Therefore, this CL has no intended behavior change. Bug: 973885 Change-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: Alex Ilin <[email protected]> Cr-Commit-Position: refs/heads/master@{#716311} CWE ID: CWE-125
0
136,925
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int tea_setkey(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct tea_ctx *ctx = crypto_tfm_ctx(tfm); const __le32 *key = (const __le32 *)in_key; ctx->KEY[0] = le32_to_cpu(key[0]); ctx->KEY[1] = le32_to_cpu(key[1]); ctx->KEY[2] = le32_to_cpu(key[2]); ctx->KEY[3] = le32_to_cpu(key[3]); return 0; } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]> CWE ID: CWE-264
0
47,382
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'. Remember, I want response in '1' or '0', No explanation.
Code: partition_create_data_unref (CreatePartitionData *data) { data->refcount--; if (data->refcount == 0) { g_object_unref (data->device); g_free (data->fstype); g_strfreev (data->fsoptions); g_free (data); } } Commit Message: CWE ID: CWE-200
0
11,789
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb) { struct pppox_sock *po = pppox_sk(sk); struct pppox_sock *relay_po; /* Backlog receive. Semantics of backlog rcv preclude any code from * executing in lock_sock()/release_sock() bounds; meaning sk->sk_state * can't change. */ if (sk->sk_state & PPPOX_BOUND) { ppp_input(&po->chan, skb); } else if (sk->sk_state & PPPOX_RELAY) { relay_po = get_item_by_addr(sock_net(sk), &po->pppoe_relay); if (relay_po == NULL) goto abort_kfree; if ((sk_pppox(relay_po)->sk_state & PPPOX_CONNECTED) == 0) goto abort_put; if (!__pppoe_xmit(sk_pppox(relay_po), skb)) goto abort_put; } else { if (sock_queue_rcv_skb(sk, skb)) goto abort_kfree; } return NET_RX_SUCCESS; abort_put: sock_put(sk_pppox(relay_po)); abort_kfree: kfree_skb(skb); return NET_RX_DROP; } Commit Message: net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]> CWE ID: CWE-20
0
40,290
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'. Remember, I want response in '1' or '0', No explanation.
Code: void WebGL2RenderingContextBase::texSubImage3D( ExecutionContext* execution_context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exception_state) { if (isContextLost()) return; if (bound_pixel_unpack_buffer_) { SynthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "a buffer is bound to PIXEL_UNPACK_BUFFER"); return; } TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexSubImage3D, target, level, 0, format, type, xoffset, yoffset, zoffset, video, GetTextureSourceSubRectangle(width, height), depth, unpack_image_height_, exception_state); } Commit Message: Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518} CWE ID: CWE-119
0
133,488
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'. Remember, I want response in '1' or '0', No explanation.
Code: GF_Err set_file_udta(GF_ISOFile *dest, u32 tracknum, u32 udta_type, char *src, Bool is_box_array) { char *data = NULL; GF_Err res = GF_OK; u32 size; bin128 uuid; memset(uuid, 0 , 16); if (!udta_type && !is_box_array) return GF_BAD_PARAM; if (!src) { return gf_isom_remove_user_data(dest, tracknum, udta_type, uuid); } #ifndef GPAC_DISABLE_CORE_TOOLS if (!strnicmp(src, "base64", 6)) { src += 7; size = (u32) strlen(src); data = gf_malloc(sizeof(char) * size); size = gf_base64_decode(src, size, data, size); } else #endif { FILE *t = gf_fopen(src, "rb"); if (!t) return GF_IO_ERR; fseek(t, 0, SEEK_END); size = ftell(t); fseek(t, 0, SEEK_SET); data = gf_malloc(sizeof(char)*size); if (size != fread(data, 1, size, t) ) { gf_free(data); gf_fclose(t); return GF_IO_ERR; } gf_fclose(t); } if (size && data) { if (is_box_array) { res = gf_isom_add_user_data_boxes(dest, tracknum, data, size); } else { res = gf_isom_add_user_data(dest, tracknum, udta_type, uuid, data, size); } gf_free(data); } return res; } Commit Message: fix some overflows due to strcpy fixes #1184, #1186, #1187 among other things CWE ID: CWE-119
0
92,848
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'. Remember, I want response in '1' or '0', No explanation.
Code: quit_code(thread_t * thread, __attribute__((unused)) int status) { smtp_t *smtp = THREAD_ARG(thread); /* final state, we are disconnected from the remote host */ free_smtp_all(smtp); thread_close_fd(thread); return 0; } Commit Message: When opening files for write, ensure they aren't symbolic links Issue #1048 identified that if, for example, a non privileged user created a symbolic link from /etc/keepalvied.data to /etc/passwd, writing to /etc/keepalived.data (which could be invoked via DBus) would cause /etc/passwd to be overwritten. This commit stops keepalived writing to pathnames where the ultimate component is a symbolic link, by setting O_NOFOLLOW whenever opening a file for writing. This might break some setups, where, for example, /etc/keepalived.data was a symbolic link to /home/fred/keepalived.data. If this was the case, instead create a symbolic link from /home/fred/keepalived.data to /tmp/keepalived.data, so that the file is still accessible via /home/fred/keepalived.data. There doesn't appear to be a way around this backward incompatibility, since even checking if the pathname is a symbolic link prior to opening for writing would create a race condition. Signed-off-by: Quentin Armitage <[email protected]> CWE ID: CWE-59
0
75,938
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'. Remember, I want response in '1' or '0', No explanation.
Code: void NormalPageArena::clearFreeLists() { setAllocationPoint(nullptr, 0); m_freeList.clear(); } Commit Message: Call HeapObjectHeader::checkHeader solely for its side-effect. This requires changing its signature. This is a preliminary stage to making it private. BUG=633030 Review-Url: https://codereview.chromium.org/2698673003 Cr-Commit-Position: refs/heads/master@{#460489} CWE ID: CWE-119
0
147,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'. Remember, I want response in '1' or '0', No explanation.
Code: ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); LazyInitialize(); return base::Bind(&ProfileIOData::GetChromeURLDataManagerBackend, base::Unretained(io_data_)); } Commit Message: Give the media context an ftp job factory; prevent a browser crash. BUG=112983 TEST=none Review URL: http://codereview.chromium.org/9372002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121378 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
108,205
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'. Remember, I want response in '1' or '0', No explanation.
Code: static off_t flush_command(char* buf, size_t bufsz, uint8_t cmd, uint32_t exptime, bool use_extra) { protocol_binary_request_flush *request = (void*)buf; assert(bufsz > sizeof(*request)); memset(request, 0, sizeof(*request)); request->message.header.request.magic = PROTOCOL_BINARY_REQ; request->message.header.request.opcode = cmd; off_t size = sizeof(protocol_binary_request_no_extras); if (use_extra) { request->message.header.request.extlen = 4; request->message.body.expiration = htonl(exptime); request->message.header.request.bodylen = htonl(4); size += 4; } request->message.header.request.opaque = 0xdeadbeef; return size; } Commit Message: Issue 102: Piping null to the server will crash it CWE ID: CWE-20
0
94,230
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'. Remember, I want response in '1' or '0', No explanation.
Code: do_local_cmd(arglist *a) { u_int i; int status; pid_t pid; if (a->num == 0) fatal("do_local_cmd: no arguments"); if (verbose_mode) { fprintf(stderr, "Executing:"); for (i = 0; i < a->num; i++) fmprintf(stderr, " %s", a->list[i]); fprintf(stderr, "\n"); } if ((pid = fork()) == -1) fatal("do_local_cmd: fork: %s", strerror(errno)); if (pid == 0) { execvp(a->list[0], a->list); perror(a->list[0]); exit(1); } do_cmd_pid = pid; signal(SIGTERM, killchild); signal(SIGINT, killchild); signal(SIGHUP, killchild); while (waitpid(pid, &status, 0) == -1) if (errno != EINTR) fatal("do_local_cmd: waitpid: %s", strerror(errno)); do_cmd_pid = -1; if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return (-1); return (0); } Commit Message: upstream: disallow empty incoming filename or ones that refer to the current directory; based on report/patch from Harry Sintonen OpenBSD-Commit-ID: f27651b30eaee2df49540ab68d030865c04f6de9 CWE ID: CWE-706
0
92,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'. Remember, I want response in '1' or '0', No explanation.
Code: XvQueryExtension( Display *dpy, unsigned int *p_version, unsigned int *p_revision, unsigned int *p_requestBase, unsigned int *p_eventBase, unsigned int *p_errorBase) { XExtDisplayInfo *info = xv_find_display(dpy); xvQueryExtensionReq *req; xvQueryExtensionReply rep; int status; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryExtension, req); if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { status = XvBadExtension; goto out; } *p_version = rep.version; *p_revision = rep.revision; *p_requestBase = info->codes->major_opcode; *p_eventBase = info->codes->first_event; *p_errorBase = info->codes->first_error; status = Success; out: UnlockDisplay(dpy); SyncHandle(); return status; } Commit Message: CWE ID: CWE-125
0
10,364
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'. Remember, I want response in '1' or '0', No explanation.
Code: json_categorize_type(Oid typoid, JsonTypeCategory *tcategory, Oid *outfuncoid) { bool typisvarlena; /* Look through any domain */ typoid = getBaseType(typoid); *outfuncoid = InvalidOid; /* * We need to get the output function for everything except date and * timestamp types, array and composite types, booleans, and non-builtin * types where there's a cast to json. */ switch (typoid) { case BOOLOID: *tcategory = JSONTYPE_BOOL; break; case INT2OID: case INT4OID: case INT8OID: case FLOAT4OID: case FLOAT8OID: case NUMERICOID: getTypeOutputInfo(typoid, outfuncoid, &typisvarlena); *tcategory = JSONTYPE_NUMERIC; break; case DATEOID: *tcategory = JSONTYPE_DATE; break; case TIMESTAMPOID: *tcategory = JSONTYPE_TIMESTAMP; break; case TIMESTAMPTZOID: *tcategory = JSONTYPE_TIMESTAMPTZ; break; case JSONOID: case JSONBOID: getTypeOutputInfo(typoid, outfuncoid, &typisvarlena); *tcategory = JSONTYPE_JSON; break; default: /* Check for arrays and composites */ if (OidIsValid(get_element_type(typoid))) *tcategory = JSONTYPE_ARRAY; else if (type_is_rowtype(typoid)) *tcategory = JSONTYPE_COMPOSITE; else { /* It's probably the general case ... */ *tcategory = JSONTYPE_OTHER; /* but let's look for a cast to json, if it's not built-in */ if (typoid >= FirstNormalObjectId) { Oid castfunc; CoercionPathType ctype; ctype = find_coercion_pathway(JSONOID, typoid, COERCION_EXPLICIT, &castfunc); if (ctype == COERCION_PATH_FUNC && OidIsValid(castfunc)) { *tcategory = JSONTYPE_CAST; *outfuncoid = castfunc; } else { /* non builtin type with no cast */ getTypeOutputInfo(typoid, outfuncoid, &typisvarlena); } } else { /* any other builtin type */ getTypeOutputInfo(typoid, outfuncoid, &typisvarlena); } } break; } } Commit Message: CWE ID: CWE-119
0
2,530
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int digi_startup_device(struct usb_serial *serial) { int i, ret = 0; struct digi_serial *serial_priv = usb_get_serial_data(serial); struct usb_serial_port *port; /* be sure this happens exactly once */ spin_lock(&serial_priv->ds_serial_lock); if (serial_priv->ds_device_started) { spin_unlock(&serial_priv->ds_serial_lock); return 0; } serial_priv->ds_device_started = 1; spin_unlock(&serial_priv->ds_serial_lock); /* start reading from each bulk in endpoint for the device */ /* set USB_DISABLE_SPD flag for write bulk urbs */ for (i = 0; i < serial->type->num_ports + 1; i++) { port = serial->port[i]; ret = usb_submit_urb(port->read_urb, GFP_KERNEL); if (ret != 0) { dev_err(&port->dev, "%s: usb_submit_urb failed, ret=%d, port=%d\n", __func__, ret, i); break; } } return ret; } Commit Message: USB: digi_acceleport: do sanity checking for the number of ports The driver can be crashed with devices that expose crafted descriptors with too few endpoints. See: http://seclists.org/bugtraq/2016/Mar/61 Signed-off-by: Oliver Neukum <[email protected]> [johan: fix OOB endpoint check and add error messages ] Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> CWE ID:
0
54,171
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'. Remember, I want response in '1' or '0', No explanation.
Code: void HTMLMediaElement::requestRemotePlayback() { if (webMediaPlayer()) webMediaPlayer()->requestRemotePlayback(); } 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,884
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'. Remember, I want response in '1' or '0', No explanation.
Code: int mailimf_address_parse(const char * message, size_t length, size_t * indx, struct mailimf_address ** result) { int type; size_t cur_token; struct mailimf_mailbox * mailbox; struct mailimf_group * group; struct mailimf_address * address; int r; int res; cur_token = * indx; mailbox = NULL; group = NULL; type = MAILIMF_ADDRESS_ERROR; /* XXX - removes a gcc warning */ r = mailimf_group_parse(message, length, &cur_token, &group); if (r == MAILIMF_NO_ERROR) type = MAILIMF_ADDRESS_GROUP; if (r == MAILIMF_ERROR_PARSE) { r = mailimf_mailbox_parse(message, length, &cur_token, &mailbox); if (r == MAILIMF_NO_ERROR) type = MAILIMF_ADDRESS_MAILBOX; } if (r != MAILIMF_NO_ERROR) { res = r; goto err; } address = mailimf_address_new(type, mailbox, group); if (address == NULL) { res = MAILIMF_ERROR_MEMORY; goto free; } * result = address; * indx = cur_token; return MAILIMF_NO_ERROR; free: if (mailbox != NULL) mailimf_mailbox_free(mailbox); if (group != NULL) mailimf_group_free(group); err: return res; } Commit Message: Fixed crash #274 CWE ID: CWE-476
0
66,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'. Remember, I want response in '1' or '0', No explanation.
Code: void SpeechRecognitionManagerImpl::ExecuteTransitionAndGetNextState( Session* session, FSMState session_state, FSMEvent event) { switch (session_state) { case SESSION_STATE_IDLE: switch (event) { case EVENT_START: return SessionStart(*session); case EVENT_ABORT: return SessionAbort(*session); case EVENT_RECOGNITION_ENDED: return SessionDelete(session); case EVENT_STOP_CAPTURE: return SessionStopAudioCapture(*session); case EVENT_AUDIO_ENDED: return; } break; case SESSION_STATE_CAPTURING_AUDIO: switch (event) { case EVENT_STOP_CAPTURE: return SessionStopAudioCapture(*session); case EVENT_ABORT: return SessionAbort(*session); case EVENT_START: return; case EVENT_AUDIO_ENDED: case EVENT_RECOGNITION_ENDED: return NotFeasible(*session, event); } break; case SESSION_STATE_WAITING_FOR_RESULT: switch (event) { case EVENT_ABORT: return SessionAbort(*session); case EVENT_AUDIO_ENDED: return ResetCapturingSessionId(*session); case EVENT_START: case EVENT_STOP_CAPTURE: return; case EVENT_RECOGNITION_ENDED: return NotFeasible(*session, event); } break; } return NotFeasible(*session, event); } Commit Message: Make MediaStreamDispatcherHost per-request instead of per-frame. Instead of having RenderFrameHost own a single MSDH to handle all requests from a frame, MSDH objects will be owned by a strong binding. A consequence of this is that an additional requester ID is added to requests to MediaStreamManager, so that an MSDH is able to cancel only requests generated by it. In practice, MSDH will continue to be per frame in most cases since each frame normally makes a single request for an MSDH object. This fixes a lifetime issue caused by the IO thread executing tasks after the RenderFrameHost dies. Drive-by: Fix some minor lint issues. Bug: 912520 Change-Id: I52742ffc98b9fc57ce8e6f5093a61aed86d3e516 Reviewed-on: https://chromium-review.googlesource.com/c/1369799 Reviewed-by: Emircan Uysaler <[email protected]> Reviewed-by: Ken Buchanan <[email protected]> Reviewed-by: Olga Sharonova <[email protected]> Commit-Queue: Guido Urdaneta <[email protected]> Cr-Commit-Position: refs/heads/master@{#616347} CWE ID: CWE-189
0
153,291
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'. Remember, I want response in '1' or '0', No explanation.
Code: int AutoFillQueryXmlParser::GetIntValue(buzz::XmlParseContext* context, const char* attribute) { char* attr_end = NULL; int value = strtol(attribute, &attr_end, 10); if (attr_end != NULL && attr_end == attribute) { context->RaiseError(XML_ERROR_SYNTAX); return 0; } return value; } Commit Message: Add support for autofill server experiments BUG=none TEST=unit_tests --gtest_filter=AutoFillMetricsTest.QualityMetricsWithExperimentId:AutoFillQueryXmlParserTest.ParseExperimentId Review URL: http://codereview.chromium.org/6260027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73216 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
101,932
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'. Remember, I want response in '1' or '0', No explanation.
Code: SessionCommand* SessionService::CreateSetWindowBoundsCommand( const SessionID& window_id, const gfx::Rect& bounds, ui::WindowShowState show_state) { WindowBoundsPayload3 payload = { 0 }; payload.window_id = window_id.id(); payload.x = bounds.x(); payload.y = bounds.y(); payload.w = bounds.width(); payload.h = bounds.height(); payload.show_state = AdjustShowState(show_state); SessionCommand* command = new SessionCommand(kCommandSetWindowBounds3, sizeof(payload)); memcpy(command->contents(), &payload, sizeof(payload)); return command; } Commit Message: Metrics for measuring how much overhead reading compressed content states adds. BUG=104293 TEST=NONE Review URL: https://chromiumcodereview.appspot.com/9426039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123733 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
108,807
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'. Remember, I want response in '1' or '0', No explanation.
Code: static void virtio_queue_guest_notifier_read(EventNotifier *n) { VirtQueue *vq = container_of(n, VirtQueue, guest_notifier); if (event_notifier_test_and_clear(n)) { virtio_irq(vq); } } Commit Message: CWE ID: CWE-20
0
9,225
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'. Remember, I want response in '1' or '0', No explanation.
Code: arcStrokeCircularString(wkbObj *w, double segment_angle, lineObj *line) { pointObj p1, p2, p3; int npoints, nedges; int edge = 0; pointArrayObj *pa; if ( ! w || ! line ) return MS_FAILURE; npoints = wkbReadInt(w); nedges = npoints / 2; /* All CircularStrings have an odd number of points */ if ( npoints < 3 || npoints % 2 != 1 ) return MS_FAILURE; /* Make a large guess at how much space we'll need */ pa = pointArrayNew(nedges * 180 / segment_angle); wkbReadPointP(w,&p3); /* Fill out the point array with stroked arcs */ while( edge < nedges ) { p1 = p3; wkbReadPointP(w,&p2); wkbReadPointP(w,&p3); if ( arcStrokeCircle(&p1, &p2, &p3, segment_angle, edge ? 0 : 1, pa) == MS_FAILURE ) { pointArrayFree(pa); return MS_FAILURE; } edge++; } /* Copy the point array into the line */ line->numpoints = pa->npoints; line->point = msSmallMalloc(line->numpoints * sizeof(pointObj)); memcpy(line->point, pa->data, line->numpoints * sizeof(pointObj)); /* Clean up */ pointArrayFree(pa); return MS_SUCCESS; } Commit Message: Fix potential SQL Injection with postgis TIME filters (#4834) CWE ID: CWE-89
0
40,802
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'. Remember, I want response in '1' or '0', No explanation.
Code: void BrowserWindowGtk::LoadingAnimationCallback() { if (browser_->is_type_tabbed()) { tabstrip_->UpdateLoadingAnimations(); } else if (ShouldShowWindowIcon()) { WebContents* web_contents = chrome::GetActiveWebContents(browser_.get()); titlebar_->UpdateThrobber(web_contents); } } 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
117,973
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'. Remember, I want response in '1' or '0', No explanation.
Code: static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, struct svc_export *exp) { if (exp->ex_flags & NFSEXP_V4ROOT) { *p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time)); *p++ = 0; } else if (IS_I_VERSION(inode)) { p = xdr_encode_hyper(p, inode->i_version); } else { *p++ = cpu_to_be32(stat->ctime.tv_sec); *p++ = cpu_to_be32(stat->ctime.tv_nsec); } return p; } Commit Message: Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ... CWE ID: CWE-404
0
65,719
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'. Remember, I want response in '1' or '0', No explanation.
Code: ProcXFixesSetCursorName(ClientPtr client) { CursorPtr pCursor; char *tchar; REQUEST(xXFixesSetCursorNameReq); REQUEST(xXFixesSetCursorNameReq); Atom atom; REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess); tchar = (char *) &stuff[1]; atom = MakeAtom(tchar, stuff->nbytes, TRUE); return BadAlloc; pCursor->name = atom; return Success; } Commit Message: CWE ID: CWE-20
1
165,439
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'. Remember, I want response in '1' or '0', No explanation.
Code: static TEE_Result tee_svc_obj_generate_key_rsa( struct tee_obj *o, const struct tee_cryp_obj_type_props *type_props, uint32_t key_size, const TEE_Attribute *params, uint32_t param_count) { TEE_Result res; struct rsa_keypair *key = o->attr; uint32_t e = TEE_U32_TO_BIG_ENDIAN(65537); /* Copy the present attributes into the obj before starting */ res = tee_svc_cryp_obj_populate_type(o, type_props, params, param_count); if (res != TEE_SUCCESS) return res; if (!get_attribute(o, type_props, TEE_ATTR_RSA_PUBLIC_EXPONENT)) crypto_bignum_bin2bn((const uint8_t *)&e, sizeof(e), key->e); res = crypto_acipher_gen_rsa_key(key, key_size); if (res != TEE_SUCCESS) return res; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; return TEE_SUCCESS; } Commit Message: svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]> CWE ID: CWE-119
0
86,898
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'. Remember, I want response in '1' or '0', No explanation.
Code: size_t ZSTD_estimateCStreamSize(int compressionLevel) { int level; size_t memBudget = 0; for (level=1; level<=compressionLevel; level++) { size_t const newMB = ZSTD_estimateCStreamSize_internal(level); if (newMB > memBudget) memBudget = newMB; } return memBudget; } Commit Message: fixed T36302429 CWE ID: CWE-362
0
90,061
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'. Remember, I want response in '1' or '0', No explanation.
Code: x86_reg x86_map_sib_base(int r) { return sib_base_map[r]; } Commit Message: x86: fast path checking for X86_insn_reg_intel() CWE ID: CWE-125
0
94,043
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'. Remember, I want response in '1' or '0', No explanation.
Code: void TopSitesImpl::OnNavigationCommitted(const GURL& url) { DCHECK(thread_checker_.CalledOnValidThread()); if (!loaded_) return; if (can_add_url_to_history_.Run(url)) ScheduleUpdateTimer(); } Commit Message: TopSites: Clear thumbnails from the cache when their URLs get removed We already cleared the thumbnails from persistent storage, but they remained in the in-memory cache, so they remained accessible (until the next Chrome restart) even after all browsing data was cleared. Bug: 758169 Change-Id: Id916d22358430a82e6d5043ac04fa463a32f824f Reviewed-on: https://chromium-review.googlesource.com/758640 Commit-Queue: Marc Treib <[email protected]> Reviewed-by: Sylvain Defresne <[email protected]> Cr-Commit-Position: refs/heads/master@{#514861} CWE ID: CWE-200
0
147,079
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'. Remember, I want response in '1' or '0', No explanation.
Code: static inline uint32_t lnc_mchash(const uint8_t *ether_addr) { #define LNC_POLYNOMIAL 0xEDB88320UL uint32_t crc = 0xFFFFFFFF; int idx, bit; uint8_t data; for (idx = 0; idx < 6; idx++) { for (data = *ether_addr++, bit = 0; bit < MULTICAST_FILTER_LEN; bit++) { crc = (crc >> 1) ^ (((crc ^ data) & 1) ? LNC_POLYNOMIAL : 0); data >>= 1; } } return crc; #undef LNC_POLYNOMIAL } Commit Message: CWE ID: CWE-119
0
14,509
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'. Remember, I want response in '1' or '0', No explanation.
Code: void HTMLFormElement::Disassociate(HTMLImageElement& e) { image_elements_are_dirty_ = true; image_elements_.clear(); RemoveFromPastNamesMap(e); } Commit Message: Move user activation check to RemoteFrame::Navigate's callers. Currently RemoteFrame::Navigate is the user of Frame::HasTransientUserActivation that passes a RemoteFrame*, and it seems wrong because the user activation (user gesture) needed by the navigation should belong to the LocalFrame that initiated the navigation. Follow-up CLs after this one will update UserActivation code in Frame to take a LocalFrame* instead of a Frame*, and get rid of redundant IPCs. Bug: 811414 Change-Id: I771c1694043edb54374a44213d16715d9c7da704 Reviewed-on: https://chromium-review.googlesource.com/914736 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/master@{#536728} CWE ID: CWE-190
0
152,215
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool BrowserView::ShouldShowWindowTitle() const { #if defined(OS_CHROMEOS) if (browser_->is_trusted_source()) { return false; } #endif // OS_CHROMEOS return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); } Commit Message: Mac: turn popups into new tabs while in fullscreen. It's platform convention to show popups as new tabs while in non-HTML5 fullscreen. (Popups cause tabs to lose HTML5 fullscreen.) This was implemented for Cocoa in a BrowserWindow override, but it makes sense to just stick it into Browser and remove a ton of override code put in just to support this. BUG=858929, 868416 TEST=as in bugs Change-Id: I43471f242813ec1159d9c690bab73dab3e610b7d Reviewed-on: https://chromium-review.googlesource.com/1153455 Reviewed-by: Sidney San Martín <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#578755} CWE ID: CWE-20
0
155,266
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'. Remember, I want response in '1' or '0', No explanation.
Code: float scroll_velocity_x() const { return scroll_velocity_x_; } Commit Message: Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274602 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
112,118
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'. Remember, I want response in '1' or '0', No explanation.
Code: void webkit_web_view_unmark_text_matches(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); return core(webView)->unmarkAllTextMatches(); } Commit Message: 2011-06-02 Joone Hur <[email protected]> Reviewed by Martin Robinson. [GTK] Only load dictionaries if spell check is enabled https://bugs.webkit.org/show_bug.cgi?id=32879 We don't need to call enchant if enable-spell-checking is false. * webkit/webkitwebview.cpp: (webkit_web_view_update_settings): Skip loading dictionaries when enable-spell-checking is false. (webkit_web_view_settings_notify): Ditto. git-svn-id: svn://svn.chromium.org/blink/trunk@87925 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-399
0
100,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'. Remember, I want response in '1' or '0', No explanation.
Code: static inline void __d_set_inode_and_type(struct dentry *dentry, struct inode *inode, unsigned type_flags) { unsigned flags; dentry->d_inode = inode; smp_wmb(); flags = READ_ONCE(dentry->d_flags); flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU); flags |= type_flags; WRITE_ONCE(dentry->d_flags, flags); } Commit Message: dcache: Handle escaped paths in prepend_path A rename can result in a dentry that by walking up d_parent will never reach it's mnt_root. For lack of a better term I call this an escaped path. prepend_path is called by four different functions __d_path, d_absolute_path, d_path, and getcwd. __d_path only wants to see paths are connected to the root it passes in. So __d_path needs prepend_path to return an error. d_absolute_path similarly wants to see paths that are connected to some root. Escaped paths are not connected to any mnt_root so d_absolute_path needs prepend_path to return an error greater than 1. So escaped paths will be treated like paths on lazily unmounted mounts. getcwd needs to prepend "(unreachable)" so getcwd also needs prepend_path to return an error. d_path is the interesting hold out. d_path just wants to print something, and does not care about the weird cases. Which raises the question what should be printed? Given that <escaped_path>/<anything> should result in -ENOENT I believe it is desirable for escaped paths to be printed as empty paths. As there are not really any meaninful path components when considered from the perspective of a mount tree. So tweak prepend_path to return an empty path with an new error code of 3 when it encounters an escaped path. Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Al Viro <[email protected]> CWE ID: CWE-254
0
94,580
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int bin_pe_init_hdr(struct PE_(r_bin_pe_obj_t)* bin) { if (!(bin->dos_header = malloc (sizeof(PE_(image_dos_header))))) { r_sys_perror ("malloc (dos header)"); return false; } if (r_buf_read_at (bin->b, 0, (ut8*) bin->dos_header, sizeof(PE_(image_dos_header))) == -1) { bprintf ("Warning: read (dos header)\n"); return false; } sdb_num_set (bin->kv, "pe_dos_header.offset", 0, 0); sdb_set (bin->kv, "pe_dos_header.format", "[2]zwwwwwwwwwwwww[4]www[10]wx" " e_magic e_cblp e_cp e_crlc e_cparhdr e_minalloc e_maxalloc" " e_ss e_sp e_csum e_ip e_cs e_lfarlc e_ovno e_res e_oemid" " e_oeminfo e_res2 e_lfanew", 0); if (bin->dos_header->e_lfanew > (unsigned int) bin->size) { bprintf ("Invalid e_lfanew field\n"); return false; } if (!(bin->nt_headers = malloc (sizeof (PE_(image_nt_headers))))) { r_sys_perror ("malloc (nt header)"); return false; } bin->nt_header_offset = bin->dos_header->e_lfanew; if (r_buf_read_at (bin->b, bin->dos_header->e_lfanew, (ut8*) bin->nt_headers, sizeof (PE_(image_nt_headers))) < -1) { bprintf ("Warning: read (dos header)\n"); return false; } sdb_set (bin->kv, "pe_magic.cparse", "enum pe_magic { IMAGE_NT_OPTIONAL_HDR32_MAGIC=0x10b, IMAGE_NT_OPTIONAL_HDR64_MAGIC=0x20b, IMAGE_ROM_OPTIONAL_HDR_MAGIC=0x107 };", 0); sdb_set (bin->kv, "pe_subsystem.cparse", "enum pe_subsystem { IMAGE_SUBSYSTEM_UNKNOWN=0, IMAGE_SUBSYSTEM_NATIVE=1, IMAGE_SUBSYSTEM_WINDOWS_GUI=2, " " IMAGE_SUBSYSTEM_WINDOWS_CUI=3, IMAGE_SUBSYSTEM_OS2_CUI=5, IMAGE_SUBSYSTEM_POSIX_CUI=7, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI=9, " " IMAGE_SUBSYSTEM_EFI_APPLICATION=10, IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER=11, IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER=12, " " IMAGE_SUBSYSTEM_EFI_ROM=13, IMAGE_SUBSYSTEM_XBOX=14, IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION=16 };", 0); sdb_set (bin->kv, "pe_dllcharacteristics.cparse", "enum pe_dllcharacteristics { IMAGE_LIBRARY_PROCESS_INIT=0x0001, IMAGE_LIBRARY_PROCESS_TERM=0x0002, " " IMAGE_LIBRARY_THREAD_INIT=0x0004, IMAGE_LIBRARY_THREAD_TERM=0x0008, IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA=0x0020, " " IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE=0x0040, IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY=0x0080, " " IMAGE_DLLCHARACTERISTICS_NX_COMPAT=0x0100, IMAGE_DLLCHARACTERISTICS_NO_ISOLATION=0x0200,IMAGE_DLLCHARACTERISTICS_NO_SEH=0x0400, " " IMAGE_DLLCHARACTERISTICS_NO_BIND=0x0800, IMAGE_DLLCHARACTERISTICS_APPCONTAINER=0x1000, IMAGE_DLLCHARACTERISTICS_WDM_DRIVER=0x2000, " " IMAGE_DLLCHARACTERISTICS_GUARD_CF=0x4000, IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE=0x8000};", 0); #if R_BIN_PE64 sdb_num_set (bin->kv, "pe_nt_image_headers64.offset", bin->dos_header->e_lfanew, 0); sdb_set (bin->kv, "pe_nt_image_headers64.format", "[4]z?? signature (pe_image_file_header)fileHeader (pe_image_optional_header64)optionalHeader", 0); sdb_set (bin->kv, "pe_image_optional_header64.format", "[2]Ebbxxxxxqxxwwwwwwxxxx[2]E[2]Bqqqqxx[16]?" " (pe_magic)magic majorLinkerVersion minorLinkerVersion sizeOfCode sizeOfInitializedData" " sizeOfUninitializedData addressOfEntryPoint baseOfCode imageBase" " sectionAlignment fileAlignment majorOperatingSystemVersion minorOperatingSystemVersion" " majorImageVersion minorImageVersion majorSubsystemVersion minorSubsystemVersion" " win32VersionValue sizeOfImage sizeOfHeaders checkSum (pe_subsystem)subsystem (pe_dllcharacteristics)dllCharacteristics" " sizeOfStackReserve sizeOfStackCommit sizeOfHeapReserve sizeOfHeapCommit loaderFlags" " numberOfRvaAndSizes (pe_image_data_directory)dataDirectory", 0); #else sdb_num_set (bin->kv, "pe_nt_image_headers32.offset", bin->dos_header->e_lfanew, 0); sdb_set (bin->kv, "pe_nt_image_headers32.format", "[4]z?? signature (pe_image_file_header)fileHeader (pe_image_optional_header32)optionalHeader", 0); sdb_set (bin->kv, "pe_image_optional_header32.format", "[2]Ebbxxxxxxxxxwwwwwwxxxx[2]E[2]Bxxxxxx[16]?" " (pe_magic)magic majorLinkerVersion minorLinkerVersion sizeOfCode sizeOfInitializedData" " sizeOfUninitializedData addressOfEntryPoint baseOfCode baseOfData imageBase" " sectionAlignment fileAlignment majorOperatingSystemVersion minorOperatingSystemVersion" " majorImageVersion minorImageVersion majorSubsystemVersion minorSubsystemVersion" " win32VersionValue sizeOfImage sizeOfHeaders checkSum (pe_subsystem)subsystem (pe_dllcharacteristics)dllCharacteristics" " sizeOfStackReserve sizeOfStackCommit sizeOfHeapReserve sizeOfHeapCommit loaderFlags numberOfRvaAndSizes" " (pe_image_data_directory)dataDirectory", 0); #endif sdb_set (bin->kv, "pe_machine.cparse", "enum pe_machine { IMAGE_FILE_MACHINE_I386=0x014c, IMAGE_FILE_MACHINE_IA64=0x0200, IMAGE_FILE_MACHINE_AMD64=0x8664 };", 0); sdb_set (bin->kv, "pe_characteristics.cparse", "enum pe_characteristics { " " IMAGE_FILE_RELOCS_STRIPPED=0x0001, IMAGE_FILE_EXECUTABLE_IMAGE=0x0002, IMAGE_FILE_LINE_NUMS_STRIPPED=0x0004, " " IMAGE_FILE_LOCAL_SYMS_STRIPPED=0x0008, IMAGE_FILE_AGGRESIVE_WS_TRIM=0x0010, IMAGE_FILE_LARGE_ADDRESS_AWARE=0x0020, " " IMAGE_FILE_BYTES_REVERSED_LO=0x0080, IMAGE_FILE_32BIT_MACHINE=0x0100, IMAGE_FILE_DEBUG_STRIPPED=0x0200, " " IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP=0x0400, IMAGE_FILE_NET_RUN_FROM_SWAP=0x0800, IMAGE_FILE_SYSTEM=0x1000, " " IMAGE_FILE_DLL=0x2000, IMAGE_FILE_UP_SYSTEM_ONLY=0x4000, IMAGE_FILE_BYTES_REVERSED_HI=0x8000 };", 0); sdb_set (bin->kv, "pe_image_file_header.format", "[2]Ewtxxw[2]B" " (pe_machine)machine numberOfSections timeDateStamp pointerToSymbolTable" " numberOfSymbols sizeOfOptionalHeader (pe_characteristics)characteristics", 0); sdb_set (bin->kv, "pe_image_data_directory.format", "xx virtualAddress size",0); { sdb_num_set (bin->kv, "image_file_header.TimeDateStamp", bin->nt_headers->file_header.TimeDateStamp, 0); char *timestr = _time_stamp_to_str (bin->nt_headers->file_header.TimeDateStamp); sdb_set_owned (bin->kv, "image_file_header.TimeDateStamp_string", timestr, 0); } bin->optional_header = &bin->nt_headers->optional_header; bin->data_directory = (PE_(image_data_directory*)) & bin->optional_header->DataDirectory; if (strncmp ((char*) &bin->dos_header->e_magic, "MZ", 2) || (strncmp ((char*) &bin->nt_headers->Signature, "PE", 2) && /* Check also for Phar Lap TNT DOS extender PL executable */ strncmp ((char*) &bin->nt_headers->Signature, "PL", 2))) { return false; } return true; } Commit Message: Fix crash in pe CWE ID: CWE-125
0
82,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'. Remember, I want response in '1' or '0', No explanation.
Code: static void unix_release_sock(struct sock *sk, int embrion) { struct unix_sock *u = unix_sk(sk); struct path path; struct sock *skpair; struct sk_buff *skb; int state; unix_remove_socket(sk); /* Clear state */ unix_state_lock(sk); sock_orphan(sk); sk->sk_shutdown = SHUTDOWN_MASK; path = u->path; u->path.dentry = NULL; u->path.mnt = NULL; state = sk->sk_state; sk->sk_state = TCP_CLOSE; unix_state_unlock(sk); wake_up_interruptible_all(&u->peer_wait); skpair = unix_peer(sk); if (skpair != NULL) { if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { unix_state_lock(skpair); /* No more writes */ skpair->sk_shutdown = SHUTDOWN_MASK; if (!skb_queue_empty(&sk->sk_receive_queue) || embrion) skpair->sk_err = ECONNRESET; unix_state_unlock(skpair); skpair->sk_state_change(skpair); sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP); } unix_dgram_peer_wake_disconnect(sk, skpair); sock_put(skpair); /* It may now die */ unix_peer(sk) = NULL; } /* Try to flush out this socket. Throw out buffers at least */ while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { if (state == TCP_LISTEN) unix_release_sock(skb->sk, 1); /* passed fds are erased in the kfree_skb hook */ UNIXCB(skb).consumed = skb->len; kfree_skb(skb); } if (path.dentry) path_put(&path); sock_put(sk); /* ---- Socket is dead now and most probably destroyed ---- */ /* * Fixme: BSD difference: In BSD all sockets connected to us get * ECONNRESET and we die on the spot. In Linux we behave * like files and pipes do and wait for the last * dereference. * * Can't we simply set sock->err? * * What the above comment does talk about? --ANK(980817) */ if (unix_tot_inflight) unix_gc(); /* Garbage collect fds */ } Commit Message: unix: correctly track in-flight fds in sending process user_struct The commit referenced in the Fixes tag incorrectly accounted the number of in-flight fds over a unix domain socket to the original opener of the file-descriptor. This allows another process to arbitrary deplete the original file-openers resource limit for the maximum of open files. Instead the sending processes and its struct cred should be credited. To do so, we add a reference counted struct user_struct pointer to the scm_fp_list and use it to account for the number of inflight unix fds. Fixes: 712f4aad406bb1 ("unix: properly account for FDs passed over unix sockets") Reported-by: David Herrmann <[email protected]> Cc: David Herrmann <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: Linus Torvalds <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]> CWE ID: CWE-399
0
54,591
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool HTMLInputElement::matchesReadWritePseudoClass() const { return m_inputType->supportsReadOnly() && !isReadOnly(); } Commit Message: Setting input.x-webkit-speech should not cause focus change In r150866, we introduced element()->focus() in destroyShadowSubtree() to retain focus on <input> when its type attribute gets changed. But when x-webkit-speech attribute is changed, the element is detached before calling destroyShadowSubtree() and element()->focus() failed This patch moves detach() after destroyShadowSubtree() to fix the problem. BUG=243818 TEST=fast/forms/input-type-change-focusout.html NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16084005 git-svn-id: svn://svn.chromium.org/blink/trunk@151444 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-20
0
112,954
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'. Remember, I want response in '1' or '0', No explanation.
Code: virtual uint64_t approxBitrate() const { return 0; } Commit Message: Fix memory leak in OggExtractor Test: added a temporal log and run poc Bug: 63581671 Change-Id: I436a08e54d5e831f9fbdb33c26d15397ce1fbeba (cherry picked from commit 63079e7c8e12cda4eb124fbe565213d30b9ea34c) CWE ID: CWE-772
0
162,173
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'. Remember, I want response in '1' or '0', No explanation.
Code: gstate_to_update(fz_context *ctx, pdf_filter_processor *p) { filter_gstate *gstate = p->gstate; /* If we're not the top, that's fine */ if (gstate->next != NULL) return gstate; /* We are the top. Push a group, so we're not */ filter_push(ctx, p); gstate = p->gstate; gstate->pushed = 1; if (p->chain->op_q) p->chain->op_q(ctx, p->chain); return p->gstate; } Commit Message: CWE ID: CWE-125
0
1,826
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'. Remember, I want response in '1' or '0', No explanation.
Code: static void anyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectPythonV8Internal::anyAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); } Commit Message: document.location bindings fix BUG=352374 [email protected] Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-399
0
122,136
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'. Remember, I want response in '1' or '0', No explanation.
Code: void SVGElement::SvgAttributeBaseValChanged(const QualifiedName& attribute) { SvgAttributeChanged(attribute); if (!HasSVGRareData() || SvgRareData()->WebAnimatedAttributes().IsEmpty()) return; SvgRareData()->SetWebAnimatedAttributesDirty(true); GetElementData()->animated_svg_attributes_are_dirty_ = true; } Commit Message: Fix SVG crash for v0 distribution into foreignObject. We require a parent element to be an SVG element for non-svg-root elements in order to create a LayoutObject for them. However, we checked the light tree parent element, not the flat tree one which is the parent for the layout tree construction. Note that this is just an issue in Shadow DOM v0 since v1 does not allow shadow roots on SVG elements. Bug: 915469 Change-Id: Id81843abad08814fae747b5bc81c09666583f130 Reviewed-on: https://chromium-review.googlesource.com/c/1382494 Reviewed-by: Fredrik Söderquist <[email protected]> Commit-Queue: Rune Lillesveen <[email protected]> Cr-Commit-Position: refs/heads/master@{#617487} CWE ID: CWE-704
0
152,802
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'. Remember, I want response in '1' or '0', No explanation.
Code: int32_t GetCallbackId() { static int32_t sCallId = 0; return ++sCallId; } Commit Message: [Extensions] Expand bindings access checks BUG=601149 BUG=601073 Review URL: https://codereview.chromium.org/1866103002 Cr-Commit-Position: refs/heads/master@{#387710} CWE ID: CWE-284
0
132,589
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'. Remember, I want response in '1' or '0', No explanation.
Code: void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, unsigned long mask, struct vhost_dev *dev) { init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup); init_poll_funcptr(&poll->table, vhost_poll_func); poll->mask = mask; poll->dev = dev; poll->wqh = NULL; vhost_work_init(&poll->work, fn); } Commit Message: vhost: actually track log eventfd file While reviewing vhost log code, I found out that log_file is never set. Note: I haven't tested the change (QEMU doesn't use LOG_FD yet). Cc: [email protected] Signed-off-by: Marc-André Lureau <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> CWE ID: CWE-399
0
42,230
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int kvp_file_init(void) { int ret, fd; FILE *filep; size_t records_read; __u8 *fname; struct kvp_record *record; struct kvp_record *readp; int num_blocks; int i; int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; if (access("/var/opt/hyperv", F_OK)) { if (mkdir("/var/opt/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) { syslog(LOG_ERR, " Failed to create /var/opt/hyperv"); exit(-1); } } for (i = 0; i < KVP_POOL_COUNT; i++) { fname = kvp_file_info[i].fname; records_read = 0; num_blocks = 1; sprintf(fname, "/var/opt/hyperv/.kvp_pool_%d", i); fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH); if (fd == -1) return 1; filep = fopen(fname, "r"); if (!filep) return 1; record = malloc(alloc_unit * num_blocks); if (record == NULL) { fclose(filep); return 1; } while (!feof(filep)) { readp = &record[records_read]; records_read += fread(readp, sizeof(struct kvp_record), ENTRIES_PER_BLOCK, filep); if (!feof(filep)) { /* * We have more data to read. */ num_blocks++; record = realloc(record, alloc_unit * num_blocks); if (record == NULL) { fclose(filep); return 1; } continue; } break; } kvp_file_info[i].fd = fd; kvp_file_info[i].num_blocks = num_blocks; kvp_file_info[i].records = record; kvp_file_info[i].num_records = records_read; fclose(filep); } return 0; } Commit Message: Tools: hv: verify origin of netlink connector message The SuSE security team suggested to use recvfrom instead of recv to be certain that the connector message is originated from kernel. CVE-2012-2669 Signed-off-by: Olaf Hering <[email protected]> Signed-off-by: Marcus Meissner <[email protected]> Signed-off-by: Sebastian Krahmer <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> CWE ID: CWE-20
0
19,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'. Remember, I want response in '1' or '0', No explanation.
Code: void suhosin_hook_header_handler() { if (orig_header_handler == NULL) { orig_header_handler = sapi_module.header_handler; sapi_module.header_handler = suhosin_header_handler; } } Commit Message: Fixed stack based buffer overflow in transparent cookie encryption (see separate advisory) CWE ID: CWE-119
0
21,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'. Remember, I want response in '1' or '0', No explanation.
Code: xps_measure_font_glyph(xps_context_t *ctx, xps_font_t *font, int gid, xps_glyph_metrics_t *mtx) { int head, format, loca, glyf; int ofs, len; int idx, i, n; int hadv, vadv, vorg; int vtop, ymax, desc; int scale; /* some insane defaults */ scale = 1000; /* units-per-em */ hadv = 500; vadv = -1000; vorg = 1000; /* * Horizontal metrics are easy. */ ofs = xps_find_sfnt_table(font, "hhea", &len); if (ofs < 0 || len < 2 * 18) { gs_warn("hhea table is too short"); return; } vorg = s16(font->data + ofs + 4); /* ascender is default vorg */ desc = s16(font->data + ofs + 6); /* descender */ if (desc < 0) desc = -desc; n = u16(font->data + ofs + 17 * 2); ofs = xps_find_sfnt_table(font, "hmtx", &len); if (ofs < 0) { gs_warn("cannot find hmtx table"); return; } idx = gid; if (idx > n - 1) idx = n - 1; hadv = u16(font->data + ofs + idx * 4); vadv = 0; /* * Vertical metrics are hairy (with missing tables). */ head = xps_find_sfnt_table(font, "head", &len); if (head > 0) { scale = u16(font->data + head + 18); /* units per em */ } ofs = xps_find_sfnt_table(font, "OS/2", &len); if (ofs > 0 && len > 70) { vorg = s16(font->data + ofs + 68); /* sTypoAscender */ desc = s16(font->data + ofs + 70); /* sTypoDescender */ if (desc < 0) desc = -desc; } ofs = xps_find_sfnt_table(font, "vhea", &len); if (ofs > 0 && len >= 2 * 18) { n = u16(font->data + ofs + 17 * 2); ofs = xps_find_sfnt_table(font, "vmtx", &len); if (ofs < 0) { gs_warn("cannot find vmtx table"); return; } idx = gid; if (idx > n - 1) idx = n - 1; vadv = u16(font->data + ofs + idx * 4); vtop = u16(font->data + ofs + idx * 4 + 2); glyf = xps_find_sfnt_table(font, "glyf", &len); loca = xps_find_sfnt_table(font, "loca", &len); if (head > 0 && glyf > 0 && loca > 0) { format = u16(font->data + head + 50); /* indexToLocaFormat */ if (format == 0) ofs = u16(font->data + loca + gid * 2) * 2; else ofs = u32(font->data + loca + gid * 4); ymax = u16(font->data + glyf + ofs + 8); /* yMax */ vorg = ymax + vtop; } } ofs = xps_find_sfnt_table(font, "VORG", &len); if (ofs > 0) { vorg = u16(font->data + ofs + 6); n = u16(font->data + ofs + 6); for (i = 0; i < n; i++) { if (u16(font->data + ofs + 8 + 4 * i) == gid) { vorg = s16(font->data + ofs + 8 + 4 * i + 2); break; } } } if (vadv == 0) vadv = vorg + desc; mtx->hadv = hadv / (float) scale; mtx->vadv = vadv / (float) scale; mtx->vorg = vorg / (float) scale; } Commit Message: CWE ID: CWE-125
0
5,594
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool WindowsUpdateFunction::RunImpl() { int window_id = extension_misc::kUnknownWindowId; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); DictionaryValue* update_props; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); WindowController* controller; if (!GetWindowFromWindowID(this, window_id, &controller)) return false; #if defined(OS_WIN) if (win8::IsSingleWindowMetroMode()) { SetResult(controller->CreateWindowValue()); return true; } #endif ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. std::string state_str; if (update_props->HasKey(keys::kShowStateKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetString(keys::kShowStateKey, &state_str)); if (state_str == keys::kShowStateValueNormal) { show_state = ui::SHOW_STATE_NORMAL; } else if (state_str == keys::kShowStateValueMinimized) { show_state = ui::SHOW_STATE_MINIMIZED; } else if (state_str == keys::kShowStateValueMaximized) { show_state = ui::SHOW_STATE_MAXIMIZED; } else if (state_str == keys::kShowStateValueFullscreen) { show_state = ui::SHOW_STATE_FULLSCREEN; } else { error_ = keys::kInvalidWindowStateError; return false; } } if (show_state != ui::SHOW_STATE_FULLSCREEN && show_state != ui::SHOW_STATE_DEFAULT) controller->SetFullscreenMode(false, GetExtension()->url()); switch (show_state) { case ui::SHOW_STATE_MINIMIZED: controller->window()->Minimize(); break; case ui::SHOW_STATE_MAXIMIZED: controller->window()->Maximize(); break; case ui::SHOW_STATE_FULLSCREEN: if (controller->window()->IsMinimized() || controller->window()->IsMaximized()) controller->window()->Restore(); controller->SetFullscreenMode(true, GetExtension()->url()); break; case ui::SHOW_STATE_NORMAL: controller->window()->Restore(); break; default: break; } gfx::Rect bounds; if (controller->window()->IsMinimized()) bounds = controller->window()->GetRestoredBounds(); else bounds = controller->window()->GetBounds(); bool set_bounds = false; int bounds_val; if (update_props->HasKey(keys::kLeftKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kLeftKey, &bounds_val)); bounds.set_x(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kTopKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kTopKey, &bounds_val)); bounds.set_y(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kWidthKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kWidthKey, &bounds_val)); bounds.set_width(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kHeightKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kHeightKey, &bounds_val)); bounds.set_height(bounds_val); set_bounds = true; } if (set_bounds) { if (show_state == ui::SHOW_STATE_MINIMIZED || show_state == ui::SHOW_STATE_MAXIMIZED || show_state == ui::SHOW_STATE_FULLSCREEN) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->SetBounds(bounds); } bool active_val = false; if (update_props->HasKey(keys::kFocusedKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( keys::kFocusedKey, &active_val)); if (active_val) { if (show_state == ui::SHOW_STATE_MINIMIZED) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->Activate(); } else { if (show_state == ui::SHOW_STATE_MAXIMIZED || show_state == ui::SHOW_STATE_FULLSCREEN) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->Deactivate(); } } bool draw_attention = false; if (update_props->HasKey(keys::kDrawAttentionKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( keys::kDrawAttentionKey, &draw_attention)); controller->window()->FlashFrame(draw_attention); } SetResult(controller->CreateWindowValue()); return true; } Commit Message: Don't allow extensions to take screenshots of interstitial pages. Branched from https://codereview.chromium.org/14885004/ which is trying to test it. BUG=229504 Review URL: https://chromiumcodereview.appspot.com/14954004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198297 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
113,255
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'. Remember, I want response in '1' or '0', No explanation.
Code: size_t IGraphicBufferConsumer::BufferItem::getFdCount() const { size_t c = 0; if (mGraphicBuffer != 0) { c += mGraphicBuffer->getFdCount(); } if (mFence != 0) { c += mFence->getFdCount(); } return c; } Commit Message: IGraphicBufferConsumer: fix ATTACH_BUFFER info leak Bug: 26338113 Change-Id: I019c4df2c6adbc944122df96968ddd11a02ebe33 CWE ID: CWE-254
0
161,623
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int uio_fasync(int fd, struct file *filep, int on) { struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; return fasync_helper(fd, filep, on, &idev->async_queue); } Commit Message: Fix a few incorrectly checked [io_]remap_pfn_range() calls Nico Golde reports a few straggling uses of [io_]remap_pfn_range() that really should use the vm_iomap_memory() helper. This trivially converts two of them to the helper, and comments about why the third one really needs to continue to use remap_pfn_range(), and adds the missing size check. Reported-by: Nico Golde <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]. CWE ID: CWE-119
0
28,308
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int load_all_firmwares(struct dvb_frontend *fe, const struct firmware *fw) { struct xc2028_data *priv = fe->tuner_priv; const unsigned char *p, *endp; int rc = 0; int n, n_array; char name[33]; tuner_dbg("%s called\n", __func__); p = fw->data; endp = p + fw->size; if (fw->size < sizeof(name) - 1 + 2 + 2) { tuner_err("Error: firmware file %s has invalid size!\n", priv->fname); goto corrupt; } memcpy(name, p, sizeof(name) - 1); name[sizeof(name) - 1] = 0; p += sizeof(name) - 1; priv->firm_version = get_unaligned_le16(p); p += 2; n_array = get_unaligned_le16(p); p += 2; tuner_info("Loading %d firmware images from %s, type: %s, ver %d.%d\n", n_array, priv->fname, name, priv->firm_version >> 8, priv->firm_version & 0xff); priv->firm = kcalloc(n_array, sizeof(*priv->firm), GFP_KERNEL); if (priv->firm == NULL) { tuner_err("Not enough memory to load firmware file.\n"); rc = -ENOMEM; goto err; } priv->firm_size = n_array; n = -1; while (p < endp) { __u32 type, size; v4l2_std_id id; __u16 int_freq = 0; n++; if (n >= n_array) { tuner_err("More firmware images in file than " "were expected!\n"); goto corrupt; } /* Checks if there's enough bytes to read */ if (endp - p < sizeof(type) + sizeof(id) + sizeof(size)) goto header; type = get_unaligned_le32(p); p += sizeof(type); id = get_unaligned_le64(p); p += sizeof(id); if (type & HAS_IF) { int_freq = get_unaligned_le16(p); p += sizeof(int_freq); if (endp - p < sizeof(size)) goto header; } size = get_unaligned_le32(p); p += sizeof(size); if (!size || size > endp - p) { tuner_err("Firmware type "); dump_firm_type(type); printk("(%x), id %llx is corrupted " "(size=%d, expected %d)\n", type, (unsigned long long)id, (unsigned)(endp - p), size); goto corrupt; } priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); if (priv->firm[n].ptr == NULL) { tuner_err("Not enough memory to load firmware file.\n"); rc = -ENOMEM; goto err; } tuner_dbg("Reading firmware type "); if (debug) { dump_firm_type_and_int_freq(type, int_freq); printk("(%x), id %llx, size=%d.\n", type, (unsigned long long)id, size); } memcpy(priv->firm[n].ptr, p, size); priv->firm[n].type = type; priv->firm[n].id = id; priv->firm[n].size = size; priv->firm[n].int_freq = int_freq; p += size; } if (n + 1 != priv->firm_size) { tuner_err("Firmware file is incomplete!\n"); goto corrupt; } goto done; header: tuner_err("Firmware header is incomplete!\n"); corrupt: rc = -EINVAL; tuner_err("Error: firmware file is corrupted!\n"); err: tuner_info("Releasing partially loaded firmware file.\n"); free_firmware(priv); done: if (rc == 0) tuner_dbg("Firmware files loaded.\n"); else priv->state = XC2028_NODEV; return rc; } Commit Message: [media] xc2028: avoid use after free If struct xc2028_config is passed without a firmware name, the following trouble may happen: [11009.907205] xc2028 5-0061: type set to XCeive xc2028/xc3028 tuner [11009.907491] ================================================================== [11009.907750] BUG: KASAN: use-after-free in strcmp+0x96/0xb0 at addr ffff8803bd78ab40 [11009.907992] Read of size 1 by task modprobe/28992 [11009.907994] ============================================================================= [11009.907997] BUG kmalloc-16 (Tainted: G W ): kasan: bad access detected [11009.907999] ----------------------------------------------------------------------------- [11009.908008] INFO: Allocated in xhci_urb_enqueue+0x214/0x14c0 [xhci_hcd] age=0 cpu=3 pid=28992 [11009.908012] ___slab_alloc+0x581/0x5b0 [11009.908014] __slab_alloc+0x51/0x90 [11009.908017] __kmalloc+0x27b/0x350 [11009.908022] xhci_urb_enqueue+0x214/0x14c0 [xhci_hcd] [11009.908026] usb_hcd_submit_urb+0x1e8/0x1c60 [11009.908029] usb_submit_urb+0xb0e/0x1200 [11009.908032] usb_serial_generic_write_start+0xb6/0x4c0 [11009.908035] usb_serial_generic_write+0x92/0xc0 [11009.908039] usb_console_write+0x38a/0x560 [11009.908045] call_console_drivers.constprop.14+0x1ee/0x2c0 [11009.908051] console_unlock+0x40d/0x900 [11009.908056] vprintk_emit+0x4b4/0x830 [11009.908061] vprintk_default+0x1f/0x30 [11009.908064] printk+0x99/0xb5 [11009.908067] kasan_report_error+0x10a/0x550 [11009.908070] __asan_report_load1_noabort+0x43/0x50 [11009.908074] INFO: Freed in xc2028_set_config+0x90/0x630 [tuner_xc2028] age=1 cpu=3 pid=28992 [11009.908077] __slab_free+0x2ec/0x460 [11009.908080] kfree+0x266/0x280 [11009.908083] xc2028_set_config+0x90/0x630 [tuner_xc2028] [11009.908086] xc2028_attach+0x310/0x8a0 [tuner_xc2028] [11009.908090] em28xx_attach_xc3028.constprop.7+0x1f9/0x30d [em28xx_dvb] [11009.908094] em28xx_dvb_init.part.3+0x8e4/0x5cf4 [em28xx_dvb] [11009.908098] em28xx_dvb_init+0x81/0x8a [em28xx_dvb] [11009.908101] em28xx_register_extension+0xd9/0x190 [em28xx] [11009.908105] em28xx_dvb_register+0x10/0x1000 [em28xx_dvb] [11009.908108] do_one_initcall+0x141/0x300 [11009.908111] do_init_module+0x1d0/0x5ad [11009.908114] load_module+0x6666/0x9ba0 [11009.908117] SyS_finit_module+0x108/0x130 [11009.908120] entry_SYSCALL_64_fastpath+0x16/0x76 [11009.908123] INFO: Slab 0xffffea000ef5e280 objects=25 used=25 fp=0x (null) flags=0x2ffff8000004080 [11009.908126] INFO: Object 0xffff8803bd78ab40 @offset=2880 fp=0x0000000000000001 [11009.908130] Bytes b4 ffff8803bd78ab30: 01 00 00 00 2a 07 00 00 9d 28 00 00 01 00 00 00 ....*....(...... [11009.908133] Object ffff8803bd78ab40: 01 00 00 00 00 00 00 00 b0 1d c3 6a 00 88 ff ff ...........j.... [11009.908137] CPU: 3 PID: 28992 Comm: modprobe Tainted: G B W 4.5.0-rc1+ #43 [11009.908140] Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015 [11009.908142] ffff8803bd78a000 ffff8802c273f1b8 ffffffff81932007 ffff8803c6407a80 [11009.908148] ffff8802c273f1e8 ffffffff81556759 ffff8803c6407a80 ffffea000ef5e280 [11009.908153] ffff8803bd78ab40 dffffc0000000000 ffff8802c273f210 ffffffff8155ccb4 [11009.908158] Call Trace: [11009.908162] [<ffffffff81932007>] dump_stack+0x4b/0x64 [11009.908165] [<ffffffff81556759>] print_trailer+0xf9/0x150 [11009.908168] [<ffffffff8155ccb4>] object_err+0x34/0x40 [11009.908171] [<ffffffff8155f260>] kasan_report_error+0x230/0x550 [11009.908175] [<ffffffff81237d71>] ? trace_hardirqs_off_caller+0x21/0x290 [11009.908179] [<ffffffff8155e926>] ? kasan_unpoison_shadow+0x36/0x50 [11009.908182] [<ffffffff8155f5c3>] __asan_report_load1_noabort+0x43/0x50 [11009.908185] [<ffffffff8155ea00>] ? __asan_register_globals+0x50/0xa0 [11009.908189] [<ffffffff8194cea6>] ? strcmp+0x96/0xb0 [11009.908192] [<ffffffff8194cea6>] strcmp+0x96/0xb0 [11009.908196] [<ffffffffa13ba4ac>] xc2028_set_config+0x15c/0x630 [tuner_xc2028] [11009.908200] [<ffffffffa13bac90>] xc2028_attach+0x310/0x8a0 [tuner_xc2028] [11009.908203] [<ffffffff8155ea78>] ? memset+0x28/0x30 [11009.908206] [<ffffffffa13ba980>] ? xc2028_set_config+0x630/0x630 [tuner_xc2028] [11009.908211] [<ffffffffa157a59a>] em28xx_attach_xc3028.constprop.7+0x1f9/0x30d [em28xx_dvb] [11009.908215] [<ffffffffa157aa2a>] ? em28xx_dvb_init.part.3+0x37c/0x5cf4 [em28xx_dvb] [11009.908219] [<ffffffffa157a3a1>] ? hauppauge_hvr930c_init+0x487/0x487 [em28xx_dvb] [11009.908222] [<ffffffffa01795ac>] ? lgdt330x_attach+0x1cc/0x370 [lgdt330x] [11009.908226] [<ffffffffa01793e0>] ? i2c_read_demod_bytes.isra.2+0x210/0x210 [lgdt330x] [11009.908230] [<ffffffff812e87d0>] ? ref_module.part.15+0x10/0x10 [11009.908233] [<ffffffff812e56e0>] ? module_assert_mutex_or_preempt+0x80/0x80 [11009.908238] [<ffffffffa157af92>] em28xx_dvb_init.part.3+0x8e4/0x5cf4 [em28xx_dvb] [11009.908242] [<ffffffffa157a6ae>] ? em28xx_attach_xc3028.constprop.7+0x30d/0x30d [em28xx_dvb] [11009.908245] [<ffffffff8195222d>] ? string+0x14d/0x1f0 [11009.908249] [<ffffffff8195381f>] ? symbol_string+0xff/0x1a0 [11009.908253] [<ffffffff81953720>] ? uuid_string+0x6f0/0x6f0 [11009.908257] [<ffffffff811a775e>] ? __kernel_text_address+0x7e/0xa0 [11009.908260] [<ffffffff8104b02f>] ? print_context_stack+0x7f/0xf0 [11009.908264] [<ffffffff812e9846>] ? __module_address+0xb6/0x360 [11009.908268] [<ffffffff8137fdc9>] ? is_ftrace_trampoline+0x99/0xe0 [11009.908271] [<ffffffff811a775e>] ? __kernel_text_address+0x7e/0xa0 [11009.908275] [<ffffffff81240a70>] ? debug_check_no_locks_freed+0x290/0x290 [11009.908278] [<ffffffff8104a24b>] ? dump_trace+0x11b/0x300 [11009.908282] [<ffffffffa13e8143>] ? em28xx_register_extension+0x23/0x190 [em28xx] [11009.908285] [<ffffffff81237d71>] ? trace_hardirqs_off_caller+0x21/0x290 [11009.908289] [<ffffffff8123ff56>] ? trace_hardirqs_on_caller+0x16/0x590 [11009.908292] [<ffffffff812404dd>] ? trace_hardirqs_on+0xd/0x10 [11009.908296] [<ffffffffa13e8143>] ? em28xx_register_extension+0x23/0x190 [em28xx] [11009.908299] [<ffffffff822dcbb0>] ? mutex_trylock+0x400/0x400 [11009.908302] [<ffffffff810021a1>] ? do_one_initcall+0x131/0x300 [11009.908306] [<ffffffff81296dc7>] ? call_rcu_sched+0x17/0x20 [11009.908309] [<ffffffff8159e708>] ? put_object+0x48/0x70 [11009.908314] [<ffffffffa1579f11>] em28xx_dvb_init+0x81/0x8a [em28xx_dvb] [11009.908317] [<ffffffffa13e81f9>] em28xx_register_extension+0xd9/0x190 [em28xx] [11009.908320] [<ffffffffa0150000>] ? 0xffffffffa0150000 [11009.908324] [<ffffffffa0150010>] em28xx_dvb_register+0x10/0x1000 [em28xx_dvb] [11009.908327] [<ffffffff810021b1>] do_one_initcall+0x141/0x300 [11009.908330] [<ffffffff81002070>] ? try_to_run_init_process+0x40/0x40 [11009.908333] [<ffffffff8123ff56>] ? trace_hardirqs_on_caller+0x16/0x590 [11009.908337] [<ffffffff8155e926>] ? kasan_unpoison_shadow+0x36/0x50 [11009.908340] [<ffffffff8155e926>] ? kasan_unpoison_shadow+0x36/0x50 [11009.908343] [<ffffffff8155e926>] ? kasan_unpoison_shadow+0x36/0x50 [11009.908346] [<ffffffff8155ea37>] ? __asan_register_globals+0x87/0xa0 [11009.908350] [<ffffffff8144da7b>] do_init_module+0x1d0/0x5ad [11009.908353] [<ffffffff812f2626>] load_module+0x6666/0x9ba0 [11009.908356] [<ffffffff812e9c90>] ? symbol_put_addr+0x50/0x50 [11009.908361] [<ffffffffa1580037>] ? em28xx_dvb_init.part.3+0x5989/0x5cf4 [em28xx_dvb] [11009.908366] [<ffffffff812ebfc0>] ? module_frob_arch_sections+0x20/0x20 [11009.908369] [<ffffffff815bc940>] ? open_exec+0x50/0x50 [11009.908374] [<ffffffff811671bb>] ? ns_capable+0x5b/0xd0 [11009.908377] [<ffffffff812f5e58>] SyS_finit_module+0x108/0x130 [11009.908379] [<ffffffff812f5d50>] ? SyS_init_module+0x1f0/0x1f0 [11009.908383] [<ffffffff81004044>] ? lockdep_sys_exit_thunk+0x12/0x14 [11009.908394] [<ffffffff822e6936>] entry_SYSCALL_64_fastpath+0x16/0x76 [11009.908396] Memory state around the buggy address: [11009.908398] ffff8803bd78aa00: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc [11009.908401] ffff8803bd78aa80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [11009.908403] >ffff8803bd78ab00: fc fc fc fc fc fc fc fc 00 00 fc fc fc fc fc fc [11009.908405] ^ [11009.908407] ffff8803bd78ab80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [11009.908409] ffff8803bd78ac00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [11009.908411] ================================================================== In order to avoid it, let's set the cached value of the firmware name to NULL after freeing it. While here, return an error if the memory allocation fails. Signed-off-by: Mauro Carvalho Chehab <[email protected]> CWE ID: CWE-416
0
49,542
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'. Remember, I want response in '1' or '0', No explanation.
Code: explicit MountState(DriveFsHost* host) : host_(host), mojo_connection_delegate_( host_->delegate_->CreateMojoConnectionDelegate()), pending_token_(base::UnguessableToken::Create()), binding_(this) { source_path_ = base::StrCat({kMountScheme, pending_token_.ToString()}); std::string datadir_option = base::StrCat( {"datadir=", host_->profile_path_.Append(kDataPath) .Append(host_->delegate_->GetAccountId().GetAccountIdKey()) .value()}); chromeos::disks::DiskMountManager::GetInstance()->MountPath( source_path_, "", base::StrCat( {"drivefs-", host_->delegate_->GetAccountId().GetAccountIdKey()}), {datadir_option}, chromeos::MOUNT_TYPE_NETWORK_STORAGE, chromeos::MOUNT_ACCESS_MODE_READ_WRITE); auto bootstrap = mojo::MakeProxy(mojo_connection_delegate_->InitializeMojoConnection()); mojom::DriveFsDelegatePtr delegate; binding_.Bind(mojo::MakeRequest(&delegate)); bootstrap->Init( {base::in_place, host_->delegate_->GetAccountId().GetUserEmail()}, mojo::MakeRequest(&drivefs_), std::move(delegate)); PendingConnectionManager::Get().ExpectOpenIpcChannel( pending_token_, base::BindOnce(&DriveFsHost::MountState::AcceptMojoConnection, base::Unretained(this))); } Commit Message: Add a fake DriveFS launcher client. Using DriveFS requires building and deploying ChromeOS. Add a client for the fake DriveFS launcher to allow the use of a real DriveFS from a ChromeOS chroot to be used with a target_os="chromeos" build of chrome. This connects to the fake DriveFS launcher using mojo over a unix domain socket named by a command-line flag, using the launcher to create DriveFS instances. Bug: 848126 Change-Id: I22dcca154d41bda196dd7c1782bb503f6bcba5b1 Reviewed-on: https://chromium-review.googlesource.com/1098434 Reviewed-by: Xiyuan Xia <[email protected]> Commit-Queue: Sam McNally <[email protected]> Cr-Commit-Position: refs/heads/master@{#567513} CWE ID:
1
171,729
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'. Remember, I want response in '1' or '0', No explanation.
Code: static void veth_setup(struct net_device *dev) { ether_setup(dev); dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX; dev->destructor = veth_dev_free; } Commit Message: veth: Dont kfree_skb() after dev_forward_skb() In case of congestion, netif_rx() frees the skb, so we must assume dev_forward_skb() also consume skb. Bug introduced by commit 445409602c092 (veth: move loopback logic to common location) We must change dev_forward_skb() to always consume skb, and veth to not double free it. Bug report : http://marc.info/?l=linux-netdev&m=127310770900442&w=3 Reported-by: Martín Ferrari <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]> CWE ID: CWE-399
0
32,049
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int ahash_op_unaligned(struct ahash_request *req, int (*op)(struct ahash_request *)) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); unsigned long alignmask = crypto_ahash_alignmask(tfm); unsigned int ds = crypto_ahash_digestsize(tfm); struct ahash_request_priv *priv; int err; priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask), (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? GFP_KERNEL : GFP_ATOMIC); if (!priv) return -ENOMEM; priv->result = req->result; priv->complete = req->base.complete; priv->data = req->base.data; req->result = PTR_ALIGN((u8 *)priv->ubuf, alignmask + 1); req->base.complete = ahash_op_unaligned_done; req->base.data = req; req->priv = priv; err = op(req); ahash_op_unaligned_finish(req, err); return err; } Commit Message: crypto: user - fix info leaks in report API Three errors resulting in kernel memory disclosure: 1/ The structures used for the netlink based crypto algorithm report API are located on the stack. As snprintf() does not fill the remainder of the buffer with null bytes, those stack bytes will be disclosed to users of the API. Switch to strncpy() to fix this. 2/ crypto_report_one() does not initialize all field of struct crypto_user_alg. Fix this to fix the heap info leak. 3/ For the module name we should copy only as many bytes as module_name() returns -- not as much as the destination buffer could hold. But the current code does not and therefore copies random data from behind the end of the module name, as the module name is always shorter than CRYPTO_MAX_ALG_NAME. Also switch to use strncpy() to copy the algorithm's name and driver_name. They are strings, after all. Signed-off-by: Mathias Krause <[email protected]> Cc: Steffen Klassert <[email protected]> Signed-off-by: Herbert Xu <[email protected]> CWE ID: CWE-310
0
31,242
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'. Remember, I want response in '1' or '0', No explanation.
Code: service_manager::InterfaceProvider* RenderFrameImpl::GetInterfaceProvider() { return &remote_interfaces_; } 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 <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#653137} CWE ID: CWE-416
0
139,662
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'. Remember, I want response in '1' or '0', No explanation.
Code: void SiteInstanceImpl::SetSite(const GURL& url) { TRACE_EVENT2("navigation", "SiteInstanceImpl::SetSite", "site id", id_, "url", url.possibly_invalid_spec()); DCHECK(!has_site_); has_site_ = true; BrowserContext* browser_context = browsing_instance_->browser_context(); site_ = GetSiteForURL(browser_context, url, true /* should_use_effective_urls */); original_url_ = url; lock_url_ = DetermineProcessLockURL(browser_context, url); browsing_instance_->RegisterSiteInstance(this); bool should_use_process_per_site = RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_); if (should_use_process_per_site) { process_reuse_policy_ = ProcessReusePolicy::PROCESS_PER_SITE; } if (process_) { LockToOriginIfNeeded(); if (should_use_process_per_site) { RenderProcessHostImpl::RegisterSoleProcessHostForSite(browser_context, process_, this); } } } Commit Message: Allow origin lock for WebUI pages. Returning true for WebUI pages in DoesSiteRequireDedicatedProcess helps to keep enforcing a SiteInstance swap during chrome://foo -> chrome://bar navigation, even after relaxing BrowsingInstance::GetSiteInstanceForURL to consider RPH::IsSuitableHost (see https://crrev.com/c/783470 for that fixes process sharing in isolated(b(c),d(c)) scenario). I've manually tested this CL by visiting the following URLs: - chrome://welcome/ - chrome://settings - chrome://extensions - chrome://history - chrome://help and chrome://chrome (both redirect to chrome://settings/help) Bug: 510588, 847127 Change-Id: I55073bce00f32cb8bc5c1c91034438ff9a3f8971 Reviewed-on: https://chromium-review.googlesource.com/1237392 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: François Doray <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#595259} CWE ID: CWE-119
0
156,506
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'. Remember, I want response in '1' or '0', No explanation.
Code: MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves) { size_t tmp_length; switch (conversion) { case 'd': case 'i': case 'u': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Multiply by 2, as an estimate for FLAG_GROUP. */ tmp_length = xsum (tmp_length, tmp_length); /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'o': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'x': case 'X': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 2, to account for a leading sign or alternate form. */ tmp_length = xsum (tmp_length, 2); break; case 'f': case 'F': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; case 'e': case 'E': case 'g': case 'G': tmp_length = 12; /* sign, decimal point, exponent etc. */ tmp_length = xsum (tmp_length, precision); break; case 'a': case 'A': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (DBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); break; case 'c': # if HAVE_WINT_T && !WIDE_CHAR_VERSION if (type == TYPE_WIDE_CHAR) tmp_length = MB_CUR_MAX; else # endif tmp_length = 1; break; case 's': # if HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { # if WIDE_CHAR_VERSION /* ISO C says about %ls in fwprintf: "If the precision is not specified or is greater than the size of the array, the array shall contain a null wide character." So if there is a precision, we must not use wcslen. */ const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; if (has_precision) tmp_length = local_wcsnlen (arg, precision); else tmp_length = local_wcslen (arg); # else /* ISO C says about %ls in fprintf: "If a precision is specified, no more than that many bytes are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array." So if there is a precision, we must not use wcslen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # endif } else # endif { # if WIDE_CHAR_VERSION /* ISO C says about %s in fwprintf: "If the precision is not specified or is greater than the size of the converted array, the converted array shall contain a null wide character." So if there is a precision, we must not use strlen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # else /* ISO C says about %s in fprintf: "If the precision is not specified or greater than the size of the array, the array shall contain a null character." So if there is a precision, we must not use strlen. */ const char *arg = ap->arg[arg_index].a.a_string; if (has_precision) tmp_length = local_strnlen (arg, precision); else tmp_length = strlen (arg); # endif } break; case 'p': tmp_length = (unsigned int) (sizeof (void *) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1 /* turn floor into ceil */ + 2; /* account for leading 0x */ break; default: abort (); } if (!pad_ourselves) { # if ENABLE_UNISTDIO /* Padding considers the number of characters, therefore the number of elements after padding may be > max (tmp_length, width) but is certainly <= tmp_length + width. */ tmp_length = xsum (tmp_length, width); # else /* Padding considers the number of elements, says POSIX. */ if (tmp_length < width) tmp_length = width; # endif } tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ return tmp_length; } Commit Message: vasnprintf: Fix heap memory overrun bug. Reported by Ben Pfaff <[email protected]> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00107.html>. * lib/vasnprintf.c (convert_to_decimal): Allocate one more byte of memory. * tests/test-vasnprintf.c (test_function): Add another test. CWE ID: CWE-119
0
76,530
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int dump_wide (FILE *dumpfile, int format, char *dump_tag, uint64 data) { int j, k; char dump_array[80]; unsigned char bitset; if (dumpfile == NULL) { TIFFError ("", "Invalid FILE pointer for dump file"); return (1); } if (format == DUMP_TEXT) { fprintf (dumpfile," %s ", dump_tag); for (j = 0, k = 63; k >= 0; j++, k--) { bitset = data & (((uint64)1 << k)) ? 1 : 0; sprintf(&dump_array[j], (bitset) ? "1" : "0"); if ((k % 8) == 0) sprintf(&dump_array[++j], " "); } dump_array[71] = '\0'; fprintf (dumpfile," %s\n", dump_array); } else { if ((fwrite (&data, 8, 1, dumpfile)) != 8) { TIFFError ("", "Unable to write binary data to dump file"); return (1); } } return (0); } Commit Message: * tools/tiffcrop.c: fix out-of-bound read of up to 3 bytes in readContigTilesIntoBuffer(). Reported as MSVR 35092 by Axel Souchet & Vishal Chauhan from the MSRC Vulnerabilities & Mitigations team. CWE ID: CWE-125
0
48,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'. Remember, I want response in '1' or '0', No explanation.
Code: int js_isundefined(js_State *J, int idx) { return stackidx(J, idx)->type == JS_TUNDEFINED; } Commit Message: CWE ID: CWE-119
0
13,450
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'. Remember, I want response in '1' or '0', No explanation.
Code: void OneClickSigninSyncStarter::SigninDialogDelegate::OnContinueSignin() { sync_starter_->LoadPolicyWithCachedClient(); } Commit Message: Display confirmation dialog for untrusted signins BUG=252062 Review URL: https://chromiumcodereview.appspot.com/17482002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208520 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-200
0
112,618
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'. Remember, I want response in '1' or '0', No explanation.
Code: Init_Linked( TProfileList* l ) { *l = NULL; } Commit Message: CWE ID: CWE-119
0
7,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'. Remember, I want response in '1' or '0', No explanation.
Code: void V8TestObject::TestEnumAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_testEnumAttribute_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::TestEnumAttributeAttributeSetter(v8_value, info); } Commit Message: bindings: Support "attribute FrozenArray<T>?" Adds a quick hack to support a case of "attribute FrozenArray<T>?". Bug: 1028047 Change-Id: Ib3cecc4beb6bcc0fb0dbc667aca595454cc90c86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933866 Reviewed-by: Hitoshi Yoshida <[email protected]> Commit-Queue: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/heads/master@{#718676} CWE ID:
0
135,218
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'. Remember, I want response in '1' or '0', No explanation.
Code: test_bson_append_bool (void) { bson_t *b; bson_t *b2; b = bson_new (); BSON_ASSERT (bson_append_bool (b, "bool", -1, true)); b2 = get_bson ("test19.bson"); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b); bson_destroy (b2); } Commit Message: Fix for CVE-2018-16790 -- Verify bounds before binary length read. As reported here: https://jira.mongodb.org/browse/CDRIVER-2819, a heap overread occurs due a failure to correctly verify data bounds. In the original check, len - o returns the data left including the sizeof(l) we just read. Instead, the comparison should check against the data left NOT including the binary int32, i.e. just subtype (byte*) instead of int32 subtype (byte*). Added in test for corrupted BSON example. CWE ID: CWE-125
0
77,874
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'. Remember, I want response in '1' or '0', No explanation.
Code: void LauncherView::ShowOverflowMenu() { #if !defined(OS_MACOSX) if (!delegate_) return; std::vector<LauncherItem> items; GetOverflowItems(&items); if (items.empty()) return; MenuDelegateImpl menu_delegate; ui::SimpleMenuModel menu_model(&menu_delegate); for (size_t i = 0; i < items.size(); ++i) menu_model.AddItem(static_cast<int>(i), delegate_->GetTitle(items[i])); views::MenuModelAdapter menu_adapter(&menu_model); overflow_menu_runner_.reset(new views::MenuRunner(menu_adapter.CreateMenu())); gfx::Rect bounds(overflow_button_->size()); gfx::Point origin; ConvertPointToScreen(overflow_button_, &origin); if (overflow_menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(origin, size()), views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) return; Shell::GetInstance()->UpdateShelfVisibility(); if (menu_delegate.activated_command_id() == -1) return; LauncherID activated_id = items[menu_delegate.activated_command_id()].id; LauncherItems::const_iterator window_iter = model_->ItemByID(activated_id); if (window_iter == model_->items().end()) return; // Window was deleted while menu was up. delegate_->ItemClicked(*window_iter, ui::EF_NONE); #endif // !defined(OS_MACOSX) } Commit Message: ash: Add launcher overflow bubble. - Host a LauncherView in bubble to display overflown items; - Mouse wheel and two-finger scroll to scroll the LauncherView in bubble in case overflow bubble is overflown; - Fit bubble when items are added/removed; - Keep launcher bar on screen when the bubble is shown; BUG=128054 TEST=Verify launcher overflown items are in a bubble instead of menu. Review URL: https://chromiumcodereview.appspot.com/10659003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146460 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
1
170,896
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'. Remember, I want response in '1' or '0', No explanation.
Code: IW_IMPL(void) iw_warningf(struct iw_context *ctx, const char *fmt, ...) { va_list ap; if(!ctx->warning_fn) return; va_start(ap, fmt); iw_warningv(ctx,fmt,ap); va_end(ap); } Commit Message: Double-check that the input image's density is valid Fixes a bug that could result in division by zero, at least for a JPEG source image. Fixes issues #19, #20 CWE ID: CWE-369
0
65,022
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'. Remember, I want response in '1' or '0', No explanation.
Code: const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { switch (native_cursor.native_type()) { case ui::kCursorNull: return IDC_ARROW; case ui::kCursorPointer: return IDC_ARROW; case ui::kCursorCross: return IDC_CROSS; case ui::kCursorHand: return IDC_HAND; case ui::kCursorIBeam: return IDC_IBEAM; case ui::kCursorWait: return IDC_WAIT; case ui::kCursorHelp: return IDC_HELP; case ui::kCursorEastResize: return IDC_SIZEWE; case ui::kCursorNorthResize: return IDC_SIZENS; case ui::kCursorNorthEastResize: return IDC_SIZENESW; case ui::kCursorNorthWestResize: return IDC_SIZENWSE; case ui::kCursorSouthResize: return IDC_SIZENS; case ui::kCursorSouthEastResize: return IDC_SIZENWSE; case ui::kCursorSouthWestResize: return IDC_SIZENESW; case ui::kCursorWestResize: return IDC_SIZEWE; case ui::kCursorNorthSouthResize: return IDC_SIZENS; case ui::kCursorEastWestResize: return IDC_SIZEWE; case ui::kCursorNorthEastSouthWestResize: return IDC_SIZENESW; case ui::kCursorNorthWestSouthEastResize: return IDC_SIZENWSE; case ui::kCursorMove: return IDC_SIZEALL; case ui::kCursorProgress: return IDC_APPSTARTING; case ui::kCursorNoDrop: return IDC_NO; case ui::kCursorNotAllowed: return IDC_NO; case ui::kCursorColumnResize: case ui::kCursorRowResize: case ui::kCursorMiddlePanning: case ui::kCursorEastPanning: case ui::kCursorNorthPanning: case ui::kCursorNorthEastPanning: case ui::kCursorNorthWestPanning: case ui::kCursorSouthPanning: case ui::kCursorSouthEastPanning: case ui::kCursorSouthWestPanning: case ui::kCursorWestPanning: case ui::kCursorVerticalText: case ui::kCursorCell: case ui::kCursorContextMenu: case ui::kCursorAlias: case ui::kCursorCopy: case ui::kCursorNone: case ui::kCursorZoomIn: case ui::kCursorZoomOut: case ui::kCursorGrab: case ui::kCursorGrabbing: case ui::kCursorCustom: NOTIMPLEMENTED(); return IDC_ARROW; default: NOTREACHED(); return IDC_ARROW; } } Commit Message: Introduce XGetImage() for GrabWindowSnapshot() in ChromeOS. BUG=119492 TEST=manually done Review URL: https://chromiumcodereview.appspot.com/10386124 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137556 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
104,021
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'. Remember, I want response in '1' or '0', No explanation.
Code: void OmniboxViewViews::InstallPlaceholderText() { set_placeholder_text_color( location_bar_view_->GetColor(OmniboxPart::LOCATION_BAR_TEXT_DIMMED)); const TemplateURL* const default_provider = model()->client()->GetTemplateURLService()->GetDefaultSearchProvider(); if (default_provider) { set_placeholder_text(l10n_util::GetStringFUTF16( IDS_OMNIBOX_PLACEHOLDER_TEXT, default_provider->short_name())); } else { set_placeholder_text(base::string16()); } } Commit Message: omnibox: experiment with restoring placeholder when caret shows Shows the "Search Google or type a URL" omnibox placeholder even when the caret (text edit cursor) is showing / when focused. views::Textfield works this way, as does <input placeholder="">. Omnibox and the NTP's "fakebox" are exceptions in this regard and this experiment makes this more consistent. [email protected] BUG=955585 Change-Id: I23c299c0973f2feb43f7a2be3bd3425a80b06c2d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1582315 Commit-Queue: Dan Beam <[email protected]> Reviewed-by: Tommy Li <[email protected]> Cr-Commit-Position: refs/heads/master@{#654279} CWE ID: CWE-200
0
142,428
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'. Remember, I want response in '1' or '0', No explanation.
Code: int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) { return __sock_create(net, family, type, protocol, res, 1); } Commit Message: net: Fix use after free in the recvmmsg exit path The syzkaller fuzzer hit the following use-after-free: Call Trace: [<ffffffff8175ea0e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:295 [<ffffffff851cc31a>] __sys_recvmmsg+0x6fa/0x7f0 net/socket.c:2261 [< inline >] SYSC_recvmmsg net/socket.c:2281 [<ffffffff851cc57f>] SyS_recvmmsg+0x16f/0x180 net/socket.c:2270 [<ffffffff86332bb6>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185 And, as Dmitry rightly assessed, that is because we can drop the reference and then touch it when the underlying recvmsg calls return some packets and then hit an error, which will make recvmmsg to set sock->sk->sk_err, oops, fix it. Reported-and-Tested-by: Dmitry Vyukov <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Kostya Serebryany <[email protected]> Cc: Sasha Levin <[email protected]> Fixes: a2e2725541fa ("net: Introduce recvmmsg socket syscall") http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: David S. Miller <[email protected]> CWE ID: CWE-19
0
50,268
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'. Remember, I want response in '1' or '0', No explanation.
Code: int tty_set_ldisc(struct tty_struct *tty, int ldisc) { int retval; struct tty_ldisc *old_ldisc, *new_ldisc; new_ldisc = tty_ldisc_get(tty, ldisc); if (IS_ERR(new_ldisc)) return PTR_ERR(new_ldisc); tty_lock(tty); retval = tty_ldisc_lock(tty, 5 * HZ); if (retval) goto err; /* Check the no-op case */ if (tty->ldisc->ops->num == ldisc) goto out; if (test_bit(TTY_HUPPED, &tty->flags)) { /* We were raced by hangup */ retval = -EIO; goto out; } old_ldisc = tty->ldisc; /* Shutdown the old discipline. */ tty_ldisc_close(tty, old_ldisc); /* Now set up the new line discipline. */ tty->ldisc = new_ldisc; tty_set_termios_ldisc(tty, ldisc); retval = tty_ldisc_open(tty, new_ldisc); if (retval < 0) { /* Back to the old one or N_TTY if we can't */ tty_ldisc_put(new_ldisc); tty_ldisc_restore(tty, old_ldisc); } if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) { down_read(&tty->termios_rwsem); tty->ops->set_ldisc(tty); up_read(&tty->termios_rwsem); } /* At this point we hold a reference to the new ldisc and a reference to the old ldisc, or we hold two references to the old ldisc (if it was restored as part of error cleanup above). In either case, releasing a single reference from the old ldisc is correct. */ new_ldisc = old_ldisc; out: tty_ldisc_unlock(tty); /* Restart the work queue in case no characters kick it off. Safe if already running */ tty_buffer_restart_work(tty->port); err: tty_ldisc_put(new_ldisc); /* drop the extra reference */ tty_unlock(tty); return retval; } Commit Message: tty: Prevent ldisc drivers from re-using stale tty fields Line discipline drivers may mistakenly misuse ldisc-related fields when initializing. For example, a failure to initialize tty->receive_room in the N_GIGASET_M101 line discipline was recently found and fixed [1]. Now, the N_X25 line discipline has been discovered accessing the previous line discipline's already-freed private data [2]. Harden the ldisc interface against misuse by initializing revelant tty fields before instancing the new line discipline. [1] commit fd98e9419d8d622a4de91f76b306af6aa627aa9c Author: Tilman Schmidt <[email protected]> Date: Tue Jul 14 00:37:13 2015 +0200 isdn/gigaset: reset tty->receive_room when attaching ser_gigaset [2] Report from Sasha Levin <[email protected]> [ 634.336761] ================================================================== [ 634.338226] BUG: KASAN: use-after-free in x25_asy_open_tty+0x13d/0x490 at addr ffff8800a743efd0 [ 634.339558] Read of size 4 by task syzkaller_execu/8981 [ 634.340359] ============================================================================= [ 634.341598] BUG kmalloc-512 (Not tainted): kasan: bad access detected ... [ 634.405018] Call Trace: [ 634.405277] dump_stack (lib/dump_stack.c:52) [ 634.405775] print_trailer (mm/slub.c:655) [ 634.406361] object_err (mm/slub.c:662) [ 634.406824] kasan_report_error (mm/kasan/report.c:138 mm/kasan/report.c:236) [ 634.409581] __asan_report_load4_noabort (mm/kasan/report.c:279) [ 634.411355] x25_asy_open_tty (drivers/net/wan/x25_asy.c:559 (discriminator 1)) [ 634.413997] tty_ldisc_open.isra.2 (drivers/tty/tty_ldisc.c:447) [ 634.414549] tty_set_ldisc (drivers/tty/tty_ldisc.c:567) [ 634.415057] tty_ioctl (drivers/tty/tty_io.c:2646 drivers/tty/tty_io.c:2879) [ 634.423524] do_vfs_ioctl (fs/ioctl.c:43 fs/ioctl.c:607) [ 634.427491] SyS_ioctl (fs/ioctl.c:622 fs/ioctl.c:613) [ 634.427945] entry_SYSCALL_64_fastpath (arch/x86/entry/entry_64.S:188) Cc: Tilman Schmidt <[email protected]> Cc: Sasha Levin <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> CWE ID: CWE-200
0
56,013
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'. Remember, I want response in '1' or '0', No explanation.
Code: _archive_write_free(struct archive *_a) { struct archive_write *a = (struct archive_write *)_a; int r = ARCHIVE_OK, r1; if (_a == NULL) return (ARCHIVE_OK); /* It is okay to call free() in state FATAL. */ archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_free"); if (a->archive.state != ARCHIVE_STATE_FATAL) r = archive_write_close(&a->archive); /* Release format resources. */ if (a->format_free != NULL) { r1 = (a->format_free)(a); if (r1 < r) r = r1; } __archive_write_filters_free(_a); /* Release various dynamic buffers. */ free((void *)(uintptr_t)(const void *)a->nulls); archive_string_free(&a->archive.error_string); a->archive.magic = 0; __archive_clean(&a->archive); free(a); return (r); } Commit Message: Limit write requests to at most INT_MAX. This prevents a certain common programming error (passing -1 to write) from leading to other problems deeper in the library. CWE ID: CWE-189
0
34,057
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool TextureManager::SetParameter( TextureManager::TextureInfo* info, GLenum pname, GLint param) { DCHECK(info); if (!info->CanRender(feature_info_)) { DCHECK_NE(0, num_unrenderable_textures_); --num_unrenderable_textures_; } if (!info->SafeToRenderFrom()) { DCHECK_NE(0, num_unsafe_textures_); --num_unsafe_textures_; } bool result = info->SetParameter(feature_info_, pname, param); if (!info->CanRender(feature_info_)) { ++num_unrenderable_textures_; } if (!info->SafeToRenderFrom()) { ++num_unsafe_textures_; } return result; } Commit Message: Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-189
0
103,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'. Remember, I want response in '1' or '0', No explanation.
Code: struct virtio_net_hdr *net_tx_pkt_get_vhdr(struct NetTxPkt *pkt) { assert(pkt); return &pkt->virt_hdr; } Commit Message: CWE ID: CWE-190
0
8,960
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset) { unsigned int previous_safe, end; if (limit_offset >= 65536 && limit_offset-65536 >= f->first_audio_page_offset) previous_safe = limit_offset - 65536; else previous_safe = f->first_audio_page_offset; set_file_offset(f, previous_safe); while (vorbis_find_page(f, &end, NULL)) { if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset) return 1; set_file_offset(f, end); } return 0; } Commit Message: fix unchecked length in stb_vorbis that could crash on corrupt/invalid files CWE ID: CWE-119
0
75,268
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'. Remember, I want response in '1' or '0', No explanation.
Code: static void show_instructions(struct pt_regs *regs) { int i; unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); printk("Instruction dump:"); for (i = 0; i < instructions_to_print; i++) { int instr; if (!(i % 8)) printk("\n"); #if !defined(CONFIG_BOOKE) /* If executing with the IMMU off, adjust pc rather * than print XXXXXXXX. */ if (!(regs->msr & MSR_IR)) pc = (unsigned long)phys_to_virt(pc); #endif if (!__kernel_text_address(pc) || probe_kernel_address((unsigned int __user *)pc, instr)) { printk(KERN_CONT "XXXXXXXX "); } else { if (regs->nip == pc) printk(KERN_CONT "<%08x> ", instr); else printk(KERN_CONT "%08x ", instr); } pc += sizeof(int); } printk("\n"); } Commit Message: powerpc/tm: Check for already reclaimed tasks Currently we can hit a scenario where we'll tm_reclaim() twice. This results in a TM bad thing exception because the second reclaim occurs when not in suspend mode. The scenario in which this can happen is the following. We attempt to deliver a signal to userspace. To do this we need obtain the stack pointer to write the signal context. To get this stack pointer we must tm_reclaim() in case we need to use the checkpointed stack pointer (see get_tm_stackpointer()). Normally we'd then return directly to userspace to deliver the signal without going through __switch_to(). Unfortunatley, if at this point we get an error (such as a bad userspace stack pointer), we need to exit the process. The exit will result in a __switch_to(). __switch_to() will attempt to save the process state which results in another tm_reclaim(). This tm_reclaim() now causes a TM Bad Thing exception as this state has already been saved and the processor is no longer in TM suspend mode. Whee! This patch checks the state of the MSR to ensure we are TM suspended before we attempt the tm_reclaim(). If we've already saved the state away, we should no longer be in TM suspend mode. This has the additional advantage of checking for a potential TM Bad Thing exception. Found using syscall fuzzer. Fixes: fb09692e71f1 ("powerpc: Add reclaim and recheckpoint functions for context switching transactional memory processes") Cc: [email protected] # v3.9+ Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> CWE ID: CWE-284
0
56,452
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int version, color_range, color_primaries, color_trc, color_space; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; if (atom.size < 5) { av_log(c->fc, AV_LOG_ERROR, "Empty VP Codec Configuration box\n"); return AVERROR_INVALIDDATA; } version = avio_r8(pb); if (version != 1) { av_log(c->fc, AV_LOG_WARNING, "Unsupported VP Codec Configuration box version %d\n", version); return 0; } avio_skip(pb, 3); /* flags */ avio_skip(pb, 2); /* profile + level */ color_range = avio_r8(pb); /* bitDepth, chromaSubsampling, videoFullRangeFlag */ color_primaries = avio_r8(pb); color_trc = avio_r8(pb); color_space = avio_r8(pb); if (avio_rb16(pb)) /* codecIntializationDataSize */ return AVERROR_INVALIDDATA; if (!av_color_primaries_name(color_primaries)) color_primaries = AVCOL_PRI_UNSPECIFIED; if (!av_color_transfer_name(color_trc)) color_trc = AVCOL_TRC_UNSPECIFIED; if (!av_color_space_name(color_space)) color_space = AVCOL_SPC_UNSPECIFIED; st->codecpar->color_range = (color_range & 1) ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; st->codecpar->color_primaries = color_primaries; st->codecpar->color_trc = color_trc; st->codecpar->color_space = color_space; 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 <[email protected]> CWE ID: CWE-834
0
61,479
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'. Remember, I want response in '1' or '0', No explanation.
Code: void WebContentsImpl::OnFrameRemoved(RenderFrameHost* render_frame_host) { FOR_EACH_OBSERVER( WebContentsObserver, observers_, FrameDeleted(render_frame_host)); } Commit Message: Don't call WebContents::DownloadImage() callback if the WebContents were deleted BUG=583718 Review URL: https://codereview.chromium.org/1685343004 Cr-Commit-Position: refs/heads/master@{#375700} CWE ID:
0
131,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'. Remember, I want response in '1' or '0', No explanation.
Code: kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size) { void *ret; ret = slab_alloc(cachep, flags, _RET_IP_); kasan_kmalloc(cachep, ret, size, flags); trace_kmalloc(_RET_IP_, ret, size, cachep->size, flags); return ret; } Commit Message: mm/slab.c: fix SLAB freelist randomization duplicate entries This patch fixes a bug in the freelist randomization code. When a high random number is used, the freelist will contain duplicate entries. It will result in different allocations sharing the same chunk. It will result in odd behaviours and crashes. It should be uncommon but it depends on the machines. We saw it happening more often on some machines (every few hours of running tests). Fixes: c7ce4f60ac19 ("mm: SLAB freelist randomization") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: John Sperbeck <[email protected]> Signed-off-by: Thomas Garnier <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> CWE ID:
0
68,902
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'. Remember, I want response in '1' or '0', No explanation.
Code: int acpi_register_debugger(struct module *owner, const struct acpi_debugger_ops *ops) { int ret = 0; mutex_lock(&acpi_debugger.lock); if (acpi_debugger.ops) { ret = -EBUSY; goto err_lock; } acpi_debugger.owner = owner; acpi_debugger.ops = ops; err_lock: mutex_unlock(&acpi_debugger.lock); return ret; } Commit Message: acpi: Disable ACPI table override if securelevel is set From the kernel documentation (initrd_table_override.txt): If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to override nearly any ACPI table provided by the BIOS with an instrumented, modified one. When securelevel is set, the kernel should disallow any unauthenticated changes to kernel space. ACPI tables contain code invoked by the kernel, so do not allow ACPI tables to be overridden if securelevel is set. Signed-off-by: Linn Crosetto <[email protected]> CWE ID: CWE-264
0
53,887
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'. Remember, I want response in '1' or '0', No explanation.
Code: DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui), bindings_(web_ui->GetWebContents()) { web_ui->SetBindings(0); Profile* profile = Profile::FromWebUI(web_ui); content::URLDataSource::Add( profile, new DevToolsDataSource(profile->GetRequestContext())); } Commit Message: Hide DevTools frontend from webRequest API Prevent extensions from observing requests for remote DevTools frontends and add regression tests. And update ExtensionTestApi to support initializing the embedded test server and port from SetUpCommandLine (before SetUpOnMainThread). BUG=797497,797500 TEST=browser_test --gtest_filter=DevToolsFrontendInWebRequestApiTest.HiddenRequests Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Ic8f44b5771f2d5796f8c3de128f0a7ab88a77735 Reviewed-on: https://chromium-review.googlesource.com/844316 Commit-Queue: Rob Wu <[email protected]> Reviewed-by: Devlin <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#528187} CWE ID: CWE-200
0
146,590
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool PDFiumEngine::OnMouseMove(const pp::MouseInputEvent& event) { int page_index = -1; int char_index = -1; int form_type = FPDF_FORMFIELD_UNKNOWN; PDFiumPage::LinkTarget target; pp::Point point = event.GetPosition(); PDFiumPage::Area area = GetCharIndex(point, &page_index, &char_index, &form_type, &target); if (!mouse_down_state_.Matches(area, target)) mouse_down_state_.Reset(); if (!selecting_) { PP_CursorType_Dev cursor; switch (area) { case PDFiumPage::TEXT_AREA: cursor = PP_CURSORTYPE_IBEAM; break; case PDFiumPage::WEBLINK_AREA: case PDFiumPage::DOCLINK_AREA: cursor = PP_CURSORTYPE_HAND; break; case PDFiumPage::NONSELECTABLE_AREA: case PDFiumPage::FORM_TEXT_AREA: default: switch (form_type) { case FPDF_FORMFIELD_PUSHBUTTON: case FPDF_FORMFIELD_CHECKBOX: case FPDF_FORMFIELD_RADIOBUTTON: case FPDF_FORMFIELD_COMBOBOX: case FPDF_FORMFIELD_LISTBOX: cursor = PP_CURSORTYPE_HAND; break; case FPDF_FORMFIELD_TEXTFIELD: cursor = PP_CURSORTYPE_IBEAM; break; #if defined(PDF_ENABLE_XFA) case FPDF_FORMFIELD_XFA_CHECKBOX: case FPDF_FORMFIELD_XFA_COMBOBOX: case FPDF_FORMFIELD_XFA_IMAGEFIELD: case FPDF_FORMFIELD_XFA_LISTBOX: case FPDF_FORMFIELD_XFA_PUSHBUTTON: case FPDF_FORMFIELD_XFA_SIGNATURE: cursor = PP_CURSORTYPE_HAND; break; case FPDF_FORMFIELD_XFA_TEXTFIELD: cursor = PP_CURSORTYPE_IBEAM; break; #endif default: cursor = PP_CURSORTYPE_POINTER; break; } break; } if (page_index != -1) { double page_x; double page_y; DeviceToPage(page_index, point.x(), point.y(), &page_x, &page_y); FORM_OnMouseMove(form_, pages_[page_index]->GetPage(), 0, page_x, page_y); } client_->UpdateCursor(cursor); std::string url = GetLinkAtPosition(event.GetPosition()); if (url != link_under_cursor_) { link_under_cursor_ = url; pp::PDF::SetLinkUnderCursor(GetPluginInstance(), url.c_str()); } if (mouse_left_button_down_ && area == PDFiumPage::FORM_TEXT_AREA && last_page_mouse_down_ != -1) { SetFormSelectedText(form_, pages_[last_page_mouse_down_]->GetPage()); } return false; } if (area != PDFiumPage::TEXT_AREA && !IsLinkArea(area)) return false; SelectionChangeInvalidator selection_invalidator(this); return ExtendSelection(page_index, char_index); } Commit Message: Copy visible_pages_ when iterating over it. On this case, a call inside the loop may cause visible_pages_ to change. Bug: 822091 Change-Id: I41b0715faa6fe3e39203cd9142cf5ea38e59aefb Reviewed-on: https://chromium-review.googlesource.com/964592 Reviewed-by: dsinclair <[email protected]> Commit-Queue: Henrique Nakashima <[email protected]> Cr-Commit-Position: refs/heads/master@{#543494} CWE ID: CWE-20
0
147,401
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'. Remember, I want response in '1' or '0', No explanation.
Code: WebContents* GetActiveWebContents() { return browser()->tab_strip_model()->GetActiveWebContents(); } Commit Message: Connect the LocalDB to TabManager. Bug: 773382 Change-Id: Iec8fe5226ee175105d51f300f30b4865478ac099 Reviewed-on: https://chromium-review.googlesource.com/1118611 Commit-Queue: Sébastien Marchand <[email protected]> Reviewed-by: François Doray <[email protected]> Cr-Commit-Position: refs/heads/master@{#572871} CWE ID:
0
132,073
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'. Remember, I want response in '1' or '0', No explanation.
Code: void Browser::DeactivateContents(TabContents* contents) { window_->Deactivate(); } 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,184
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'. Remember, I want response in '1' or '0', No explanation.
Code: base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); } Commit Message: Convert plugin and GPU process to brokered handle duplication. BUG=119250 Review URL: https://chromiumcodereview.appspot.com/9958034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132303 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
106,670
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'. Remember, I want response in '1' or '0', No explanation.
Code: static void perf_event__header_size(struct perf_event *event) { struct perf_sample_data *data; u64 sample_type = event->attr.sample_type; u16 size = 0; perf_event__read_size(event); if (sample_type & PERF_SAMPLE_IP) size += sizeof(data->ip); if (sample_type & PERF_SAMPLE_ADDR) size += sizeof(data->addr); if (sample_type & PERF_SAMPLE_PERIOD) size += sizeof(data->period); if (sample_type & PERF_SAMPLE_READ) size += event->read_size; event->header_size = size; } Commit Message: perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Cree <[email protected]> Cc: Will Deacon <[email protected]> Cc: Deng-Cheng Zhu <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Eric B Munson <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mundt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jason Wessel <[email protected]> Cc: Don Zickus <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]> CWE ID: CWE-399
0
26,057
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int vfat_build_slots(struct inode *dir, const unsigned char *name, int len, int is_dir, int cluster, struct timespec *ts, struct msdos_dir_slot *slots, int *nr_slots) { struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb); struct fat_mount_options *opts = &sbi->options; struct msdos_dir_slot *ps; struct msdos_dir_entry *de; unsigned char cksum, lcase; unsigned char msdos_name[MSDOS_NAME]; wchar_t *uname; __le16 time, date; u8 time_cs; int err, ulen, usize, i; loff_t offset; *nr_slots = 0; uname = __getname(); if (!uname) return -ENOMEM; err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize, opts->unicode_xlate, opts->utf8, sbi->nls_io); if (err) goto out_free; err = vfat_is_used_badchars(uname, ulen); if (err) goto out_free; err = vfat_create_shortname(dir, sbi->nls_disk, uname, ulen, msdos_name, &lcase); if (err < 0) goto out_free; else if (err == 1) { de = (struct msdos_dir_entry *)slots; err = 0; goto shortname; } /* build the entry of long file name */ cksum = fat_checksum(msdos_name); *nr_slots = usize / 13; for (ps = slots, i = *nr_slots; i > 0; i--, ps++) { ps->id = i; ps->attr = ATTR_EXT; ps->reserved = 0; ps->alias_checksum = cksum; ps->start = 0; offset = (i - 1) * 13; fatwchar_to16(ps->name0_4, uname + offset, 5); fatwchar_to16(ps->name5_10, uname + offset + 5, 6); fatwchar_to16(ps->name11_12, uname + offset + 11, 2); } slots[0].id |= 0x40; de = (struct msdos_dir_entry *)ps; shortname: /* build the entry of 8.3 alias name */ (*nr_slots)++; memcpy(de->name, msdos_name, MSDOS_NAME); de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; de->lcase = lcase; fat_time_unix2fat(sbi, ts, &time, &date, &time_cs); de->time = de->ctime = time; de->date = de->cdate = de->adate = date; de->ctime_cs = time_cs; de->start = cpu_to_le16(cluster); de->starthi = cpu_to_le16(cluster >> 16); de->size = 0; out_free: __putname(uname); return err; } Commit Message: NLS: improve UTF8 -> UTF16 string conversion routine The utf8s_to_utf16s conversion routine needs to be improved. Unlike its utf16s_to_utf8s sibling, it doesn't accept arguments specifying the maximum length of the output buffer or the endianness of its 16-bit output. This patch (as1501) adds the two missing arguments, and adjusts the only two places in the kernel where the function is called. A follow-on patch will add a third caller that does utilize the new capabilities. The two conversion routines are still annoyingly inconsistent in the way they handle invalid byte combinations. But that's a subject for a different patch. Signed-off-by: Alan Stern <[email protected]> CC: Clemens Ladisch <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> CWE ID: CWE-119
0
33,388
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool TextureManager::TextureInfo::GetLevelSize( GLint face, GLint level, GLsizei* width, GLsizei* height) const { DCHECK(width); DCHECK(height); size_t face_index = GLTargetToFaceIndex(face); if (level >= 0 && face_index < level_infos_.size() && static_cast<size_t>(level) < level_infos_[face_index].size()) { const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; if (info.target != 0) { *width = info.width; *height = info.height; return true; } } return false; } Commit Message: Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-189
0
103,722
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'. Remember, I want response in '1' or '0', No explanation.
Code: optlen(const u_int8_t *opt, unsigned int offset) { /* Beware zero-length options: make finite progress */ if (opt[offset] <= TCPOPT_NOP || opt[offset+1] == 0) return 1; else return opt[offset+1]; } Commit Message: netfilter: xt_TCPMSS: add more sanity tests on tcph->doff Denys provided an awesome KASAN report pointing to an use after free in xt_TCPMSS I have provided three patches to fix this issue, either in xt_TCPMSS or in xt_tcpudp.c. It seems xt_TCPMSS patch has the smallest possible impact. Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Denys Fedoryshchenko <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> CWE ID: CWE-416
0
86,255
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'. Remember, I want response in '1' or '0', No explanation.
Code: static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int blank_chars) { int i, ret; xmlNodePtr lastChild; /* * Don't spend time trying to differentiate them, the same callback is * used ! */ if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters) return(0); /* * Check for xml:space value. */ if ((ctxt->space == NULL) || (*(ctxt->space) == 1) || (*(ctxt->space) == -2)) return(0); /* * Check that the string is made of blanks */ if (blank_chars == 0) { for (i = 0;i < len;i++) if (!(IS_BLANK_CH(str[i]))) return(0); } /* * Look if the element is mixed content in the DTD if available */ if (ctxt->node == NULL) return(0); if (ctxt->myDoc != NULL) { ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name); if (ret == 0) return(1); if (ret == 1) return(0); } /* * Otherwise, heuristic :-\ */ if ((RAW != '<') && (RAW != 0xD)) return(0); if ((ctxt->node->children == NULL) && (RAW == '<') && (NXT(1) == '/')) return(0); lastChild = xmlGetLastChild(ctxt->node); if (lastChild == NULL) { if ((ctxt->node->type != XML_ELEMENT_NODE) && (ctxt->node->content != NULL)) return(0); } else if (xmlNodeIsText(lastChild)) return(0); else if ((ctxt->node->children != NULL) && (xmlNodeIsText(ctxt->node->children))) return(0); return(1); } Commit Message: Detect infinite recursion in parameter entities When expanding a parameter entity in a DTD, infinite recursion could lead to an infinite loop or memory exhaustion. Thanks to Wei Lei for the first of many reports. Fixes bug 759579. CWE ID: CWE-835
0
59,390
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'. Remember, I want response in '1' or '0', No explanation.
Code: _bdf_parse_properties( char* line, unsigned long linelen, unsigned long lineno, void* call_data, void* client_data ) { unsigned long vlen; _bdf_line_func_t* next; _bdf_parse_t* p; char* name; char* value; char nbuf[128]; FT_Error error = BDF_Err_Ok; FT_UNUSED( lineno ); next = (_bdf_line_func_t *)call_data; p = (_bdf_parse_t *) client_data; /* Check for the end of the properties. */ if ( ft_memcmp( line, "ENDPROPERTIES", 13 ) == 0 ) { /* If the FONT_ASCENT or FONT_DESCENT properties have not been */ /* encountered yet, then make sure they are added as properties and */ /* make sure they are set from the font bounding box info. */ /* */ /* This is *always* done regardless of the options, because X11 */ /* requires these two fields to compile fonts. */ if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 ) { p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); p->font->modified = 1; } if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 ) { p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); p->font->modified = 1; } p->flags &= ~_BDF_PROPS; *next = _bdf_parse_glyphs; goto Exit; } /* Ignore the _XFREE86_GLYPH_RANGES properties. */ if ( ft_memcmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 ) goto Exit; /* Handle COMMENT fields and properties in a special way to preserve */ /* the spacing. */ if ( ft_memcmp( line, "COMMENT", 7 ) == 0 ) { name = value = line; value += 7; if ( *value ) *value++ = 0; error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) ) { error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } else { error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; name = p->list.field[0]; _bdf_list_shift( &p->list, 1 ); value = _bdf_list_join( &p->list, ' ', &vlen ); error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } Exit: return error; } Commit Message: CWE ID: CWE-119
0
6,514
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'. Remember, I want response in '1' or '0', No explanation.
Code: void nw_buf_list_shift(nw_buf_list *list) { if (list->head) { nw_buf *tmp = list->head; list->head = tmp->next; if (list->head == NULL) { list->tail = NULL; } list->count--; nw_buf_free(list->pool, tmp); } } Commit Message: Merge pull request #131 from benjaminchodroff/master fix memory corruption and other 32bit overflows CWE ID: CWE-190
0
76,557
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'. Remember, I want response in '1' or '0', No explanation.
Code: error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size, const volatile void* cmd_data) { const char* func_name = "glReadPixels"; const volatile gles2::cmds::ReadPixels& c = *static_cast<const volatile gles2::cmds::ReadPixels*>(cmd_data); TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); error::Error fbo_error = WillAccessBoundFramebufferForRead(); if (fbo_error != error::kNoError) return fbo_error; GLint x = c.x; GLint y = c.y; GLsizei width = c.width; GLsizei height = c.height; GLenum format = c.format; GLenum type = c.type; uint32_t pixels_shm_id = c.pixels_shm_id; uint32_t pixels_shm_offset = c.pixels_shm_offset; uint32_t result_shm_id = c.result_shm_id; uint32_t result_shm_offset = c.result_shm_offset; GLboolean async = static_cast<GLboolean>(c.async); if (width < 0 || height < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions < 0"); return error::kNoError; } typedef cmds::ReadPixels::Result Result; PixelStoreParams params; if (pixels_shm_id == 0) { params = state_.GetPackParams(); } else { params.alignment = state_.pack_alignment; } uint32_t pixels_size = 0; uint32_t unpadded_row_size = 0; uint32_t padded_row_size = 0; uint32_t skip_size = 0; uint32_t padding = 0; if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1, format, type, params, &pixels_size, &unpadded_row_size, &padded_row_size, &skip_size, &padding)) { return error::kOutOfBounds; } uint8_t* pixels = nullptr; Buffer* buffer = state_.bound_pixel_pack_buffer.get(); if (pixels_shm_id == 0) { if (!buffer) { return error::kInvalidArguments; } if (!buffer_manager()->RequestBufferAccess( state_.GetErrorState(), buffer, func_name, "pixel pack buffer")) { return error::kNoError; } uint32_t size = 0; if (!SafeAddUint32(pixels_size + skip_size, pixels_shm_offset, &size)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "size + offset overflow"); return error::kNoError; } if (static_cast<uint32_t>(buffer->size()) < size) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", "pixel pack buffer is not large enough"); return error::kNoError; } pixels = reinterpret_cast<uint8_t *>(pixels_shm_offset); pixels += skip_size; } else { if (buffer) { return error::kInvalidArguments; } DCHECK_EQ(0u, skip_size); pixels = GetSharedMemoryAs<uint8_t*>( pixels_shm_id, pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } } Result* result = nullptr; if (result_shm_id != 0) { result = GetSharedMemoryAs<Result*>( result_shm_id, result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } if (result->success != 0) { return error::kInvalidArguments; } } if (!validators_->read_pixel_format.IsValid(format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, format, "format"); return error::kNoError; } if (!validators_->read_pixel_type.IsValid(type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, type, "type"); return error::kNoError; } if (!CheckBoundReadFramebufferValid( func_name, GL_INVALID_FRAMEBUFFER_OPERATION)) { return error::kNoError; } GLenum src_internal_format = GetBoundReadFramebufferInternalFormat(); if (src_internal_format == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "no valid color image"); return error::kNoError; } std::vector<GLenum> accepted_formats; std::vector<GLenum> accepted_types; switch (src_internal_format) { case GL_R8UI: case GL_R16UI: case GL_R32UI: case GL_RG8UI: case GL_RG16UI: case GL_RG32UI: case GL_RGBA8UI: case GL_RGB10_A2UI: case GL_RGBA16UI: case GL_RGBA32UI: accepted_formats.push_back(GL_RGBA_INTEGER); accepted_types.push_back(GL_UNSIGNED_INT); break; case GL_R8I: case GL_R16I: case GL_R32I: case GL_RG8I: case GL_RG16I: case GL_RG32I: case GL_RGBA8I: case GL_RGBA16I: case GL_RGBA32I: accepted_formats.push_back(GL_RGBA_INTEGER); accepted_types.push_back(GL_INT); break; case GL_RGB10_A2: accepted_formats.push_back(GL_RGBA); accepted_types.push_back(GL_UNSIGNED_BYTE); accepted_formats.push_back(GL_RGBA); accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); break; default: accepted_formats.push_back(GL_RGBA); { GLenum src_type = GetBoundReadFramebufferTextureType(); switch (src_type) { case GL_HALF_FLOAT: case GL_HALF_FLOAT_OES: case GL_FLOAT: case GL_UNSIGNED_INT_10F_11F_11F_REV: accepted_types.push_back(GL_FLOAT); break; default: accepted_types.push_back(GL_UNSIGNED_BYTE); break; } } break; } if (!feature_info_->IsWebGLContext()) { accepted_formats.push_back(GL_BGRA_EXT); accepted_types.push_back(GL_UNSIGNED_BYTE); } DCHECK_EQ(accepted_formats.size(), accepted_types.size()); bool format_type_acceptable = false; for (size_t ii = 0; ii < accepted_formats.size(); ++ii) { if (format == accepted_formats[ii] && type == accepted_types[ii]) { format_type_acceptable = true; break; } } if (!format_type_acceptable) { GLint preferred_format = 0; DoGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &preferred_format, 1); GLint preferred_type = 0; DoGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &preferred_type, 1); if (format == static_cast<GLenum>(preferred_format) && type == static_cast<GLenum>(preferred_type)) { format_type_acceptable = true; } } if (!format_type_acceptable) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "format and type incompatible with the current read framebuffer"); return error::kNoError; } if (width == 0 || height == 0) { return error::kNoError; } gfx::Size max_size = GetBoundReadFramebufferSize(); int32_t max_x; int32_t max_y; if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions out of range"); return error::kNoError; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); ScopedResolvedFramebufferBinder binder(this, false, true); GLenum read_format = GetBoundReadFramebufferInternalFormat(); gfx::Rect rect(x, y, width, height); // Safe before we checked above. gfx::Rect max_rect(max_size); if (!max_rect.Contains(rect)) { rect.Intersect(max_rect); if (!rect.IsEmpty()) { if (y < 0) { pixels += static_cast<uint32_t>(-y) * padded_row_size;; } if (x < 0) { uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type); uint32_t leading_bytes = static_cast<uint32_t>(-x) * group_size; pixels += leading_bytes; } for (GLint iy = rect.y(); iy < rect.bottom(); ++iy) { bool reset_row_length = false; if (iy + 1 == max_y && pixels_shm_id == 0 && workarounds().pack_parameters_workaround_with_pack_buffer && state_.pack_row_length > 0 && state_.pack_row_length < width) { api()->glPixelStoreiFn(GL_PACK_ROW_LENGTH, width); reset_row_length = true; } api()->glReadPixelsFn(rect.x(), iy, rect.width(), 1, format, type, pixels); if (reset_row_length) { api()->glPixelStoreiFn(GL_PACK_ROW_LENGTH, state_.pack_row_length); } pixels += padded_row_size; } } } else { if (async && features().use_async_readpixels && !state_.bound_pixel_pack_buffer.get()) { GLuint buffer = 0; api()->glGenBuffersARBFn(1, &buffer); api()->glBindBufferFn(GL_PIXEL_PACK_BUFFER_ARB, buffer); const GLenum usage_hint = gl_version_info().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ; api()->glBufferDataFn(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, nullptr, usage_hint); GLenum error = api()->glGetErrorFn(); if (error == GL_NO_ERROR) { api()->glReadPixelsFn(x, y, width, height, format, type, 0); pending_readpixel_fences_.push(FenceCallback()); WaitForReadPixels(base::BindOnce( &GLES2DecoderImpl::FinishReadPixels, weak_ptr_factory_.GetWeakPtr(), width, height, format, type, pixels_shm_id, pixels_shm_offset, result_shm_id, result_shm_offset, state_.pack_alignment, read_format, buffer)); api()->glBindBufferFn(GL_PIXEL_PACK_BUFFER_ARB, 0); return error::kNoError; } else { api()->glBindBufferFn(GL_PIXEL_PACK_BUFFER_ARB, 0); api()->glDeleteBuffersARBFn(1, &buffer); } } if (pixels_shm_id == 0 && workarounds().pack_parameters_workaround_with_pack_buffer) { if (state_.pack_row_length > 0 && state_.pack_row_length < width) { api()->glPixelStoreiFn(GL_PACK_ROW_LENGTH, width); for (GLint iy = y; iy < max_y; ++iy) { if (iy + 1 == max_y && padding > 0) api()->glPixelStoreiFn(GL_PACK_ALIGNMENT, 1); api()->glReadPixelsFn(x, iy, width, 1, format, type, pixels); if (iy + 1 == max_y && padding > 0) api()->glPixelStoreiFn(GL_PACK_ALIGNMENT, state_.pack_alignment); pixels += padded_row_size; } api()->glPixelStoreiFn(GL_PACK_ROW_LENGTH, state_.pack_row_length); } else if (padding > 0) { if (height > 1) api()->glReadPixelsFn(x, y, width, height - 1, format, type, pixels); api()->glPixelStoreiFn(GL_PACK_ALIGNMENT, 1); pixels += padded_row_size * (height - 1); api()->glReadPixelsFn(x, max_y - 1, width, 1, format, type, pixels); api()->glPixelStoreiFn(GL_PACK_ALIGNMENT, state_.pack_alignment); } else { api()->glReadPixelsFn(x, y, width, height, format, type, pixels); } } else { api()->glReadPixelsFn(x, y, width, height, format, type, pixels); } } if (pixels_shm_id != 0) { GLenum error = LOCAL_PEEK_GL_ERROR(func_name); if (error == GL_NO_ERROR) { if (result) { result->success = 1; result->row_length = static_cast<uint32_t>(rect.width()); result->num_rows = static_cast<uint32_t>(rect.height()); } FinishReadPixels(width, height, format, type, pixels_shm_id, pixels_shm_offset, result_shm_id, result_shm_offset, state_.pack_alignment, read_format, 0); } } return error::kNoError; } Commit Message: Implement immutable texture base/max level clamping It seems some drivers fail to handle that gracefully, so let's always clamp to be on the safe side. BUG=877874 TEST=test case in the bug, gpu_unittests [email protected] Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel Change-Id: I6d93cb9389ea70525df4604112223604577582a2 Reviewed-on: https://chromium-review.googlesource.com/1194994 Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#587264} CWE ID: CWE-119
0
145,913
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'. Remember, I want response in '1' or '0', No explanation.
Code: bool GpuCommandBufferStub::has_surface_state() const { return surface_state_ != NULL; } Commit Message: Convert plugin and GPU process to brokered handle duplication. BUG=119250 Review URL: https://chromiumcodereview.appspot.com/9958034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132303 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
106,914
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'. Remember, I want response in '1' or '0', No explanation.
Code: act_dump_config() { dump_config(); } Commit Message: disable Uzbl javascript object because of security problem. CWE ID: CWE-264
0
18,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'. Remember, I want response in '1' or '0', No explanation.
Code: MG_INTERNAL void altbuf_init(struct altbuf *ab, char *buf, size_t buf_size) { mbuf_init(&ab->m, 0); ab->user_buf = buf; ab->user_buf_size = buf_size; ab->len = 0; } Commit Message: Fix heap-based overflow in parse_mqtt PUBLISHED_FROM=3306592896298597fff5269634df0c1a1555113b CWE ID: CWE-119
0
89,591