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 int filter_frame(AVFilterLink *inlink, AVFrame *inpic) { KerndeintContext *kerndeint = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFrame *outpic; const uint8_t *prvp; ///< Previous field's pixel line number n const uint8_t *prvpp; ///< Previous field's pixel...
1
166,003
Analyze the following 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_bit_string(const u8 * inbuf, size_t inlen, void *outbuf, size_t outlen, int invert) { const u8 *in = inbuf; u8 *out = (u8 *) outbuf; int zero_bits = *in & 0x07; size_t octets_left = inlen - 1; int i, count = 0; memset(outbuf, 0, outlen); in++; if (outlen < octets_left) return ...
0
78,112
Analyze the following 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 RenderFrameHostImpl::CreateNetworkServiceDefaultFactoryAndObserve( const base::Optional<url::Origin>& origin, network::mojom::URLLoaderFactoryRequest default_factory_request) { bool bypass_redirect_checks = CreateNetworkServiceDefaultFactoryInternal( origin, std::move(default_factory_request)...
0
139,231
Analyze the following 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 replace_map_fd_with_map_ptr(struct bpf_verifier_env *env) { struct bpf_insn *insn = env->prog->insnsi; int insn_cnt = env->prog->len; int i, j, err; err = bpf_prog_calc_tag(env->prog); if (err) return err; for (i = 0; i < insn_cnt; i++, insn++) { if (BPF_CLASS(insn->code) == BPF_LDX && ...
0
76,426
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int ip6mr_mfc_add(struct net *net, struct mr6_table *mrt, struct mf6cctl *mfc, int mrtsock, int parent) { bool found = false; int line; struct mfc6_cache *uc, *c; unsigned char ttls[MAXMIFS]; int i; if (mfc->mf6cc_parent >= MAXMIFS) return -ENFILE; memset(ttls, 255, MAXMIFS); for (i = 0; i ...
0
93,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: static int pfkey_add(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); struct xfrm_state *x; int err; struct km_event c; x = pfkey_msg2xfrm_state(net, hdr, ext_hdrs); if (IS_ERR(x)) return PTR_ERR(x); xfrm_state_hold(x); if (hdr...
0
31,405
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: smp_fetch_stcode(const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn; char *ptr; int len; CHECK_HTTP_MESSAGE_FIRST(); txn = smp->strm->txn; if (txn->rsp.msg_state < HTTP_MSG_BODY) return 0; len = txn->rsp.sl.st.c_l; ptr = txn->rsp.chn->buf->p + txn->rsp.s...
0
6,922
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: update_port_config(struct ofconn *ofconn, struct ofport *port, enum ofputil_port_config config, enum ofputil_port_config mask) { enum ofputil_port_config toggle = (config ^ port->pp.config) & mask; if (toggle & OFPUTIL_PC_PORT_DOWN && (config & OFPUTIL_PC_POR...
0
77,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: static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nfs_renameargs *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, ...
0
23,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'.
Code: void init_revisions(struct rev_info *revs, const char *prefix) { memset(revs, 0, sizeof(*revs)); revs->abbrev = DEFAULT_ABBREV; revs->ignore_merges = 1; revs->simplify_history = 1; DIFF_OPT_SET(&revs->pruning, RECURSIVE); DIFF_OPT_SET(&revs->pruning, QUICK); revs->pruning.add_remove = file_add_remove; re...
0
55,010
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: jbig2_word_stream_buf_get_next_word(Jbig2WordStream *self, int offset, uint32_t *word) { Jbig2WordStreamBuf *z = (Jbig2WordStreamBuf *) self; const byte *data = z->data; uint32_t result; if (offset + 4 < z->size) result = (data[offset] << 24) | (data[offset + 1] << 16) | (data[offset +...
1
165,485
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) { struct net *net = sock_net(in_skb->sk); struct rtmsg *rtm; struct nlattr *tb[RTA_MAX+1]; struct rtable *rt = NULL; __be32 dst = 0; __be32 src = 0; u32 iif; int err; int mark; struct sk_buff *skb; err = nlmsg_parse(...
0
25,106
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: set_var(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; if(!argv_idx(argv, 0)) return; gchar **split = g_strsplit(argv_idx(argv, 0), "=", 2); if (split[0] != NULL) { gchar *value = parseenv(split[1] ? g_strchug(split[1]) : " "); set_var_v...
0
18,400
Analyze the following 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 usb_root_hub_lost_power(struct usb_device *rhdev) { dev_notice(&rhdev->dev, "root hub lost power or was reset\n"); rhdev->reset_resume = 1; } Commit Message: USB: check usb_get_extra_descriptor for proper size When reading an extra descriptor, we need to properly check the minimum and maximum size allowe...
0
75,528
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); JSValue result = jsString(exec, impl->getURLAttribute(WebCore::HT...
0
101,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'.
Code: void BlinkTestRunner::ApplyPreferences() { WebPreferences prefs = render_view()->GetWebkitPreferences(); ExportLayoutTestSpecificPreferences(prefs_, &prefs); render_view()->SetWebkitPreferences(prefs); Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs)); } Commit Message: content: Rename ...
0
123,544
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: download::DownloadItem* DownloadManagerImpl::GetDownload(uint32_t download_id) { return base::ContainsKey(downloads_, download_id) ? downloads_[download_id].get() : nullptr; } Commit Message: Early return if a download Id is already used when creating a download This is protect again...
0
151,204
Analyze the following 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::dispatchWindowEvent(PassRefPtr<Event> event, PassRefPtr<EventTarget> target) { ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); DOMWindow* domWindow = this->domWindow(); if (!domWindow) return; domWindow->dispatchEvent(event, target); } Commit Message: Refact...
0
102,702
Analyze the following 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 shm_open(struct vm_area_struct *vma) { struct file *file = vma->vm_file; struct shm_file_data *sfd = shm_file_data(file); struct shmid_kernel *shp; shp = shm_lock(sfd->ns, sfd->id); shp->shm_atim = get_seconds(); shp->shm_lprid = task_tgid_vnr(current); shp->shm_nattch++; shm_unlock(shp); } ...
0
42,027
Analyze the following 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 DownloadController::HasFileAccessPermission( ui::WindowAndroid* window_android) { ScopedJavaLocalRef<jobject> jwindow_android = window_android->GetJavaObject(); DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!jwindow_android.is_null()); JNIEnv* env = base::android::AttachCurrentThread(); retu...
0
126,716
Analyze the following 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 dev_add_offload(struct packet_offload *po) { struct packet_offload *elem; spin_lock(&offload_lock); list_for_each_entry(elem, &offload_base, list) { if (po->priority < elem->priority) break; } list_add_rcu(&po->list, elem->list.prev); spin_unlock(&offload_lock); } Commit Message: tunnels: Don't ...
0
48,774
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void ehci_trace_qh(EHCIQueue *q, hwaddr addr, EHCIqh *qh) { /* need three here due to argument count limits */ trace_usb_ehci_qh_ptrs(q, addr, qh->next, qh->current_qtd, qh->next_qtd, qh->altnext_qtd); trace_usb_ehci_qh_fields(addr, get_fi...
0
5,829
Analyze the following 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 http_process_request(struct session *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; struct connection *cli_conn = objt_conn(req->prod->end); if (unlikely(msg->msg_state < HTTP_MSG_BODY)) { /* we need more data */ channel_dont_connect(req); re...
0
9,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: ExtensionFunction::ResponseAction TabsGetAllInWindowFunction::Run() { std::unique_ptr<tabs::GetAllInWindow::Params> params( tabs::GetAllInWindow::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); int window_id = extension_misc::kCurrentWindowId; if (params->window_id.get()) win...
0
151,517
Analyze the following 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_CodersInfo(struct archive_read *a, struct _7z_coders_info *ci) { const unsigned char *p; struct _7z_digests digest; unsigned i; memset(ci, 0, sizeof(*ci)); memset(&digest, 0, sizeof(digest)); if ((p = header_bytes(a, 1)) == NULL) goto failed; if (*p != kFolder) goto failed; /* * Read NumFold...
0
53,564
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int64 Get(int64 metahandle, syncable::BaseVersion field) { const int64 kDefaultValue = -100; return GetField(metahandle, field, kDefaultValue); } Commit Message: [Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com...
0
105,098
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: device_drive_eject_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, g...
0
11,620
Analyze the following 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 InspectorNetworkAgent::Enable(int total_buffer_size, int resource_buffer_size) { if (!GetFrontend()) return; resources_data_->SetResourcesDataSizeLimits(total_buffer_size, resource_buffer_size); state_->setBoolean(Netw...
0
138,501
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RList *r_bin_wasm_get_memories (RBinWasmObj *bin) { RBinWasmSection *memory; RList *memories; if (!bin || !bin->g_sections) { return NULL; } if (bin->g_memories) { return bin->g_memories; } if (!(memories = r_bin_wasm_get_sections_by_id (bin->g_sections, R_BIN_WASM_SECTION_MEMORY))) { return...
0
67,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: void Document::InvalidateNodeListCaches(const QualifiedName* attr_name) { for (const LiveNodeListBase* list : lists_invalidated_at_document_) list->InvalidateCacheForAttribute(attr_name); } Commit Message: Cleanup and remove dead code in SetFocusedElement This early-out was added in: https://crrev.com/ce...
0
129,758
Analyze the following 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 treatReturnedNullStringAsUndefinedStringMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); TestObjectPythonV8Internal::treatReturnedNullStringAsUndefinedStringMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8",...
0
122,739
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int inotify_fasync(int fd, struct file *file, int on) { struct fsnotify_group *group = file->private_data; return fasync_helper(fd, file, on, &group->inotify_data.fa) >= 0 ? 0 : -EIO; } Commit Message: inotify: fix double free/corruption of stuct user On an error path in inotify_init1 a normal user ca...
0
27,538
Analyze the following 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 BaseRenderingContext2D::stroke(Path2D* dom_path) { DrawPathInternal(dom_path->GetPath(), CanvasRenderingContext2DState::kStrokePaintType); } Commit Message: [PE] Distinguish between tainting due to canvas content and filter. A filter on a canvas can itself lead to origin tainting, for ...
0
149,968
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: LayoutSVGResourceMarker::LayoutSVGResourceMarker(SVGMarkerElement* node) : LayoutSVGResourceContainer(node) { } Commit Message: Avoid using forced layout to trigger paint invalidation for SVG containers Currently, SVG containers in the LayoutObject hierarchy force layout of their children if the transform c...
0
121,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: file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unused)), const void *buf, size_t nb) { int m = 0, rv = 0, looks_text = 0; int mime = ms->flags & MAGIC_MIME; const unsigned char *ubuf = CAST(const unsigned char *, buf); unichar *u8buf = NULL; size_t ulen; const char *code = ...
0
35,633
Analyze the following 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 u64 nf_tables_alloc_handle(struct nft_table *table) { return ++table->hgenerator; } Commit Message: netfilter: nf_tables: fix flush ruleset chain dependencies Jumping between chains doesn't mix well with flush ruleset. Rules from a different chain and set elements may still refer to us. [ 353.3...
0
57,936
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: pop_args () { #if defined (ARRAY_VARS) && defined (DEBUGGER) SHELL_VAR *bash_argv_v, *bash_argc_v; ARRAY *bash_argv_a, *bash_argc_a; ARRAY_ELEMENT *ce; intmax_t i; GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a); GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a); ce = array_shi...
0
17,352
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) { if (parser != NULL) parser->m_entityDeclHandler = handler; } Commit Message: xmlparse.c: Deny internal entities closing the doctype CWE ID: CWE-611
0
88,221
Analyze the following 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 RenderFlexibleBox::setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize) { if (hasOrthogonalFlow(child)) child->setOverrideLogicalContentHeight(childPreferredSize - child->borderAndPaddingLogicalHeight()); else child->setOverrideLogicalContentWidth(childPreferredSize...
0
116,708
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: jbig2_decode_generic_template0(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) { const int G...
0
18,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'.
Code: int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len) { struct inet_sock *inet = inet_sk(sk); struct udp_sock *up = udp_sk(sk); struct flowi4 fl4_stack; struct flowi4 *fl4; int ulen = len; struct ipcm_cookie ipc; struct rtable *rt = NULL; int free = 0; int connected = 0; ...
0
40,175
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) { SF_PRIVATE *psf ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (chunk_info == NULL || chunk_info->data == NULL) return SFE_BAD_CHUNK_PTR ; if (psf->set_chunk) return psf->set_chunk (psf, chunk_info) ; return SFE_BAD_CHUNK_...
0
95,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: BaseRenderingContext2D::BaseRenderingContext2D() : clip_antialiasing_(kNotAntiAliased) { state_stack_.push_back(CanvasRenderingContext2DState::Create()); } Commit Message: [PE] Distinguish between tainting due to canvas content and filter. A filter on a canvas can itself lead to origin tainting, for re...
1
172,904
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: status_t String8::unlockBuffer(size_t size) { if (size != this->size()) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize(size+1); if (! buf) { return NO_MEMORY; } char* str = (char*)buf->data(); str[size] = 0; mString = str; } return NO_ERROR; } Commit Message: ...
0
158,420
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void V8TestObject::VoidMethodDocumentArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodDocumentArg"); test_object_v8_internal::VoidMethodDocumentArgMethod(info); } Commit Message: bindings: Support...
0
135,402
Analyze the following 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_gc_protect(mrb_state *mrb, mrb_value obj) { if (mrb_immediate_p(obj)) return; gc_protect(mrb, &mrb->gc, mrb_basic_ptr(obj)); } Commit Message: Clear unused stack region that may refer freed objects; fix #3596 CWE ID: CWE-416
0
64,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 wait_worker_and_cache_frame(vpx_codec_alg_priv_t *ctx) { YV12_BUFFER_CONFIG sd; vp9_ppflags_t flags = {0, 0, 0}; const VPxWorkerInterface *const winterface = vpx_get_worker_interface(); VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id]; FrameWorkerData *const frame_worker...
0
158,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'.
Code: int qcow2_snapshot_delete(BlockDriverState *bs, const char *snapshot_id, const char *name, Error **errp) { BDRVQcowState *s = bs->opaque; QCowSnapshot sn; int snapshot_index, ret; /* Search the snapshot */ snapshot_...
0
16,785
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Box *pcrb_New() { ISOM_DECL_BOX_ALLOC(GF_PcrInfoBox, GF_ISOM_BOX_TYPE_PCRB); return (GF_Box *)tmp; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,322
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SVGElement::MarkForLayoutAndParentResourceInvalidation( LayoutObject& layout_object) { LayoutSVGResourceContainer::MarkForLayoutAndParentResourceInvalidation( layout_object, true); } Commit Message: Fix SVG crash for v0 distribution into foreignObject. We require a parent element to be an SVG e...
0
152,781
Analyze the following 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 PrintJobWorker::OnNewPage() { if (!document_.get()) // Spurious message. return; DCHECK(task_runner_->RunsTasksInCurrentSequence()); if (page_number_ == PageNumber::npos()) { int page_count = document_->page_count(); if (!page_count) { return; } page_number_.Init(document_-...
0
135,593
Analyze the following 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 char* find_file_within(const char* path, const char* name, char* buf, size_t bufsize, int search) { size_t pathlen = strlen(path); size_t namelen = strlen(name); size_t childlen = pathlen + namelen + 1; char* actual; if (bufsize <= childlen) { return NULL; } memcpy(buf, path, pathlen); bu...
0
160,556
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct sadb_msg *pfkey_get_base_msg(struct sk_buff *skb, int *errp) { struct sadb_msg *hdr = NULL; if (skb->len < sizeof(*hdr)) { *errp = -EMSGSIZE; } else { hdr = (struct sadb_msg *) skb->data; if (hdr->sadb_msg_version != PF_KEY_V2 || hdr->sadb_msg_reserved != 0 || (hdr->sadb_msg_ty...
0
31,423
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool xmp_get_property_float(XmpPtr xmp, const char *schema, const char *name, double *property, uint32_t *propsBits) { CHECK_PTR(xmp, false); RESET_ERROR; bool ret = false; try { auto txmp = reinterpret_cast<const SXMPMeta *>(xmp); XMP_OptionBits option...
0
16,032
Analyze the following 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 regulator_suspend_standby_state_show(struct device *dev, struct device_attribute *attr, char *buf) { struct regulator_dev *rdev = dev_get_drvdata(dev); return regulator_print_state(buf, rdev->constraints->state_standby.enabled); } Commit Message: regulator: core: Fix regualtor_ena_gpi...
0
74,553
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err trak_dump(GF_Box *a, FILE * trace) { GF_TrackBox *p; p = (GF_TrackBox *)a; gf_isom_box_dump_start(a, "TrackBox", trace); fprintf(trace, ">\n"); if (p->Header) { gf_isom_box_dump(p->Header, trace); } else if (p->size) { fprintf(trace, "<!--INVALID FILE: Missing Track Header-->\n"); } if (p->Ref...
0
80,878
Analyze the following 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 security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_encrypt(rdp->fips_encrypt, length, data, data); rdp->encrypt_use_count++; return TRUE; } Commit Message: security: add a NULL pointer check to fix a server crash. CWE ID: CWE-476
0
58,660
Analyze the following 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 jpc_cod_destroyparms(jpc_ms_t *ms) { jpc_cod_t *cod = &ms->parms.cod; jpc_cox_destroycompparms(&cod->compparms); } Commit Message: The generation of the configuration file jas_config.h has been completely reworked in order to avoid pollution of the global namespace. Some problematic types like uch...
0
72,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: void sctp_chunk_hold(struct sctp_chunk *ch) { atomic_inc(&ch->refcnt); } Commit Message: net: sctp: fix NULL pointer dereference in af->from_addr_param on malformed packet An SCTP server doing ASCONF will panic on malformed INIT ping-of-death in the form of: ------------ INIT[PARAM: SET_PRIMARY_IP] --------...
0
35,839
Analyze the following 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 ide_sector_read_cb(void *opaque, int ret) { IDEState *s = opaque; int n; s->pio_aiocb = NULL; s->status &= ~BUSY_STAT; if (ret == -ECANCELED) { return; } block_acct_done(blk_get_stats(s->blk), &s->acct); if (ret != 0) { if (ide_handle_rw_error(s, -ret,...
0
6,755
Analyze the following 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 signed int ReadBlobLSBSignedLong(Image *image) { union { unsigned int unsigned_value; signed int signed_value; } quantum; quantum.unsigned_value=ReadBlobLSBLong(image); return(quantum.signed_value); } Commit Message: https://github.com/ImageMagick/ImageMagick6/issues/...
0
88,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'.
Code: void ExtensionSettingsHandler::HandleLoadMessage(const ListValue* args) { FilePath::StringType string_path; CHECK_EQ(1U, args->GetSize()) << args->GetSize(); CHECK(args->GetString(0, &string_path)); extensions::UnpackedInstaller::Create(extension_service_)-> Load(FilePath(string_path)); } Commit Me...
0
107,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: vrrp_script_handler(vector_t *strvec) { if (!strvec) return; alloc_vrrp_script(strvec_slot(strvec, 1)); script_user_set = false; remove_script = false; } Commit Message: When opening files for write, ensure they aren't symbolic links Issue #1048 identified that if, for example, a non privileged user crea...
0
76,030
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Box *stco_New() { ISOM_DECL_BOX_ALLOC(GF_ChunkOffsetBox, GF_ISOM_BOX_TYPE_STCO); return (GF_Box *)tmp; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,440
Analyze the following 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 V8TestObject::LocationByteStringAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_locationByteString_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::LocationByte...
0
134,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: static int check_map_func_compatibility(struct bpf_verifier_env *env, struct bpf_map *map, int func_id) { if (!map) return 0; /* We need a two way check, first is from map perspective ... */ switch (map->map_type) { case BPF_MAP_TYPE_PROG_ARRAY: if (func_id != BPF_FUNC_tail_call) goto error; br...
0
59,116
Analyze the following 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_setapp(struct net_device *netdev, struct nlmsghdr *nlh, u32 seq, struct nlattr **tb, struct sk_buff *skb) { int ret; u16 id; u8 up, idtype; struct nlattr *app_tb[DCB_APP_ATTR_MAX + 1]; if (!tb[DCB_ATTR_APP]) return -EINVAL; ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR...
0
31,113
Analyze the following 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::OnResize(const ResizeParams& params) { TRACE_EVENT0("renderer", "RenderViewImpl::OnResize"); if (webview()) { webview()->HidePopups(); if (send_preferred_size_changes_ && webview()->MainFrame()->IsWebLocalFrame()) { webview()->MainFrame()->ToWebLocalFrame()->SetCanH...
0
147,995
Analyze the following 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 dictEncObjKeyCompare(void *privdata, const void *key1, const void *key2) { robj *o1 = (robj*) key1, *o2 = (robj*) key2; int cmp; if (o1->encoding == OBJ_ENCODING_INT && o2->encoding == OBJ_ENCODING_INT) return o1->ptr == o2->ptr; o1 = getDecodedObject(o1); o2 ...
0
70,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'.
Code: bool vnc_worker_thread_running(void) { return queue; /* Check global queue */ } Commit Message: CWE ID: CWE-125
0
17,917
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: HANDLE _dbus_global_lock (const char *mutexname) { HANDLE mutex; DWORD gotMutex; mutex = CreateMutexA( NULL, FALSE, mutexname ); if( !mutex ) { return FALSE; } gotMutex = WaitForSingleObject( mutex, INFINITE ); switch( gotMutex ) { case WAIT_ABANDONED: Rele...
0
3,803
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: nvmet_fc_free_tgt_pgs(struct nvmet_fc_fcp_iod *fod) { struct scatterlist *sg; int count; if (!fod->data_sg || !fod->data_sg_cnt) return; fc_dma_unmap_sg(fod->tgtport->dev, fod->data_sg, fod->data_sg_cnt, ((fod->io_dir == NVMET_FCP_WRITE) ? DMA_FROM_DEVICE : DMA_TO_DEVICE)); for_each_sg(fod->data...
0
93,611
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ctr_crypt_128bit(&serpent_ctr, desc, dst, src, nbytes); } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "...
0
46,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: void RenderBlock::LineBreaker::skipLeadingWhitespace(InlineBidiResolver& resolver, LineInfo& lineInfo, FloatingObject* lastFloatFromPreviousLine, LineWidth& width) { while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo, Lead...
0
111,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: bad_file( const char *dirpath, const char *name, Directory & dir ) { MyString pathname; MyString buf; if( is_relative_to_cwd( name ) ) { pathname.sprintf( "%s%c%s", dirpath, DIR_DELIM_CHAR, name ); } else { pathname = name; } if( VerboseFlag ) { printf( "%s - BAD\n", pathname.Value() ); dprintf( D...
0
16,459
Analyze the following 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 prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int mb_xy, int ref) { /* Don't prefetch refs that haven't been used very often this frame. */ if (s->ref_count[ref - 1] > (mb_xy >> 5)) { int x_off = mb_x << 4, y_off = mb_y << 4; int mx = (mb->...
0
63,975
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: peek_from_buf(char *string, size_t string_len, const buf_t *buf) { chunk_t *chunk; tor_assert(string); /* make sure we don't ask for too much */ tor_assert(string_len <= buf->datalen); /* assert_buf_ok(buf); */ chunk = buf->head; while (string_len) { size_t copy = string_len; tor_assert(ch...
0
73,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: GURL TemplateURL::GenerateSearchURL( const SearchTermsData& search_terms_data) const { if (!url_ref_->IsValid(search_terms_data)) return GURL(); if (!url_ref_->SupportsReplacement(search_terms_data)) return GURL(url()); return GURL(url_ref_->ReplaceSearchTerms( TemplateURLRef::SearchTerm...
0
120,281
Analyze the following 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 uas_cmd_cmplt(struct urb *urb) { if (urb->status) dev_err(&urb->dev->dev, "cmd cmplt err %d\n", urb->status); usb_free_urb(urb); } Commit Message: USB: uas: fix bug in handling of alternate settings The uas driver has a subtle bug in the way it handles alternate settings. The uas_find_uas_alt_...
0
59,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: void RenderWidgetHostViewGtk::DidUpdateBackingStore( const gfx::Rect& scroll_rect, const gfx::Vector2d& scroll_delta, const std::vector<gfx::Rect>& copy_rects) { TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::DidUpdateBackingStore"); if (is_hidden_) return; if (about_to_validate_and_pai...
0
114,934
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SendReplyAndDeleteThis() { filter_->Send(reply_msg_); delete this; } Commit Message: Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/ BUG=172573 Review URL: https://codereview.chromium.org/12177018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180600 0039d...
0
116,886
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AXTreeSerializerTest() {} Commit Message: When serializing accessibility tree, skip invalid children. See bug for specific repro in the wild, but essentially we need to check if the child is valid just before serializing, and not trust the list of children of a node. BUG=479743 Review URL: https://coderevie...
0
127,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: static void free_sched_domain(struct rcu_head *rcu) { struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu); /* * If its an overlapping domain it has private groups, iterate and * nuke them all. */ if (sd->flags & SD_OVERLAP) { free_sched_groups(sd->groups, 1); } else if (atomic_dec_a...
0
58,158
Analyze the following 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 bta_av_rc_disc_done(UNUSED_ATTR tBTA_AV_DATA* p_data) { tBTA_AV_CB* p_cb = &bta_av_cb; tBTA_AV_SCB* p_scb = NULL; tBTA_AV_LCB* p_lcb; uint8_t rc_handle; tBTA_AV_FEAT peer_features = 0; /* peer features mask */ APPL_TRACE_DEBUG("%s: bta_av_rc_disc_done disc:x%x", __func__, p_cb->disc); if (!p_cb-...
0
162,857
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: script_security_handler(__attribute__((unused)) vector_t *strvec) { script_security = true; } Commit Message: Add command line and configuration option to set umask Issue #1048 identified that files created by keepalived are created with mode 0666. This commit changes the default to 0644, and also allows the u...
0
75,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: PermissionPromptImpl::~PermissionPromptImpl() { if (bubble_delegate_) bubble_delegate_->CloseBubble(); } Commit Message: Elide the permission bubble title from the head of the string. Long URLs can be used to spoof other origins in the permission bubble title. This CL customises the title to be elided fro...
0
146,974
Analyze the following 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::globus_gram_client_job_signal(const char * job_contact, globus_gram_protocol_job_signal_t signal, const char * signal_arg, int * job_status, int * failure_code) { static const char* command = "GRAM_JOB_SIGNAL"; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHP...
0
16,195
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static long do_set_mempolicy(unsigned short mode, unsigned short flags, nodemask_t *nodes) { struct mempolicy *new, *old; struct mm_struct *mm = current->mm; NODEMASK_SCRATCH(scratch); int ret; if (!scratch) return -ENOMEM; new = mpol_new(mode, flags, nodes); if (IS_ERR(new)) { ret = PTR_ERR(...
0
21,307
Analyze the following 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_METHOD(Phar, offsetGet) { char *fname, *error; size_t fname_len; zval zfname; phar_entry_info *entry; zend_string *sfname; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) { return; } /* security is 0...
1
165,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: static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, struct ext4_ext_path *path) { int err; ext4_fsblk_t leaf; /* free index block */ path--; leaf = idx_pblock(path->p_idx); BUG_ON(path->p_hdr->eh_entries == 0); err = ext4_ext_get_access(handle, inode, path); if (err) return err; le16_...
0
57,446
Analyze the following 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::OverridePageVisibilityState( RenderFrameHost* render_frame_host, blink::mojom::PageVisibilityState* visibility_state) { DCHECK_CURRENTLY_ON(BrowserThread::UI); WebContents* web_contents = WebContents::FromRenderFrameHost(render_frame_host); DCHECK(web_contents...
0
153,484
Analyze the following 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 local_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size, int flags) { char *path = fs_path->data; return v9fs_set_xattr(ctx, path, name, value, size, flags); } Commit Message: CWE ID: CWE-732
0
17,859
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int whiteheat_firmware_attach(struct usb_serial *serial) { /* We want this device to fail to have a driver assigned to it */ return 1; } Commit Message: USB: whiteheat: Added bounds checking for bulk command response This patch fixes a potential security issue in the whiteheat USB driver which might al...
0
38,098
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MockDownloadFile* MockDownloadFileFactory::GetExistingFile( const DownloadId& id) { DCHECK(files_.find(id) != files_.end()); return files_[id]; } Commit Message: Refactors to simplify rename pathway in DownloadFileManager. This is https://chromiumcodereview.appspot.com/10668004 / r144817 (reverted due ...
0
106,048
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int get_default_root(pool *p, int allow_symlinks, const char **root) { config_rec *c = NULL; const char *dir = NULL; int res; c = find_config(main_server->conf, CONF_PARAM, "DefaultRoot", FALSE); while (c != NULL) { pr_signals_handle(); /* Check the groups acl */ if (c->argc < 2) ...
1
168,278
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: skip_12(struct file *file) /* Skip exactly 12 bytes in the input stream - used to skip a CRC and chunk * header that has been read before. */ { /* Since the chunks were read before this shouldn't fail: */ if (fseek(file->file, 12, SEEK_CUR) != 0) { if (errno != 0) file->read_errno = errno; ...
0
160,145
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int64_t FrameFetchContext::ServiceWorkerID() const { DCHECK(IsControlledByServiceWorker() != blink::mojom::ControllerServiceWorkerMode::kNoController); DCHECK(MasterDocumentLoader()); auto* service_worker_network_provider = MasterDocumentLoader()->GetServiceWorkerNetworkProvider(); return s...
0
145,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: bool NuPlayer::GenericSource::isStreaming() const { return mIsStreaming; } Commit Message: MPEG4Extractor: ensure kKeyTrackID exists before creating an MPEG4Source as track. GenericSource: return error when no track exists. SampleIterator: make sure mSamplesPerChunk is not zero before using it as divisor. Bu...
0
160,413
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderThreadImpl::SetFlingCurveParameters( const std::vector<float>& new_touchpad, const std::vector<float>& new_touchscreen) { webkit_platform_support_->SetFlingCurveParameters(new_touchpad, new_touchscreen); } Commit Message: Suspend shared ti...
0
111,179
Analyze the following 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 register_netdevice(struct net_device *dev) { int ret; struct net *net = dev_net(dev); BUG_ON(dev_boot_phase); ASSERT_RTNL(); might_sleep(); /* When net_device's are persistent, this will be fatal. */ BUG_ON(dev->reg_state != NETREG_UNINITIALIZED); BUG_ON(!net); spin_lock_init(&dev->addr_list_lock...
0
48,930