instruction
stringclasses
1 value
input
stringlengths
56
241k
output
int64
0
1
__index_level_0__
int64
0
175k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void xhci_oper_write(void *ptr, hwaddr reg, uint64_t val, unsigned size) { XHCIState *xhci = ptr; DeviceState *d = DEVICE(ptr); trace_usb_xhci_oper_write(reg, val); switch (reg) { case 0x00: /* USBCMD */ if ((val & USBCMD_RS) && !(xhci->usbcmd & USB...
0
5,735
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool FrameLoader::ShouldTreatURLAsSrcdocDocument(const KURL& url) const { if (!url.IsAboutSrcdocURL()) return false; HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner(); if (!IsHTMLIFrameElement(owner_element)) return false; return owner_element->FastHasAttribute(srcdocAttr); } ...
0
125,824
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void HTMLSelectElement::menuListDefaultEventHandler(Event* event) { RenderTheme& renderTheme = RenderTheme::theme(); if (event->type() == EventTypeNames::keydown) { if (!renderer() || !event->isKeyboardEvent()) return; if (platformHandleKeydownEvent(toKeyboardEvent(event))) ...
0
114,054
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static ssize_t f_hid_opts_report_desc_show(struct config_item *item, char *page) { struct f_hid_opts *opts = to_f_hid_opts(item); int result; mutex_lock(&opts->lock); result = opts->report_desc_length; memcpy(page, opts->report_desc, opts->report_desc_length); mutex_unlock(&opts->lock); return result; } ...
0
96,668
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static unsigned int *dccp_get_timeouts(struct net *net) { return dccp_pernet(net)->dccp_timeout; } Commit Message: netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Some occurences in the netfilter tree use skb_header_pointer() in the following way ... struct dccp_hdr _dh, *dh; ... skb_hea...
0
39,109
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void b43_dma_direct_fifo_rx(struct b43_wldev *dev, unsigned int engine_index, bool enable) { enum b43_dmatype type; u16 mmio_base; type = dma_mask_to_engine_type(supported_dma_mask(dev)); mmio_base = b43_dmacontroller_base(type, engine_index); direct_fifo_rx(dev, type, mmio_base, enable); } Commit ...
0
24,526
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void disable_write_same(struct mapped_device *md) { struct queue_limits *limits = dm_get_queue_limits(md); /* device doesn't really support WRITE SAME, disable it */ limits->max_write_same_sectors = 0; } Commit Message: dm: fix race between dm_get_from_kobject() and __dm_destroy() The following BUG_ON was h...
0
85,865
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool GetLRUOriginOnDBThread(StorageType type, std::set<GURL>* exceptions, SpecialStoragePolicy* policy, GURL* url, QuotaDatabase* database) { DCHECK(database); database->GetLRUOrigin(type, *exceptio...
0
102,186
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { EVP_AES_CCM_CTX *cctx = EVP_C_DATA(EVP_AES_CCM_CTX,ctx); CCM128_CONTEXT *ccm = &cctx->ccm; /* If not set up, return error */ if (!cctx->key_set) return -1; ...
0
69,316
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int fd_nonblock(int fd, bool nonblock) { int flags; assert(fd >= 0); if ((flags = fcntl(fd, F_GETFL, 0)) < 0) return -errno; if (nonblock) flags |= O_NONBLOCK; else flags &= ~O_NONBLOCK; if (fcntl(fd, F_SETFL, flag...
0
11,523
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gs_main_run_file(gs_main_instance * minst, const char *file_name, int user_errors, int *pexit_code, ref * perror_object) { ref initial_file; int code = gs_main_run_file_open(minst, file_name, &initial_file); if (code < 0) return code; return gs_main_interpret(minst, &initial_file, user_er...
0
2,903
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: base::FilePath GetBlacklistPath() { base::FilePath blacklist_dir; base::PathService::Get(chrome::DIR_USER_DATA, &blacklist_dir); return blacklist_dir.AppendASCII(kBlacklistFilename); } Commit Message: [signin] Add metrics to track the source for refresh token updated events This CL add a source for update...
0
143,087
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void flush_echoes(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; if ((!L_ECHO(tty) && !L_ECHONL(tty)) || ldata->echo_commit == ldata->echo_head) return; mutex_lock(&ldata->output_lock); ldata->echo_commit = ldata->echo_head; __process_echoes(tty); mutex_unlock(&ldata->o...
0
39,792
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int ClipByte(int value) { if (value > 255) return 255; else if (value < 0) return 0; return value; } Commit Message: Merge Conflict Fix CL to lmp-mr1-release for ag/849478 DO NOT MERGE - libvpx: Pull from upstream Current HEAD: 7105df53d7dc13d5e575bc8df714ec8d1da36b06 BUG=23452792 Change-Id: Ic...
0
164,467
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey) { return ASN1_d2i_bio_of(EC_KEY,EC_KEY_new,d2i_ECPrivateKey,bp,eckey); } Commit Message: Fix various certificate fingerprint issues. By using non-DER or invalid encodings outside the signed portion of a certificate the fingerprint can be changed without b...
0
94,639
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) { TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnCommandBufferCreated"); if (!create_command_buffer_requests_.empty()) { CreateCommandBufferCallback callback = create_command_buffer_requests_.front(); create_command_buffer_reques...
0
102,965
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void CWebServer::GetFloorplanImage(WebEmSession & session, const request& req, reply & rep) { std::string idx = request::findValue(&req, "idx"); if (idx == "") { return; } std::vector<std::vector<std::string> > result; result = m_sql.safe_queryBlob("SELECT Image FROM Floorplans WHERE ID=...
1
169,714
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void CreateUIRequest(const std::string& requested_audio_device_id, const std::string& requested_video_device_id) { DCHECK(!ui_request_); target_process_id_ = requesting_process_id; target_frame_id_ = requesting_frame_id; ui_request_.reset(new MediaStreamRequest( re...
0
153,167
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: record_peer_stats( sockaddr_u *addr, int status, double offset, /* offset */ double delay, /* delay */ double dispersion, /* dispersion */ double jitter /* jitter */ ) { l_fp now; u_long day; if (!stats_control) return; get_systime(&now); filegen_setup(&peerstats, now.l_ui); day = now.l_ui / 8...
0
74,226
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Register(aura::Window* window) { window->AddObserver(this); auto policy = window->event_targeting_policy(); window->SetEventTargetingPolicy(aura::EventTargetingPolicy::kNone); policy_map_.emplace(window, policy); for (auto* child : window->children()) Register(child); } Commit ...
0
137,704
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, netdev_features_t features) { struct sk_buff *segs = ERR_PTR(-EINVAL); unsigned int mss; unsigned int unfrag_ip6hlen, unfrag_len; struct frag_hdr *fptr; u8 *packet_start, *prevhdr; u8 nexthdr; u8 frag_hdr_sz = sizeof(struct frag_hdr); int...
1
165,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'.
Code: Ins_ISECT( INS_ARG ) { FT_UShort point, a0, a1, b0, b1; FT_F26Dot6 discriminant; FT_F26Dot6 dx, dy, dax, day, dbx, dby; FT_F26Dot6 val; FT_Vector R; point = (FT_UShort)args[0]; a0 = (FT_UShort)args[1]; ...
0
10,119
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr) { struct kvm *kvm = vcpu->kvm; u64 offset, ns, elapsed; unsigned long flags; s64 usdiff; bool matched; bool already_matched; u64 data = msr->data; raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags); offset = kvm_x86_ops->compute_tsc_of...
0
35,815
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GIFColorMap::buildTable(const unsigned char* data, size_t length) { if (!m_isDefined || !m_table.isEmpty()) return; RELEASE_ASSERT(m_position + m_colors * BYTES_PER_COLORMAP_ENTRY <= length); const unsigned char* srcColormap = data + m_position; m_table.resize(m_colors); for (Tab...
0
129,091
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ebt_get_udc_positions(struct ebt_entry *e, struct ebt_table_info *newinfo, unsigned int *n, struct ebt_cl_stack *udc) { int i; /* we're only interested in chain starts */ if (e->bitmask) return 0; for (i = 0; i < NF_BR_NUMHOOKS; i++) { if (newinfo->hook_entry[i] == (struct ebt_entries *)e) bre...
0
84,868
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Browser::ShowKeyboardOverlay() { window_->ShowKeyboardOverlay(window_->GetNativeHandle()); } 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 NSVi...
0
97,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'.
Code: uint32_t OMXCodec::getComponentQuirks( const sp<MediaCodecInfo> &info) { uint32_t quirks = 0; if (info->hasQuirk("requires-allocate-on-input-ports")) { quirks |= kRequiresAllocateBufferOnInputPorts; } if (info->hasQuirk("requires-allocate-on-output-ports")) { quirks |= kRequiresAllocateBuffer...
0
158,165
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AppCacheStorageImpl* storage() { return static_cast<AppCacheStorageImpl*>(service()->storage()); } Commit Message: Reland "AppCache: Add padding to cross-origin responses." This is a reland of 85b389caa7d725cdd31f59e9a2b79ff54804b7b7 Initialized CacheRecord::padding_size to 0. Original change's descri...
0
151,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'.
Code: static inline void perf_tp_register(void) { perf_pmu_register(&perf_tracepoint, "tracepoint", PERF_TYPE_TRACEPOINT); } 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 st...
0
26,180
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VIR_UUID_DEBUG(conn, uuid); virResetLastError(); virCheckConnectReturn(conn, NULL); virCheckNonNullArgGoto(uuid, error); if (conn->driver->domainLookupByUUID) { virDomainPtr ret; ret = conn->driver->domai...
0
93,842
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: get_random_number () { int rv, pid; /* Reset for command and process substitution. */ pid = getpid (); if (subshell_environment && seeded_subshell != pid) { seedrand (); seeded_subshell = pid; } do rv = brand (); while (rv == last_random_value); return rv; } Commit Message...
0
17,341
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void user_free_preparse(struct key_preparsed_payload *prep) { kfree(prep->payload[0]); } Commit Message: KEYS: Remove key_type::match in favour of overriding default by match_preparse A previous patch added a ->match_preparse() method to the key type. This is allowed to override the function called by the ite...
0
69,558
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) { if (!m_element || !ATK_IS_OBJECT(m_element)) return 0; Vector<RefPtr<AccessibilityUIElement> > children; getChildren(children); unsigned count = children.size(); for (unsigned i = 0; i < count; i++) ...
0
106,359
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: find_file (const char *currpath, grub_fshelp_node_t currroot, grub_fshelp_node_t *currfound, struct grub_fshelp_find_file_closure *c) { #ifndef _MSC_VER char fpath[grub_strlen (currpath) + 1]; #else char *fpath = grub_malloc (grub_strlen (currpath) + 1); #endif char *name = fpath; char *next; ...
1
168,089
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void raptor_rdfa_character_data(void *user_data, raptor_xml_element* xml_element, const unsigned char *s, int len) { character_data(user_data, (const char *)s, len); } Commit Message: CVE-2012-0037 Enforce entity loading poli...
0
21,939
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int wp512_update(struct shash_desc *desc, const u8 *source, unsigned int len) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int sourcePos = 0; unsigned int bits_len = len * 8; // convert to number of bits int sourceGap = (8 - ((int)bits_len & 7)) & 7; int bufferRem = wctx->bufferBits &...
0
47,409
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static storeProc storeProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbStore_a8r8g8b8; case PICT_x8r8g8b8: return fbStore_x8r8g8b8; case PICT_a8b8g8r8: return fbStore_a8b8g8r8; case PICT_x8b8g8r8: return fbStore_x8b8g8r8; /* 24bpp formats */ c...
0
11,497
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BlinkTestRunner::OnSessionHistory( const std::vector<int>& routing_ids, const std::vector<std::vector<PageState>>& session_histories, const std::vector<unsigned>& current_entry_indexes) { routing_ids_ = routing_ids; session_histories_ = session_histories; current_entry_indexes_ = current_en...
0
123,576
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void addjump(JF, enum js_AstType type, js_Ast *target, int inst) { js_JumpList *jump = js_malloc(J, sizeof *jump); jump->type = type; jump->inst = inst; jump->next = target->jumps; target->jumps = jump; } Commit Message: CWE ID: CWE-476
0
7,890
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void UpdateDownloadCheckStats(SBStatsType stat_type) { UMA_HISTOGRAM_ENUMERATION("SB2.DownloadChecks", stat_type, DOWNLOAD_CHECKS_MAX); } Commit Message: Add the SandboxedDMGParser and wire it up to the DownloadProtectionService. BUG=496898,464...
0
123,762
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebGraphicsContext3DCommandBufferImpl::releaseShaderCompiler() { } 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-d872f20...
0
106,835
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct object_entry *new_object(unsigned char *sha1) { struct object_entry *e; if (blocks->next_free == blocks->end) alloc_objects(object_entry_alloc); e = blocks->next_free++; hashcpy(e->idx.sha1, sha1); return e; } Commit Message: prefer memcpy to strcpy When we already know the length of a st...
0
55,089
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: u32 skb_get_poff(const struct sk_buff *skb) { struct flow_keys keys; if (!skb_flow_dissect_flow_keys(skb, &keys)) return 0; return __skb_get_poff(skb, skb->data, &keys, skb_headlen(skb)); } Commit Message: flow_dissector: Jump to exit code in __skb_flow_dissect Instead of returning immediately (on a pars...
0
61,969
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: IntRect RenderLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const { RenderView* view = box().view(); if (!view) return parentRect; IntRect rect = view->frameView()->convertToRenderer(box(), parentRect); rect.move(-scrollba...
0
119,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'.
Code: mrb_get_argv(mrb_state *mrb) { mrb_int argc = mrb->c->ci->argc; mrb_value *array_argv; if (argc < 0) { struct RArray *a = mrb_ary_ptr(mrb->c->stack[1]); array_argv = ARY_PTR(a); } else { array_argv = NULL; } return array_argv; } Commit Message: `mrb_class_real()` did not work for `Basi...
0
82,094
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::suspendScriptedAnimationControllerCallbacks() { #if ENABLE(REQUEST_ANIMATION_FRAME) if (m_scriptedAnimationController) m_scriptedAnimationController->suspend(); #endif } Commit Message: Unreviewed, rolling out r147402. http://trac.webkit.org/changeset/147402 https://bugs.webkit.org/sho...
0
105,640
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void red_client_add_channel(RedClient *client, RedChannelClient *rcc) { spice_assert(rcc && client); ring_add(&client->channels, &rcc->client_link); if (client->during_target_migrate && client->seamless_migrate) { red_channel_client_set_migration_seamless(rcc); } client->channel...
0
2,186
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: pathcmp(const char *a, const char *b) { /* Skip leading './' */ if (a[0] == '.' && a[1] == '/' && a[2] != '\0') a += 2; if (b[0] == '.' && b[1] == '/' && b[2] != '\0') b += 2; /* Find the first difference, or return (0) if none. */ while (*a == *b) { if (*a == '\0') return (0); a++; b++; } /* ...
0
73,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'.
Code: static void op32_tx_resume(struct b43_dmaring *ring) { b43_dma_write(ring, B43_DMA32_TXCTL, b43_dma_read(ring, B43_DMA32_TXCTL) & ~B43_DMA32_TXSUSPEND); } Commit Message: b43: allocate receive buffers big enough for max frame len + offset Otherwise, skb_put inside of dma_rx can fail... https://bugzil...
0
24,561
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC) { zval **val, *converted = NULL; char buf[256]; char *fld; smart_str querystr = {0}; int key_type, ret = FAILURE; uint fld_len; ulong num_idx; HashPosition pos; assert(pg_link != NULL...
0
15,240
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void setHorizontalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy) { webView->priv->horizontalScrollingPolicy = policy; gtk_widget_queue_resize(GTK_WIDGET(webView)); } Commit Message: 2011-06-02 Joone Hur <joone.hur@collabora.co.uk> Reviewed by Martin Robinson. ...
0
100,507
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static unsigned int rtnl_dev_get_flags(const struct net_device *dev) { return (dev->flags & ~(IFF_PROMISC | IFF_ALLMULTI)) | (dev->gflags & (IFF_PROMISC | IFF_ALLMULTI)); } Commit Message: rtnl: fix info leak on RTM_GETLINK request for VF devices Initialize the mac address buffer with 0 as the driver s...
0
31,036
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ConnectionInfoPopupAndroid::ConnectionInfoPopupAndroid( JNIEnv* env, jobject java_website_settings_pop, WebContents* web_contents) { content::NavigationEntry* nav_entry = web_contents->GetController().GetVisibleEntry(); if (nav_entry == NULL) return; popup_jobject_.Reset(env, java_web...
1
171,777
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void usb_xhci_init(XHCIState *xhci) { DeviceState *dev = DEVICE(xhci); XHCIPort *port; int i, usbports, speedmask; xhci->usbsts = USBSTS_HCH; if (xhci->numports_2 > MAXPORTS_2) { xhci->numports_2 = MAXPORTS_2; } if (xhci->numports_3 > MAXPORTS_3) { xhci->numpor...
0
5,674
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int tracer_tracing_is_on(struct trace_array *tr) { if (tr->trace_buffer.buffer) return ring_buffer_record_is_on(tr->trace_buffer.buffer); return !tr->buffer_disabled; } Commit Message: Merge tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull tracing fixes from St...
0
81,448
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struct nfs4_delegreturnargs *args) { struct xdr_stream xdr; struct compound_hdr hdr = { .nops = 3, }; int status; xdr_init_encode(&xdr, &req->rq_snd_buf, p); encode_compound_hdr(&xdr, &hdr); status = encode_putfh(&xdr, args->fhan...
0
23,134
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: mc_clear_all(mrb_state *mrb) { struct mrb_cache_entry *mc = mrb->cache; int i; for (i=0; i<MRB_METHOD_CACHE_SIZE; i++) { mc[i].c = 0; } } Commit Message: `mrb_class_real()` did not work for `BasicObject`; fix #4037 CWE ID: CWE-476
0
82,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'.
Code: void j2k_dump(opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) { /* Check if the flag is compatible with j2k file*/ if ((flag & OPJ_JP2_INFO) || (flag & OPJ_JP2_IND)) { fprintf(out_stream, "Wrong flag\n"); return; } /* Dump the image_header */ if (flag & OPJ_IMG_INFO) { ...
0
61,681
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void NavigationRequest::OnRequestFailed( const network::URLLoaderCompletionStatus& status) { bool collapse_frame = status.extended_error_code == static_cast<int>(blink::ResourceRequestBlockedReason::kCollapsedByClient); OnRequestFailedInternal(status, false /* skip_throttles */, ...
0
132,953
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: vips_foreign_operation_init( void ) { extern GType vips_foreign_load_rad_get_type( void ); extern GType vips_foreign_save_rad_file_get_type( void ); extern GType vips_foreign_save_rad_buffer_get_type( void ); extern GType vips_foreign_load_mat_get_type( void ); extern GType vips_foreign_load_ppm_get_type...
0
83,912
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { int ret; if (input == NULL) return(-1); if (xmlParserDebugEntities) { if ((ctxt->input != NULL) && (ctxt->input->filename)) xmlGenericError(xmlGenericErrorContext, "%s(%d): ", ctxt->input->filename, ctxt->input->line); xmlGenericErro...
0
163,510
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void cmd_parse_enabled(struct ImapData *idata, const char *s) { mutt_debug(2, "Handling ENABLED\n"); while ((s = imap_next_word((char *) s)) && *s != '\0') { if ((mutt_str_strncasecmp(s, "UTF8=ACCEPT", 11) == 0) || (mutt_str_strncasecmp(s, "UTF8=ONLY", 9) == 0)) { idata->unicod...
0
79,555
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int phar_test_compression(void *pDest, void *argument TSRMLS_DC) /* {{{ */ { phar_entry_info *entry = (phar_entry_info *)pDest; if (entry->is_deleted) { return ZEND_HASH_APPLY_KEEP; } if (!PHAR_G(has_bz2)) { if (entry->flags & PHAR_ENT_COMPRESSED_BZ2) { *(int *) argument = 0; } } if (!PHA...
0
4,437
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool LayerTreeHostImpl::Mutate(base::TimeTicks monotonic_time) { if (!mutator_) return false; TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::Mutate"); if (mutator_->Mutate(monotonic_time, active_tree())) client_->SetNeedsOneBeginImplFrameOnImplThread(); return true; } Commit Message: (Rela...
0
137,299
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SessionService::UpdateSelectedTabIndex( std::vector<SessionWindow*>* windows) { for (std::vector<SessionWindow*>::const_iterator i = windows->begin(); i != windows->end(); ++i) { int new_index = 0; for (std::vector<SessionTab*>::const_iterator j = (*i)->tabs.begin(); j != (*i)->...
0
108,851
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int armpmu_event_init(struct perf_event *event) { struct arm_pmu *armpmu = to_arm_pmu(event->pmu); int err = 0; atomic_t *active_events = &armpmu->active_events; if (armpmu->map_event(event) == -ENOENT) return -ENOENT; event->destroy = hw_perf_event_destroy; if (!atomic_inc_not_zero(active_event...
0
56,186
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static bool ParseJsonPath( const std::string& path, std::string* command, std::string* target_id) { if (path.empty()) { *command = "list"; return true; } if (!base::StartsWith(path, "/", base::CompareCase::SENSITIVE)) { return false; } *command = path.substr(1); size_t separ...
0
148,262
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void fz_find_color_converter(fz_context *ctx, fz_color_converter *cc, const fz_colorspace *is, const fz_colorspace *ds, const fz_colorspace *ss, const fz_color_params *params) { if (ds == NULL) ds = fz_device_gray(ctx); if (ss == NULL) ss = fz_device_gray(ctx); cc->ds = ds; cc->ss = ss; cc->is = is; cc-...
0
377
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int TextDistance(const PositionInFlatTree& start, const PositionInFlatTree& end) { return TextIteratorInFlatTree::RangeLength( start, end, TextIteratorBehavior::AllVisiblePositionsRangeLengthBehavior()); } Commit Message: Move SelectionTemplate::is_handle_visible_ to ...
0
124,942
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void whiteheat_close(struct usb_serial_port *port) { firm_report_tx_done(port); firm_close(port); usb_serial_generic_close(port); stop_command_port(port->serial); } Commit Message: USB: whiteheat: Added bounds checking for bulk command response This patch fixes a potential security issue in the whi...
0
38,097
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void snro_del(GF_Box *s) { GF_SeqOffHintEntryBox *snro = (GF_SeqOffHintEntryBox *)s; gf_free(snro); } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,422
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Element::scrollIntoView(bool alignToTop) { document()->updateLayoutIgnorePendingStylesheets(); if (!renderer()) return; LayoutRect bounds = boundingBox(); if (alignToTop) renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTop...
0
112,365
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, unsigned int codec_data_size, const uint8_t *mime) { unsigned int v; int size; int64_t codec_pos; int ret; if (codec_data_size > INT_MAX)...
0
61,844
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) { uint32_t bmlen; __be32 *p; p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) goto out_overflow; bmlen = be32_to_cpup(p); bitmap[0] = bitmap[1] = bitmap[2] = 0; p = xdr_inline_decode(xdr, (bmlen << 2)); if (unlikely(!p)) goto ou...
0
23,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'.
Code: deep_count_more_files_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { DeepCountState *state; NautilusDirectory *directory; GList *files, *l; GFileInfo *info; state = user_data; if (state-...
0
60,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'.
Code: void smbd_setup_sig_term_handler(void) { struct tevent_signal *se; se = tevent_add_signal(smbd_event_context(), smbd_event_context(), SIGTERM, 0, smbd_sig_term_handler, NULL); if (!se) { exit_server("failed to setup SIGTERM handler"); } } Commit Message: CWE ID:
0
11,083
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int em_sysenter(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; u64 efer = 0; ops->get_msr(ctxt, MSR_EFER, &efer); /* inject #GP if in real mode */ if (ctxt->mode == X86EMUL_MODE_REAL) return emulate_gp(...
0
35,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'.
Code: bool PDFiumEngine::New(const char* url, const char* headers) { url_ = url; if (headers) headers_ = headers; else headers_.clear(); return true; } Commit Message: [pdf] Use a temporary list when unloading pages When traversing the |deferred_page_unloads_| list and handling the unloads it's possib...
0
146,167
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int file_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset, unsigned long size) { char *kaddr; unsigned long left, count = desc->count; if (size > count) size = count; /* * Faults on the destination of a read are common, so do it before * taking the kmap. */ if (!fault_...
0
58,796
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void dref_del(GF_Box *s) { GF_DataReferenceBox *ptr = (GF_DataReferenceBox *) s; if (ptr == NULL) return; gf_free(ptr); } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,070
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void __init config_types(void) { bool has_drive = false; int drive; /* read drive info out of physical CMOS */ drive = 0; if (!UDP->cmos) UDP->cmos = FLOPPY0_TYPE; drive = 1; if (!UDP->cmos && FLOPPY1_TYPE) UDP->cmos = FLOPPY1_TYPE; /* FIXME: additional physical CMOS drive detection should go...
0
39,332
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void __d_drop(struct dentry *dentry) { if (!d_unhashed(dentry)) { struct hlist_bl_head *b; /* * Hashed dentries are normally on the dentry hashtable, * with the exception of those newly allocated by * d_obtain_alias, which are always IS_ROOT: */ if (unlikely(IS_ROOT(dentry))) b = &dentry->d_...
0
67,265
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool SharedWorkerDevToolsAgentHost::Matches(SharedWorkerHost* worker_host) { return instance_->Matches(*worker_host->instance()); } Commit Message: DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to reso...
0
148,734
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) { struct uvesafb_task *utask; struct uvesafb_ktask *task; if (!capable(CAP_SYS_ADMIN)) return; if (msg->seq >= UVESAFB_TASKS_MAX) return; mutex_lock(&uvfb_lock); task = uvfb_tasks[msg->seq]; if (!task || msg->ack != ...
0
79,772
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Read(gfx::mojom::BufferUsageAndFormatDataView data, gfx::BufferUsageAndFormat* out) { return data.ReadUsage(&out->usage) && data.ReadFormat(&out->format); } Commit Message: Correct mojo::WrapSharedMemoryHandle usage Fixes some incorrect uses of mojo::WrapSharedMemoryHandle which were assuming tha...
0
149,629
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen(ParserSynchronizationPolicy parserSyncPolicy) { cancelParsing(); removeChildren(); ASSERT(!m_focusedElement); setCompatibilityMode(NoQuirksMode); if (!threadedParsingEnabledForTesting()) parserSyncPolicy = ForceSynchronou...
0
125,297
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp, struct list_head *invalid_list) { int ret; trace_kvm_mmu_prepare_zap_page(sp); ++kvm->stat.mmu_shadow_zapped; ret = mmu_zap_unsync_children(kvm, sp, invalid_list); kvm_mmu_page_unlink_children(kvm, sp); kvm_mmu_unlink_par...
0
37,481
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: dtoieee(double *dp) { double_t num; double x; int exp; num.d = *dp; if (!num.d) { /* Zero is just binary all zeros */ num.l[0] = num.l[1] = 0; return; } if (num.d < 0) { /* Sign is encoded separately */ num.d = -num.d; num.ieee.sign = 1; } else { num.ieee.sign = 0; } /* Now separate the ...
0
86,797
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebGL2RenderingContextBase::uniform2fv( const WebGLUniformLocation* location, const FlexibleFloat32ArrayView& v, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformParameters<WTF::Float32Array>("uniform2fv", location, v, ...
0
133,502
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SyncTest::TriggerBirthdayError() { ASSERT_TRUE(ServerSupportsErrorTriggering()); std::string path = "chromiumsync/birthdayerror"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Birthday error", UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle()));...
0
105,070
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr) { return evdns_base_resolve_ipv4(current_base, name, flags, callback, ptr) ? 0 : -1; } Commit Message: evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the ...
0
70,632
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ActivateViewForTextInputManager(RenderWidgetHostViewBase* view, ui::TextInputType type) { DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, type); if (render_widget_host_delegate()->GetFocusedRenderWidgetHost( widget_host_) != view->GetRenderWidgetHost()) { ...
0
145,579
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt, int tag, int iclass) { int i, ret, flags, ttag, tclass, ndef; flags = tt->flags; /* * Work out tag and class to use: tagging may come either from the * template or...
0
12,845
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void nfs40_call_sync_done(struct rpc_task *task, void *calldata) { struct nfs4_call_sync_data *data = calldata; nfs4_sequence_done(task, data->seq_res); } Commit Message: NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client ---Steps to Reproduce-- <nfs-server> # cat /etc/export...
0
57,070
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void AddScheme(const std::string& scheme) { schemes_.insert(scheme); } Commit Message: Apply missing kParentDirectory check BUG=161564 Review URL: https://chromiumcodereview.appspot.com/11414046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168692 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
102,445
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderViewImpl::DidCompletePageScaleAnimation() { if (auto* focused_frame = GetWebView()->FocusedFrame()) { if (focused_frame->AutofillClient()) focused_frame->AutofillClient()->DidCompleteFocusChangeInFrame(); } } Commit Message: If a page calls |window.focus()|, kick it out of fullscreen. B...
0
147,963
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: dealloc_ofp_port(struct ofproto *ofproto, ofp_port_t ofp_port) { if (ofp_to_u16(ofp_port) < ofproto->max_ports) { ofport_set_usage(ofproto, ofp_port, time_msec()); } } Commit Message: ofproto: Fix OVS crash when reverting old flows in bundle commit During bundle commit flows which are added in b...
0
77,220
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs_lockt_args *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, a...
0
23,473
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: channel_lookup(int id) { Channel *c; if ((c = channel_by_id(id)) == NULL) return (NULL); switch (c->type) { case SSH_CHANNEL_X11_OPEN: case SSH_CHANNEL_LARVAL: case SSH_CHANNEL_CONNECTING: case SSH_CHANNEL_DYNAMIC: case SSH_CHANNEL_OPENING: case SSH_CHANNEL_OPEN: case SSH_CHANNEL_INPUT_DRAINING: ca...
0
2,246
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GahpClient::nordugrid_exit_info(const char *hostname, const char *job_id, bool &normal_exit, int &exit_code, float &wallclock, float &sys_cpu, float &user_cpu ) { static const char* command = "NORDUGRID_EXIT_INFO"; if (server->m_commands_supported->contains_anycase(command)==FALSE) { ...
0
16,213