instruction
stringclasses
1 value
input
stringlengths
64
129k
output
int64
0
1
__index_level_0__
int64
0
30k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void pixel_format_message (VncState *vs) { char pad[3] = { 0, 0, 0 }; vs->client_pf = qemu_default_pixelformat(32); vnc_write_u8(vs, vs->client_pf.bits_per_pixel); /* bits-per-pixel */ vnc_write_u8(vs, vs->client_pf.depth); /* depth */ #ifdef HOST_WORDS_BIGENDIAN vnc_write_u8(vs, 1);...
0
14,624
Analyze the following 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 ap_uevent (struct device *dev, struct kobj_uevent_env *env) { struct ap_device *ap_dev = to_ap_dev(dev); int retval = 0; if (!ap_dev) return -ENODEV; /* Set up DEV_TYPE environment variable. */ retval = add_uevent_var(env, "DEV_TYPE=%04X", ap_dev->device_type); if (retval) return retval; ...
0
16,486
Analyze the following 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 CNBL::CompleteMappedBuffers() { m_MappedBuffers.ForEachDetached([this](CNB *NB) { NBComplete(); CNB::Destroy(NB, m_Context->MiniportHandle); ...
0
3,381
Analyze the following 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 CheckForMagicNumbers(const char* content, size_t size, const MagicNumber* magic, size_t magic_len, std::string* result) { for (size_t i = 0; i < magic_len; ++i) { if (MatchMagicNumber(content, size, magic[i], result)) return...
0
18,682
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WORD32 ih264d_unpack_coeff8x8_8x8blk_cavlc(dec_struct_t * ps_dec, dec_mb_info_t * ps_cur_mb_info, UWORD16 ui2_luma_csbp, WORD16 *pi2_out_coeff_data) { UWORD8 *pu1_inv_scan; UWORD8 u1_mb_field_decoding_flag = ps_cur_mb...
0
11,472
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: virtual void SetupContext(URLRequestContext* context) { context->set_ssl_config_service( new TestSSLConfigService(true /* check for EV */, true /* online revocation checking */)); } Commit Message: Tests were marked as Flaky. BUG=151811,151810 TBR=droger@chromium...
0
11,669
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params, GLsizei params_size) { DCHECK(params); GLsizei num_written = 0; if (state_.GetStateAsGLfloat(pname, params, &num_written)) { DCHECK_EQ(num_written, params_size); re...
0
9,689
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void tg3_phy_stop(struct tg3 *tp) { if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) return; phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); } Commit Message: tg3: fix length overflow in VPD firmware parsing Commit 184b89044fb6e2a74611dafa69b1dce0d98612c6 ("tg3: Use VPD fw version when present") i...
0
27,533
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: size_t sc_right_trim(u8 *buf, size_t len) { size_t i; if (!buf) return 0; if (len > 0) { for(i = len-1; i > 0; i--) { if(!isprint(buf[i])) { buf[i] = '\0'; len--; continue; } break; } } return len; } Commit Message: fixed out of bounds writes Thanks to Eric Sesterhenn from X41...
0
17,962
Analyze the following 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 pstore *get_info(struct dm_exception_store *store) { return (struct pstore *) store->context; } Commit Message: dm snapshot: fix data corruption This patch fixes a particular type of data corruption that has been encountered when loading a snapshot's metadata from disk. When we allocate a new ch...
0
24,656
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { if (!frame_->hasSelection()) return; frame_->replaceMisspelledRange(text); } Commit Message: Add logging to figure out which IPC we're failing to deserialize in RenderFrame. BUG=369553 R=creis@chromium.org Review URL: https://cod...
0
7,076
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int dcbnl_getpfccfg(struct net_device *netdev, struct nlmsghdr *nlh, u32 seq, struct nlattr **tb, struct sk_buff *skb) { struct nlattr *data[DCB_PFC_UP_ATTR_MAX + 1], *nest; u8 value; int ret; int i; int getall = 0; if (!tb[DCB_ATTR_PFC_CFG]) return -EINVAL; if (!netdev->dcbnl_ops->getpfcc...
0
16,270
Analyze the following 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 int unicode_cp_is_allowed(unsigned uni_cp, int document_type) { /* XML 1.0 HTML 4.01 HTML 5 * 0x09..0x0A 0x09..0x0A 0x09..0x0A * 0x0D 0x0D 0x0C..0x0D * 0x0020..0xD7FF 0x20..0x7E 0x20..0x7E * 0x00A0..0xD7FF 0x00A0..0xD7FF * 0xE000..0xFFFD 0xE000..0x10FFFF 0xE000.....
1
10,615
Analyze the following 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 __init sparc64_has_md5_opcode(void) { unsigned long cfr; if (!(sparc64_elf_hwcap & HWCAP_SPARC_CRYPTO)) return false; __asm__ __volatile__("rd %%asr26, %0" : "=r" (cfr)); if (!(cfr & CFR_MD5)) return false; return true; } Commit Message: crypto: prefix module autoloading with "crypto-" T...
0
13,099
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool jsvIsBasicString(const JsVar *v) { return v && (v->flags&JSV_VARTYPEMASK)>=JSV_STRING_0 && (v->flags&JSV_VARTYPEMASK)<=JSV_STRING_MAX; } ///< Just a string (NOT a name) Commit Message: fix jsvGetString regression CWE ID: CWE-119
0
7,375
Analyze the following 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 commit *get_revision_1(struct rev_info *revs) { if (!revs->commits) return NULL; do { struct commit_list *entry = revs->commits; struct commit *commit = entry->item; revs->commits = entry->next; free(entry); if (revs->reflog_info) { save_parents(revs, commit); fake_reflog_pare...
0
12,892
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gpc_unpc(Pixel *out, const Pixel *in, const Background *back) { (void)back; if (in->a <= 128) { out->r = out->g = out->b = 255; out->a = 0; } else { out->r = sRGB((double)in->r / in->a); out->g = sRGB((double)in->g / in->a); out->b = sRGB((double)in->b / in->a); out->a ...
0
26,328
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { Jpeg2000DecoderContext *s = avctx->priv_data; ThreadFrame frame = { .f = data }; AVFrame *picture = data; int tileno, ret; s->avctx = avctx; bytestre...
0
11,355
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: BluetoothSocketSendFunction::~BluetoothSocketSendFunction() {} Commit Message: chrome.bluetoothSocket: Fix regression in send() In https://crrev.com/c/997098, params_ was changed to a local variable, but it needs to last longer than that since net::WrappedIOBuffer may use the data after the local variable goes ...
0
3,108
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: size_t BaseArena::objectPayloadSizeForTesting() { ASSERT(isConsistentForGC()); ASSERT(!m_firstUnsweptPage); size_t objectPayloadSize = 0; for (BasePage* page = m_firstPage; page; page = page->next()) objectPayloadSize += page->objectPayloadSizeForTesting(); return objectPayloadSize; } Commit Messa...
0
14,292
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AXObject* AXNodeObject::computeParentIfExists() const { if (Node* parentNode = getParentNodeForComputeParent(getNode())) return axObjectCache().get(parentNode); return nullptr; } Commit Message: Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview...
0
26,766
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: struct rb_entry *__lookup_rb_tree_ret(struct rb_root *root, struct rb_entry *cached_re, unsigned int ofs, struct rb_entry **prev_entry, struct rb_entry **next_entry, struct rb_node ***insert_p, struct rb_node **insert_parent, bool force) { struct rb_node **pnode = &root->rb_node; str...
0
24,940
Analyze the following 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 ChromeContentBrowserClient::AllowCertificateError( SSLCertErrorHandler* handler, bool overridable, Callback2<SSLCertErrorHandler*, bool>::Type* callback) { TabContents* tab = tab_util::GetTabContentsByID( handler->render_process_host_id(), handler->tab_contents_id()); if (!tab) { ...
0
20,678
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: openssl_dec(const EVP_CIPHER * cipher, const unsigned char *key, const unsigned char *iv, const unsigned char *input, size_t length, unsigned char *output) { int r = SC_ERROR_INTERNAL; EVP_CIPHER_CTX * ctx = NULL; int outl = 0; int outl_tmp = 0; unsigned char iv_tmp[EVP_MAX_IV_LENGTH] = { 0 }; memcpy(iv_...
0
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: PHP_FUNCTION(strripos) { zval *zneedle; zend_string *needle; zend_string *haystack; zend_long offset = 0; char *p, *e; char *found; zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; ALLOCA_FLAG(use_heap); if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &haystack, &zneedle, &offset) == FAIL...
0
26,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: poly_above(PG_FUNCTION_ARGS) { POLYGON *polya = PG_GETARG_POLYGON_P(0); POLYGON *polyb = PG_GETARG_POLYGON_P(1); bool result; result = polya->boundbox.low.y > polyb->boundbox.high.y; /* * Avoid leaking memory for toasted inputs ... needed for rtree indexes */ PG_FREE_IF_COPY(polya, 0); PG_FREE...
0
12,823
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: error::Error GLES2DecoderImpl::HandleVertexAttribPointer( uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { if (!bound_array_buffer_ || bound_array_buffer_->IsDeleted()) { SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer: no array buffer bound"); return error::kNoE...
0
13,441
Analyze the following 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 vmx_inject_nmi(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); if (is_guest_mode(vcpu)) return; if (!cpu_has_virtual_nmis()) { /* * Tracking the NMI-blocked state in software is built upon * finding the next open IRQ window. This, in turn, depends on * well-behaving gue...
0
17,836
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void NaClProcessHost::OnChannelConnected(int32 peer_pid) { if (!CommandLine::ForCurrentProcess()->GetSwitchValuePath( switches::kNaClGdb).empty()) { base::ProcessHandle process; DCHECK(process_->GetData().handle == base::kNullProcessHandle); if (base::OpenProcessHandleWithAccess( ...
0
1,174
Analyze the following 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::processReferrerPolicy(const String& policy) { ASSERT(!policy.isNull()); m_referrerPolicy = ReferrerPolicyDefault; if (equalIgnoringCase(policy, "never")) m_referrerPolicy = ReferrerPolicyNever; else if (equalIgnoringCase(policy, "always")) m_referrerPolicy = Referr...
0
6,077
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: display_cache_file(struct display *dp, const char *filename) /* Does the initial cache of the file. */ { FILE *fp; int ret; dp->filename = filename; if (filename != NULL) { fp = fopen(filename, "rb"); if (fp == NULL) display_log(dp, USER_ERROR, "open failed: %s", strerror(errno)); } e...
0
24,314
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int req_ssl_is_https_field(request_rec *r) { return ap_lua_ssl_is_https(r->connection); } Commit Message: *) SECURITY: CVE-2015-0228 (cve.mitre.org) mod_lua: A maliciously crafted websockets PING after a script calls r:wsupgrade() can cause a child process crash. [Edward Lu <Chaosed0 ...
0
12,911
Analyze the following 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 drain_stock(struct memcg_stock_pcp *stock) { struct mem_cgroup *old = stock->cached; if (stock->nr_pages) { unsigned long bytes = stock->nr_pages * PAGE_SIZE; res_counter_uncharge(&old->res, bytes); if (do_swap_account) res_counter_uncharge(&old->memsw, bytes); stock->nr_pages = 0; } ...
0
19,688
Analyze the following 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_io_set_close_on_exec(mrb_state *mrb, mrb_value self) { #if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) struct mrb_io *fptr; int flag, ret; mrb_bool b; fptr = io_get_open_fptr(mrb, self); mrb_get_args(mrb, "b", &b); flag = b ? FD_CLOEXEC : 0; if (fptr->fd2 >= 0) { if ((ret =...
0
210
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: LayerListIterator<Layer> LayerTreeHost::begin() const { return LayerListIterator<Layer>(root_layer_.get()); } 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 th...
0
5,274
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SSLPolicyTestCommittedInterstitials() {} Commit Message: Enforce the WebUsbAllowDevicesForUrls policy This change modifies UsbChooserContext to use the UsbAllowDevicesForUrls class to consider devices allowed by the WebUsbAllowDevicesForUrls policy. The WebUsbAllowDevicesForUrls policy overrides the other Web...
0
14,746
Analyze the following 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 cgroup_meta_data *lxc_cgroup_load_meta() { const char *cgroup_use = NULL; char **cgroup_use_list = NULL; struct cgroup_meta_data *md = NULL; int saved_errno; errno = 0; cgroup_use = lxc_global_config_value("lxc.cgroup.use"); if (!cgroup_use && errno != 0) return NULL; if (cgroup_use) { ...
0
26,769
Analyze the following 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 disable_net_traffic(pegasus_t *pegasus) { __le16 tmp = cpu_to_le16(0); set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp); } Commit Message: pegasus: Use heap buffers for all register access Allocating USB buffers on the stack is not portable, and no longer works on x86_64 (with VMAP_STAC...
0
22,004
Analyze the following 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 clear_empty_dir(struct ctl_dir *dir) { dir->header.ctl_table[0].child = NULL; } Commit Message: sysctl: Drop reference added by grab_header in proc_sys_readdir Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any p...
0
19,707
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: __archive_write_close_filter(struct archive_write_filter *f) { if (f->close != NULL) return (f->close)(f); if (f->next_filter != NULL) return (__archive_write_close_filter(f->next_filter)); return (ARCHIVE_OK); } Commit Message: Limit write requests to at most INT_MAX. This prevents a certain common progr...
0
8,743
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample) { cmsIT8* it8 = (cmsIT8*)h; return SetDataFormat(it8, n, Sample); } Commit Message: Upgrade Visual studio 2017 15.8 - Upgrade to 15.8 - Add check on CGATS memory allocation (thanks to Quang Nguyen for pointing out this) CWE I...
0
28,315
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: select_client_key(krb5_context context, krb5_db_entry *client, krb5_enctype *req_enctypes, int n_req_enctypes, krb5_keyblock *kb_out, krb5_key_data **kd_out) { krb5_error_code ret; krb5_key_data *kd; krb5_enctype etype; int i; memset(kb_out, 0, sizeof(*kb_o...
0
1,157
Analyze the following 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 edge_open(struct tty_struct *tty, struct usb_serial_port *port) { struct edgeport_port *edge_port = usb_get_serial_port_data(port); struct edgeport_serial *edge_serial; struct usb_device *dev; struct urb *urb; int port_number; int status; u16 open_settings; u8 transaction_timeout; if (edge_po...
0
26,880
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebGLRenderingContextBase::GetStaticBitmapImage( std::unique_ptr<viz::SingleReleaseCallback>* out_release_callback) { if (!GetDrawingBuffer()) return nullptr; if (CreationAttributes().preserve_drawing_buffer) return GetImage(); return GetDrawingBuffer()->TransferToStaticBitmapImage(out_release...
0
23,453
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, int unit_type) { png_debug1(1, "in %s storage function", "oFFs"); if (png_ptr == NULL || info_ptr == NULL) return; info_ptr->x_offset = offset_x; info_ptr->y_offset = offset_y; info_ptr->offse...
0
2,321
Analyze the following 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 BookmarkManagerView::WindowClosing() { g_browser_process->local_state()->SetInteger( prefs::kBookmarkManagerSplitLocation, split_view_->divider_x()); } Commit Message: Relands cl 16982 as it wasn't the cause of the build breakage. Here's the description for that cl: Lands http://codereview.chromi...
0
9,355
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: IDNSpoofChecker::IDNSpoofChecker() { UErrorCode status = U_ZERO_ERROR; checker_ = uspoof_open(&status); if (U_FAILURE(status)) { checker_ = nullptr; return; } uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE); SetAllowedUnicodeSet(&status); int32_t checks = uspoof_getChecks...
0
16,126
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderImpl::DoUniform1iv( GLint fake_location, GLsizei count, const GLint *value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform1iv", Program::kUniform1i, ...
0
8,143
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: virtual ~OwnedTexture() { ImageTransportFactory::GetInstance()->RemoveObserver(this); DeleteTexture(); } Commit Message: Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the render...
0
7,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'.
Code: hrtick_start_fair(struct rq *rq, struct task_struct *p) { } Commit Message: sched/fair: Fix infinite loop in update_blocked_averages() by reverting a9e7f6544b9c Zhipeng Xie, Xie XiuQi and Sargun Dhillon reported lockups in the scheduler under high loads, starting at around the v4.18 time frame, and Zhipeng Xie ...
0
29,397
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: iperf_get_test_server_port(struct iperf_test *ipt) { return ipt->server_port; } Commit Message: Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed ...
0
22,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: int HttpStreamParser::ReadResponseHeaders(const CompletionCallback& callback) { DCHECK(io_state_ == STATE_REQUEST_SENT || io_state_ == STATE_DONE); DCHECK(callback_.is_null()); DCHECK(!callback.is_null()); if (io_state_ == STATE_DONE) return ERR_CONNECTION_CLOSED; int result = OK; io_state_ = ST...
0
15,923
Analyze the following 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 ContentSecurityPolicy::shouldSendViolationReport( const String& report) const { return !m_violationReportsSent.contains(report.impl()->hash()); } Commit Message: CSP: Strip the fragment from reported URLs. We should have been stripping the fragment from the URL we report for CSP violations, but we we...
0
2,019
Analyze the following 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 ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) { struct super_block *sb = inode->i_sb; handle_t *handle; struct ext4_ext_path *path; struct ext4_extent *extent; ext4_lblk_t offset_lblk, len_lblk, ee_start_lblk = 0; unsigned int credits, ee_len; int ret = 0, depth, split_flag = 0; lo...
0
21,283
Analyze the following 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 kernel_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) { if (sock->ops->sendpage) return sock->ops->sendpage(sock, page, offset, size, flags); return sock_no_sendpage(sock, page, offset, size, flags); } Commit Message: net: rework recvmsg handler msg_name and m...
0
20,535
Analyze the following 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 UrlmonUrlRequestManager::OnResponseStarted(int request_id, const char* mime_type, const char* headers, int size, base::Time last_modified, const std::string& redirect_url, int redirect_status, const net::HostPortPair& socket_address) { DCHECK_NE(request_id, -1); DVLOG(1) << __FUNCTION__; DC...
0
26,891
Analyze the following 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 InterstitialPageImpl::Proceed() { if (!render_view_host_) return; if (action_taken_ != NO_ACTION) { NOTREACHED(); return; } Disable(); action_taken_ = PROCEED_ACTION; pause_throbber_ = false; controller_->delegate()->DidProceedOnInterstitial(); if (new_navigation_) TakeActi...
0
2,287
Analyze the following 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 skip_to_key(AVFormatContext *s) { ASFContext *asf = s->priv_data; int i; for (i = 0; i < 128; i++) { int j = asf->asfid2avid[i]; ASFStream *asf_st = &asf->streams[i]; if (j < 0 || s->streams[j]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) continue; ...
0
21,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'.
Code: UrlFetcherDownloader::UrlFetcherDownloader( std::unique_ptr<CrxDownloader> successor, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) : CrxDownloader(std::move(successor)), network_fetcher_factory_(network_fetcher_factory) {} Commit Message: Fix error handling in the request sende...
0
7,372
Analyze the following 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 http_av_log(void *ptr, int level, const char *fmt, va_list vargs) { static int print_prefix = 1; AVClass *avc = ptr ? *(AVClass**)ptr : NULL; if (level > av_log_get_level()) return; if (print_prefix && avc) http_log("[%s @ %p]", avc->item_name(ptr), ptr); print_pref...
0
5,614
Analyze the following 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 PathIsWritable(const FilePath& path) { base::ThreadRestrictions::AssertIOAllowed(); return access(path.value().c_str(), W_OK) == 0; } Commit Message: Fix creating target paths in file_util_posix CopyDirectory. BUG=167840 Review URL: https://chromiumcodereview.appspot.com/11773018 git-svn-id: svn://s...
0
25,224
Analyze the following 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 fuse_setup(struct fuse* fuse, gid_t gid, mode_t mask) { char opts[256]; fuse->fd = open("/dev/fuse", O_RDWR); if (fuse->fd == -1) { ERROR("failed to open fuse device: %s\n", strerror(errno)); return -1; } umount2(fuse->dest_path, MNT_DETACH); snprintf(opts, sizeof(opts), "fd...
0
12,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: ~CacheQueryResult() {} Commit Message: bluetooth: Implement getAvailability() This change implements the getAvailability() method for navigator.bluetooth as defined in the specification. Bug: 707640 Change-Id: I9e9b3e7f8ea7f259e975f71cb6d9570e5f04b479 Reviewed-on: https://chromium-review.googlesource.com/c/c...
0
17,810
Analyze the following 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 dell_poweredge_bt_xaction_handler(struct notifier_block *self, unsigned long unused, void *in) { struct smi_info *smi_info = in; unsigned char *data = smi_info->curr_msg->data; unsigned int size = smi_info->curr_msg->data_size; if (size >= 8 && (data[0]>>2) == STORAGE_NET...
0
26,245
Analyze the following 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 pmcraid_identify_hrrq(struct pmcraid_cmd *cmd) { struct pmcraid_instance *pinstance = cmd->drv_inst; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; int index = cmd->hrrq_index; __be64 hrrq_addr = cpu_to_be64(pinstance->hrrq_start_bus_addr[index]); u32 hrrq_size = cpu_to_be32(sizeof(u32) * ...
0
20,174
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: LayoutUnit LayoutBlockFlow::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const { LayoutUnit left = offsetFromFloats; if (applyTextIndent && style()->isLeftToRightDirection()) left += textIndentOffset(); return left; } Commit Message: Consistently check i...
0
23,611
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void UpdateProviderPolicy(const PolicyMap& policy) { PolicyMap policy_with_defaults; policy_with_defaults.CopyFrom(policy); #if defined(OS_CHROMEOS) SetEnterpriseUsersDefaults(&policy_with_defaults); #endif provider_.UpdateChromePolicy(policy_with_defaults); DCHECK(base::MessageLoopCurrent::...
0
21,945
Analyze the following 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 DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { DCHECK(!compositor_); if (!compositor) return; compositor_ = compositor; compositor_->AddObserver(this); DCHECK(!vsync_manager_.get()); vsync_manager_ = compositor_->vsync_manager(); vsync_manager_->AddObserver(this); compos...
0
22,042
Analyze the following 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 WebPluginDelegateProxy::OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list) { *result = false; RenderThreadImpl::current()->Send( new ViewHostMsg_ResolveProxy(url, result, proxy_list)); } Com...
0
4,126
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: btrfs_search_dir_index_item(struct btrfs_root *root, struct btrfs_path *path, u64 dirid, const char *name, int name_len) { struct extent_buffer *leaf; struct btrfs_dir_item *di; struct btrfs_key key; u32 nritems; int ret; key.objectid = dirid; key.type = BTRFS_DIR_INDEX_KEY; key.offset = 0;...
0
21,910
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool IsValidStateForWindowsCreateFunction( const windows::Create::Params::CreateData* create_data) { if (!create_data) return true; bool has_bound = create_data->left || create_data->top || create_data->width || create_data->height; bool is_panel = create_data->type == windows::C...
0
11,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'.
Code: int PostScript_MetaHandler::FindPostScriptHint() { bool found = false; IOBuffer ioBuf; XMP_Uns8 ch; XMP_IO* fileRef = this->parent->ioRef; XMP_AbortProc abortProc = this->parent->abortProc; void * abortArg = this->parent->abortArg; const bool checkAbort = (abortProc != 0); fileRef->Re...
0
13,306
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: char *M_fs_path_join(const char *p1, const char *p2, M_fs_system_t sys_type) { M_buf_t *buf; char sep; sys_type = M_fs_path_get_system_type(sys_type); /* If p2 is an absolute path we can't properly join it to another path... */ if (M_fs_path_isabs(p2, sys_type)) return M_strdup(p2); buf = M_buf_cre...
0
10,679
Analyze the following 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 DatabaseMessageFilter::OnDatabaseClosed(const string16& origin_identifier, const string16& database_name) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!database_connections_.IsDatabaseOpened( origin_identifier, database_name)) { ...
0
13,951
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: xsltScanLiteral(xsltParserContextPtr ctxt) { const xmlChar *q, *cur; xmlChar *ret = NULL; int val, len; SKIP_BLANKS; if (CUR == '"') { NEXT; cur = q = CUR_PTR; val = xmlStringCurrentChar(NULL, cur, &len); while ((IS_CHAR(val)) && (val != '"')) { cur += len; val = xmlStrin...
0
3,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'.
Code: static int __init ipv6_packet_init(void) { dev_add_pack(&ipv6_packet_type); return 0; } Commit Message: net: add validation for the socket syscall protocol argument 郭永刚 reported that one could simply crash the kernel as root by using a simple program: int socket_fd; struct sockaddr_in addr; addr.sin_port ...
0
28,709
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { return std::make_unique<CompositorExternalBeginFrameSource>( compositor_message_filter_.get(), sync_message_filter(), routing_id); } Commit Message: Roll src/third_party/boringssl/src 664e99a64..696c13bd6 https://boringssl.googlesource.c...
0
6,304
Analyze the following 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 Textfield::DeleteRange(const gfx::Range& range) { if (!ImeEditingAllowed() || range.is_empty()) return false; OnBeforeUserAction(); model_->SelectRange(range); if (model_->HasSelection()) { model_->DeleteSelection(); UpdateAfterChange(true, true); } OnAfterUserAction(); return true...
0
3,754
Analyze the following 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 oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei, struct oz_usb_ctx *usb_ctx, u8 strid, u8 isoc) { int ret; struct oz_elt *elt = (struct oz_elt *)ei->data; struct oz_app_hdr *app_hdr = (struct oz_app_hdr *)(elt+1); elt->type = OZ_ELT_APP_DATA; ei->app_id = OZ_APPID_USB; ei->lengt...
0
25,989
Analyze the following 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 prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { /* update guest state fields: */ vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12); vmcs12->guest_cr4 = vmcs12_guest_cr4(vcpu, vmcs12); kvm_get_dr(vcpu, 7, (unsigned long *)&vmcs12->guest_dr7); vmcs12->guest_rsp = kvm_register_read(...
0
7,416
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static PolygonInfo **DestroyPolygonThreadSet(PolygonInfo **polygon_info) { register ssize_t i; assert(polygon_info != (PolygonInfo **) NULL); for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++) if (polygon_info[i] != (PolygonInfo *) NULL) polygon_info[i]=DestroyPolygonInfo(po...
0
28,107
Analyze the following 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 mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments) { int i, j, nb_segments = 0; MXFIndexTableSegment **unsorted_segments; int last_body_sid = -1, last_index_sid = -1, last_index_start = -1; /* count number of segments, alloc...
0
28,015
Analyze the following 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 ssl_handshake_step( ssl_context *ssl ) { int ret = POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE; #if defined(POLARSSL_SSL_CLI_C) if( ssl->endpoint == SSL_IS_CLIENT ) ret = ssl_handshake_client_step( ssl ); #endif #if defined(POLARSSL_SSL_SRV_C) if( ssl->endpoint == SSL_IS_SERVER ) ret = ...
0
10,066
Analyze the following 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 Performance::ActivateObserver(PerformanceObserver& observer) { if (active_observers_.IsEmpty()) deliver_observations_timer_.StartOneShot(TimeDelta(), FROM_HERE); active_observers_.insert(&observer); } Commit Message: Fix timing allow check algorithm for service workers This CL uses the OriginalURL...
0
1,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'.
Code: static bool ExecuteInsertImage(LocalFrame& frame, Event*, EditorCommandSource, const String& value) { DCHECK(frame.GetDocument()); HTMLImageElement* image = HTMLImageElement::Create(*frame.GetDocument()); if (!value...
0
11,652
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ofproto_port_get_stp_status(struct ofproto *ofproto, ofp_port_t ofp_port, struct ofproto_port_stp_status *s) { struct ofport *ofport = ofproto_get_port(ofproto, ofp_port); if (!ofport) { VLOG_WARN_RL(&rl, "%s: cannot get STP status on nonexistent " ...
0
5,164
Analyze the following 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 read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { _cleanup_free_ char *line = NULL; struct termios old_termios; int r; assert(f); assert(ret); /* If this is a terminal, then switch canonical mode off, so that we can read a single character */ ...
0
20,907
Analyze the following 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 *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) { struct ubifs_inode *ui = ubifs_inode(dentry->d_inode); nd_set_link(nd, ui->data); return NULL; } Commit Message: ->splice_write() via ->write_iter() iter_file_splice_write() - a ->splice_write() instance that gathers the pipe buff...
0
27,372
Analyze the following 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 dev_cpu_dead(unsigned int oldcpu) { struct sk_buff **list_skb; struct sk_buff *skb; unsigned int cpu; struct softnet_data *sd, *oldsd, *remsd = NULL; local_irq_disable(); cpu = smp_processor_id(); sd = &per_cpu(softnet_data, cpu); oldsd = &per_cpu(softnet_data, oldcpu); /* Find end of our co...
0
26,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: size_t WebMediaPlayerImpl::VideoDecodedByteCount() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); return GetPipelineStatistics().video_bytes_decoded; } Commit Message: Fix HasSingleSecurityOrigin for HLS HLS manifests can request segments from a different origin than the original manifest's or...
0
13,757
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SparseHistogram::~SparseHistogram() {} Commit Message: Convert DCHECKs to CHECKs for histogram types When a histogram is looked up by name, there is currently a DCHECK that verifies the type of the stored histogram matches the expected type. A mismatch represents a significant problem because the returned Hist...
0
6,249
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: std::string ChromeMetricsServiceClient::GetApplicationLocale() { return g_browser_process->GetApplicationLocale(); } Commit Message: Add CPU metrics provider and Add CPU/GPU provider for UKM. Bug: 907674 Change-Id: I61b88aeac8d2a7ff81d812fa5a267f48203ec7e2 Reviewed-on: https://chromium-review.googlesource.com...
0
26,276
Analyze the following 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 prepend_path(const struct path *path, const struct path *root, char **buffer, int *buflen) { struct dentry *dentry; struct vfsmount *vfsmnt; struct mount *mnt; int error = 0; unsigned seq, m_seq = 0; char *bptr; int blen; rcu_read_lock(); restart_mnt: read_seqbegin_or_lock(&mount_lock, ...
0
8,894
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha, ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType status; ssize_t y; assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule()...
0
918
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: error::Error GLES2DecoderImpl::HandleRegisterSharedIdsCHROMIUM( uint32 immediate_data_size, const gles2::RegisterSharedIdsCHROMIUM& c) { GLuint namespace_id = static_cast<GLuint>(c.namespace_id); GLsizei n = static_cast<GLsizei>(c.n); uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_...
0
14,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: garp_group_garp_interval_handler(vector_t *strvec) { garp_delay_t *delay = LIST_TAIL_DATA(garp_delay); double val; if (!read_double_strvec(strvec, 1, &val, 0, INT_MAX / 1000000, true)) { report_config_error(CONFIG_GENERAL_ERROR, "garp_group garp_interval '%s' invalid", FMT_STR_VSLOT(strvec, 1)); return; ...
0
4,760
Analyze the following 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_init_class(mrb_state *mrb) { struct RClass *bob; /* BasicObject */ struct RClass *obj; /* Object */ struct RClass *mod; /* Module */ struct RClass *cls; /* Class */ /* boot class hierarchy */ bob = boot_defclass(mrb, 0); obj = boot_defclass(mrb, bob); mrb...
0
16,044
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rotate_backups(const char *fname) { #ifdef __VMS # define SEP "_" # define AVS ";*" /* All-version suffix. */ # define AVSL (sizeof (AVS) - 1) #else # define SEP "." # define AVSL 0 #endif int maxlen = strlen (fname) + sizeof (SEP) + numdigit (opt.backups) + AVSL; char *from = (char *)a...
0
5,793
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int call_netdevice_notifiers(unsigned long val, struct net_device *dev) { return raw_notifier_call_chain(&netdev_chain, val, dev); } 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 introdu...
0
28,744
Analyze the following 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 WebContentsImpl::Undo() { RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->Undo(); RecordAction(base::UserMetricsAction("Undo")); } Commit Message: If JavaScript shows a dialog, cause the page to lose fullscreen. BUG=670135,...
0
25,335