Dataset Viewer
Auto-converted to Parquet
project
stringclasses
791 values
commit_id
stringlengths
6
81
CVE ID
stringlengths
13
16
CWE ID
stringclasses
127 values
func
stringlengths
5
484k
vul
int8
0
1
cJSON
94df772485c92866ca417d92137747b2e3b0a917
NOT_APPLICABLE
NOT_APPLICABLE
void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return; newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem; if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
0
linux
fc3a9157d3148ab91039c75423da8ef97be3e105
NOT_APPLICABLE
NOT_APPLICABLE
void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) { if (vcpu->arch.time_page) { kvm_release_page_dirty(vcpu->arch.time_page); vcpu->arch.time_page = NULL; } free_cpumask_var(vcpu->arch.wbinvd_dirty_mask); fx_free(vcpu); kvm_x86_ops->vcpu_free(vcpu); }
0
Chrome
e89cfcb9090e8c98129ae9160c513f504db74599
NOT_APPLICABLE
NOT_APPLICABLE
AutomationProviderBookmarkModelObserver( AutomationProvider* provider, IPC::Message* reply_message, BookmarkModel* model, bool use_json_interface) : automation_provider_(provider->AsWeakPtr()), reply_message_(reply_message), model_(model), use_json_interface_(use_json_interface) { model_->AddObserver(this); }
0
pjproject
560a1346f87aabe126509bb24930106dea292b00
NOT_APPLICABLE
NOT_APPLICABLE
PJ_DEF(int) pjmedia_sdp_media_print(const pjmedia_sdp_media *media, char *buf, pj_size_t size) { return print_media_desc(media, buf, size); }
0
ncurses
790a85dbd4a81d5f5d8dd02a44d84f01512ef443
NOT_APPLICABLE
NOT_APPLICABLE
_nc_mouse_event(SCREEN *sp) { MEVENT *eventp = sp->_mouse_eventp; bool result = FALSE; (void) eventp; switch (sp->_mouse_type) { case M_XTERM: /* xterm: never have to query, mouse events are in the keyboard stream */ #if USE_EMX_MOUSE { char kbuf[3]; int i, res = read(M_FD(sp), &kbuf, 3); /* Eat the prefix */ if (res != 3) printf("Got %d chars instead of 3 for prefix.\n", res); for (i = 0; i < res; i++) { if (kbuf[i] != key_mouse[i]) printf("Got char %d instead of %d for prefix.\n", (int) kbuf[i], (int) key_mouse[i]); } result = TRUE; } #endif /* USE_EMX_MOUSE */ break; #if USE_GPM_SUPPORT case M_GPM: if (sp->_mouse_fd >= 0) { /* query server for event, return TRUE if we find one */ Gpm_Event ev; switch (my_Gpm_GetEvent(&ev)) { case 0: /* Connection closed, drop the mouse. */ sp->_mouse_fd = -1; break; case 1: /* there's only one mouse... */ eventp->id = NORMAL_EVENT; eventp->bstate = 0; switch (ev.type & 0x0f) { case (GPM_DOWN): if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_PRESSED; if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_PRESSED; if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_PRESSED; break; case (GPM_UP): if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_RELEASED; if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_RELEASED; if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_RELEASED; break; default: eventp->bstate |= REPORT_MOUSE_POSITION; break; } eventp->x = ev.x - 1; eventp->y = ev.y - 1; eventp->z = 0; /* bump the next-free pointer into the circular list */ sp->_mouse_eventp = NEXT(eventp); result = TRUE; break; } } break; #endif #if USE_SYSMOUSE case M_SYSMOUSE: if (sp->_sysmouse_head < sp->_sysmouse_tail) { *eventp = sp->_sysmouse_fifo[sp->_sysmouse_head]; /* * Point the fifo-head to the next possible location. If there * are none, reset the indices. This may be interrupted by the * signal handler, doing essentially the same reset. */ sp->_sysmouse_head += 1; if (sp->_sysmouse_head == sp->_sysmouse_tail) { sp->_sysmouse_tail = 0; sp->_sysmouse_head = 0; } /* bump the next-free pointer into the circular list */ sp->_mouse_eventp = eventp = NEXT(eventp); result = TRUE; } break; #endif /* USE_SYSMOUSE */ #ifdef USE_TERM_DRIVER case M_TERM_DRIVER: while (sp->_drv_mouse_head < sp->_drv_mouse_tail) { *eventp = sp->_drv_mouse_fifo[sp->_drv_mouse_head]; /* * Point the fifo-head to the next possible location. If there * are none, reset the indices. */ sp->_drv_mouse_head += 1; if (sp->_drv_mouse_head == sp->_drv_mouse_tail) { sp->_drv_mouse_tail = 0; sp->_drv_mouse_head = 0; } /* bump the next-free pointer into the circular list */ sp->_mouse_eventp = eventp = NEXT(eventp); result = TRUE; } break; #endif case M_NONE: break; } return result; /* true if we found an event */ }
0
libass
f4f48950788b91c6a30029cc28a240b834713ea7
NOT_APPLICABLE
NOT_APPLICABLE
static int cmp_segment(const void *p1, const void *p2) { return ((Segment *) p1)->a - ((Segment *) p2)->a; }
0
Chrome
94bb8861ec61b4ebcce8a4489be2cf7e2a055d90
NOT_APPLICABLE
NOT_APPLICABLE
ConvolverNode::ConvolverNode(AudioContext* context, float sampleRate) : AudioNode(context, sampleRate) , m_normalize(true) { ScriptWrappable::init(this); addInput(adoptPtr(new AudioNodeInput(this))); addOutput(adoptPtr(new AudioNodeOutput(this, 2))); m_channelCount = 2; m_channelCountMode = ClampedMax; m_channelInterpretation = AudioBus::Speakers; setNodeType(NodeTypeConvolver); initialize(); }
0
nautilus
1630f53481f445ada0a455e9979236d31a8d3bb0
NOT_APPLICABLE
NOT_APPLICABLE
extension_info_start (NautilusDirectory *directory, NautilusFile *file, gboolean *doing_io) { NautilusInfoProvider *provider; NautilusOperationResult result; NautilusOperationHandle *handle; GClosure *update_complete; if (directory->details->extension_info_in_progress != NULL) { *doing_io = TRUE; return; } if (!is_needy (file, lacks_extension_info, REQUEST_EXTENSION_INFO)) { return; } *doing_io = TRUE; if (!async_job_start (directory, "extension info")) { return; } provider = file->details->pending_info_providers->data; update_complete = g_cclosure_new (G_CALLBACK (info_provider_callback), directory, NULL); g_closure_set_marshal (update_complete, g_cclosure_marshal_generic); result = nautilus_info_provider_update_file_info (provider, NAUTILUS_FILE_INFO (file), update_complete, &handle); g_closure_unref (update_complete); if (result == NAUTILUS_OPERATION_COMPLETE || result == NAUTILUS_OPERATION_FAILED) { finish_info_provider (directory, file, provider); async_job_end (directory, "extension info"); } else { directory->details->extension_info_in_progress = handle; directory->details->extension_info_provider = provider; directory->details->extension_info_file = file; } }
0
teeworlds
a766cb44bcffcdb0b88e776d01c5ee1323d44f85
NOT_APPLICABLE
NOT_APPLICABLE
static void StrRtrim(char *pStr) { int i = str_length(pStr); while(i >= 0) { if(pStr[i] < 0 || pStr[i] > 32) break; pStr[i] = 0; i--; } }
0
linux
6a024330650e24556b8a18cc654ad00cfecf6c6c
NOT_APPLICABLE
NOT_APPLICABLE
static irqreturn_t fsl_hv_isr(int irq, void *data) { fsl_hv_queue_doorbell((uintptr_t) data); return IRQ_HANDLED; }
0
Chrome
b2b21468c1f7f08b30a7c1755316f6026c50eb2a
NOT_APPLICABLE
NOT_APPLICABLE
bool RenderFlexibleBox::isColumnFlow() const { return style()->isColumnFlexDirection(); }
0
poppler
fada09a2ccc11a3a1d308e810f1336d8df6011fd
NOT_APPLICABLE
NOT_APPLICABLE
long long PDFDoc::strToLongLong(const char *s) { long long x, d; const char *p; x = 0; for (p = s; *p && isdigit(*p & 0xff); ++p) { d = *p - '0'; if (x > (LLONG_MAX - d) / 10) { break; } x = 10 * x + d; } return x; }
0
linux
99253eb750fda6a644d5188fb26c43bad8d5a745
NOT_APPLICABLE
NOT_APPLICABLE
static struct mfc6_cache *ip6mr_cache_alloc(void) { struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); if (!c) return NULL; c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; c->mfc_un.res.minvif = MAXMIFS; return c; }
0
Chrome
4d17163f4b66be517dc49019a029e5ddbd45078c
NOT_APPLICABLE
NOT_APPLICABLE
CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& propertySet) : property(id), value(propertySet.getPropertyCSSValue(id).get()) { }
0
systemd
a924f43f30f9c4acaf70618dd2a055f8b0f166be
NOT_APPLICABLE
NOT_APPLICABLE
int dns_packet_append_question(DnsPacket *p, DnsQuestion *q) { DnsResourceKey *key; int r; assert(p); DNS_QUESTION_FOREACH(key, q) { r = dns_packet_append_key(p, key, 0, NULL); if (r < 0) return r; } return 0; }
0
tor
194e31057fbf07d6bdf4b62d26e1a9db334e5f1c
NOT_APPLICABLE
NOT_APPLICABLE
find_single_ipv6_orport(const smartlist_t *list, tor_addr_t *addr_out, uint16_t *port_out) { int ret = 0; tor_assert(list != NULL); tor_assert(addr_out != NULL); tor_assert(port_out != NULL); SMARTLIST_FOREACH_BEGIN(list, directory_token_t *, t) { tor_addr_t a; maskbits_t bits; uint16_t port_min, port_max; tor_assert(t->n_args >= 1); /* XXXX Prop186 the full spec allows much more than this. */ if (tor_addr_parse_mask_ports(t->args[0], 0, &a, &bits, &port_min, &port_max) == AF_INET6 && bits == 128 && port_min == port_max) { /* Okay, this is one we can understand. Use it and ignore any potential more addresses in list. */ tor_addr_copy(addr_out, &a); *port_out = port_min; ret = 1; break; } } SMARTLIST_FOREACH_END(t); return ret; }
0
Chrome
5fd35e5359c6345b8709695cd71fba307318e6aa
NOT_APPLICABLE
NOT_APPLICABLE
void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled()) return; LayoutRect paintRect = LayoutRect(paintOffset, size()); borderFitAdjust(paintRect); paintMaskImages(paintInfo, paintRect); }
0
linux
e66eded8309ebf679d3d3c1f5820d1f2ca332c71
NOT_APPLICABLE
NOT_APPLICABLE
struct mm_struct *mm_access(struct task_struct *task, unsigned int mode) { struct mm_struct *mm; int err; err = mutex_lock_killable(&task->signal->cred_guard_mutex); if (err) return ERR_PTR(err); mm = get_task_mm(task); if (mm && mm != current->mm && !ptrace_may_access(task, mode)) { mmput(mm); mm = ERR_PTR(-EACCES); } mutex_unlock(&task->signal->cred_guard_mutex); return mm; }
0
gimp
c21eff4b031acb04fb4dfce8bd5fdfecc2b6524f
NOT_APPLICABLE
NOT_APPLICABLE
gimp_test_load_image (Gimp *gimp, GFile *file) { GimpPlugInProcedure *proc; GimpImage *image; GimpPDBStatusType unused; proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager, GIMP_FILE_PROCEDURE_GROUP_OPEN, file, NULL /*error*/); image = file_open_image (gimp, gimp_get_user_context (gimp), NULL /*progress*/, file, file, FALSE /*as_new*/, proc, GIMP_RUN_NONINTERACTIVE, &unused /*status*/, NULL /*mime_type*/, NULL /*error*/); return image; }
0
linux
0ad646c81b2182f7fa67ec0c8c825e0ee165696d
NOT_APPLICABLE
NOT_APPLICABLE
int netdev_set_num_tc(struct net_device *dev, u8 num_tc) { if (num_tc > TC_MAX_QUEUE) return -EINVAL; #ifdef CONFIG_XPS netif_reset_xps_queues_gt(dev, 0); #endif dev->num_tc = num_tc; return 0; }
0
linux
208c72f4fe44fe09577e7975ba0e7fa0278f3d03
NOT_APPLICABLE
NOT_APPLICABLE
struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) { struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); return __cfg80211_testmode_alloc_skb(rdev, approxlen, 0, 0, gfp); }
0
linux
f958d7b528b1b40c44cfda5eabe2d82760d868c3
NOT_APPLICABLE
NOT_APPLICABLE
static inline void __free_reserved_page(struct page *page) { ClearPageReserved(page); init_page_count(page); __free_page(page); }
0
linux
b4487b93545214a9db8cbf32e86411677b0cca21
NOT_APPLICABLE
NOT_APPLICABLE
static int _nfs41_proc_fsid_present(struct inode *inode, const struct cred *cred) { struct nfs_server *server = NFS_SERVER(inode); struct rpc_clnt *clnt = server->client; struct nfs4_fsid_present_arg args = { .fh = NFS_FH(inode), }; struct nfs4_fsid_present_res res = { }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSID_PRESENT], .rpc_argp = &args, .rpc_resp = &res, .rpc_cred = cred, }; int status; res.fh = nfs_alloc_fhandle(); if (res.fh == NULL) return -ENOMEM; nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1); status = nfs4_call_sync_sequence(clnt, server, &msg, &args.seq_args, &res.seq_res); nfs_free_fhandle(res.fh); if (status == NFS4_OK && res.seq_res.sr_status_flags & SEQ4_STATUS_LEASE_MOVED) status = -NFS4ERR_LEASE_MOVED; return status; }
0
Bento4
5eb8cf89d724ccb0b4ce5f24171ec7c11f0a7647
NOT_APPLICABLE
NOT_APPLICABLE
AP4_StszAtom::AP4_StszAtom(AP4_UI32 size, AP4_UI08 version, AP4_UI32 flags, AP4_ByteStream& stream) : AP4_Atom(AP4_ATOM_TYPE_STSZ, size, version, flags) { stream.ReadUI32(m_SampleSize); stream.ReadUI32(m_SampleCount); if (m_SampleSize == 0) { // means that the samples have different sizes // check for overflow if (m_SampleCount > (size-8)/4) { m_SampleCount = 0; return; } // read the entries AP4_Cardinal sample_count = m_SampleCount; m_Entries.SetItemCount(sample_count); unsigned char* buffer = new unsigned char[sample_count*4]; AP4_Result result = stream.Read(buffer, sample_count*4); if (AP4_FAILED(result)) { delete[] buffer; return; } for (unsigned int i=0; i<sample_count; i++) { m_Entries[i] = AP4_BytesToUInt32BE(&buffer[i*4]); } delete[] buffer; } }
0
qemu
971f406b77a6eb84e0ad27dcc416b663765aee30
NOT_APPLICABLE
NOT_APPLICABLE
static int handle_fstat(FsContext *fs_ctx, int fid_type, V9fsFidOpenState *fs, struct stat *stbuf) { int fd; if (fid_type == P9_FID_DIR) { fd = dirfd(fs->dir.stream); } else { fd = fs->fd; } return fstat(fd, stbuf); }
0
Android
122feb9a0b04290f55183ff2f0384c6c53756bd8
CVE-2016-3760
CWE-20
static jboolean enableNative(JNIEnv* env, jobject obj) { ALOGV("%s:",__FUNCTION__); jboolean result = JNI_FALSE; if (!sBluetoothInterface) return result; int ret = sBluetoothInterface->enable(); result = (ret == BT_STATUS_SUCCESS || ret == BT_STATUS_DONE) ? JNI_TRUE : JNI_FALSE; return result; }
1
ImageMagick
de5deab202c340162b65f65bafbbe17b1eda2c1a
NOT_APPLICABLE
NOT_APPLICABLE
static MagickCLEnv AcquireMagickCLEnv(void) { const char *option; MagickCLEnv clEnv; clEnv=(MagickCLEnv) AcquireMagickMemory(sizeof(*clEnv)); if (clEnv != (MagickCLEnv) NULL) { (void) ResetMagickMemory(clEnv,0,sizeof(*clEnv)); ActivateSemaphoreInfo(&clEnv->lock); clEnv->cpu_score=MAGICKCORE_OPENCL_UNDEFINED_SCORE; clEnv->enabled=MagickTrue; option=getenv("MAGICK_OCL_DEVICE"); if ((option != (const char *) NULL) && (strcmp(option,"OFF") == 0)) clEnv->enabled=MagickFalse; } return clEnv; }
0
linux
b4487b93545214a9db8cbf32e86411677b0cca21
NOT_APPLICABLE
NOT_APPLICABLE
static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) { nfs41_release_slot(res->sr_slot); res->sr_slot = NULL; }
0
linux
9b54d816e00425c3a517514e0d677bb3cec49258
NOT_APPLICABLE
NOT_APPLICABLE
int blkcg_init_queue(struct request_queue *q) { struct blkcg_gq *new_blkg, *blkg; bool preloaded; int ret; new_blkg = blkg_alloc(&blkcg_root, q, GFP_KERNEL); if (!new_blkg) return -ENOMEM; preloaded = !radix_tree_preload(GFP_KERNEL); /* * Make sure the root blkg exists and count the existing blkgs. As * @q is bypassing at this point, blkg_lookup_create() can't be * used. Open code insertion. */ rcu_read_lock(); spin_lock_irq(q->queue_lock); blkg = blkg_create(&blkcg_root, q, new_blkg); spin_unlock_irq(q->queue_lock); rcu_read_unlock(); if (preloaded) radix_tree_preload_end(); if (IS_ERR(blkg)) return PTR_ERR(blkg); q->root_blkg = blkg; q->root_rl.blkg = blkg; ret = blk_throtl_init(q); if (ret) { spin_lock_irq(q->queue_lock); blkg_destroy_all(q); spin_unlock_irq(q->queue_lock); } return ret; }
0
linux
5d6751eaff672ea77642e74e92e6c0ac7f9709ab
NOT_APPLICABLE
NOT_APPLICABLE
static int ath6kl_wmi_pspoll_event_rx(struct wmi *wmi, u8 *datap, int len, struct ath6kl_vif *vif) { struct wmi_pspoll_event *ev; if (len < sizeof(struct wmi_pspoll_event)) return -EINVAL; ev = (struct wmi_pspoll_event *) datap; ath6kl_pspoll_event(vif, le16_to_cpu(ev->aid)); return 0; }
0
dcmtk
beaf5a5c24101daeeafa48c375120b16197c9e95
NOT_APPLICABLE
NOT_APPLICABLE
void DcmSCP::notifyReleaseRequest() { DCMNET_INFO("Received Association Release Request"); }
0
Chrome
a6f7726de20450074a01493e4e85409ce3f2595a
NOT_APPLICABLE
NOT_APPLICABLE
void Document::webkitCancelFullScreen() { if (!topDocument()->webkitFullscreenElement()) return; Vector<RefPtr<Element> > replacementFullscreenElementStack; replacementFullscreenElementStack.append(topDocument()->webkitFullscreenElement()); topDocument()->m_fullScreenElementStack.swap(replacementFullscreenElementStack); topDocument()->webkitExitFullscreen(); }
0
asylo
a47ef55db2337d29de19c50cd29b0deb2871d31c
NOT_APPLICABLE
NOT_APPLICABLE
UntrustedCacheMalloc::~UntrustedCacheMalloc() { while (!buffer_pool_.empty()) { PushToFreeList(buffer_pool_.top()); buffer_pool_.pop(); } // Free remaining elements in the free_list_. // The free_list_ object and the struct FreeList member buffers are destroyed // when the unique pointers referencing them go out of scope. if (free_list_->count > 0) { primitives::DeAllocateUntrustedBuffers(free_list_->buffers.get(), free_list_->count); } is_destroyed_ = true; }
0
qemu
65d35a09979e63541afc5bfc595b9f1b1b4ae069
CVE-2007-1320
CWE-787
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s) { if (s->ds->dpy_copy) { cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->start_addr, s->cirrus_blt_srcaddr - s->start_addr, s->cirrus_blt_width, s->cirrus_blt_height); } else { if (BLTUNSAFE(s)) return 0; (*s->cirrus_rop) (s, s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), s->vram_ptr + (s->cirrus_blt_srcaddr & s->cirrus_addr_mask), s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch, s->cirrus_blt_width, s->cirrus_blt_height); cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_width, s->cirrus_blt_height); } return 1; }
1
linux
6a76f8c0ab19f215af2a3442870eeb5f0e81998d
NOT_APPLICABLE
NOT_APPLICABLE
static void __init set_ftrace_early_graph(char *buf) { int ret; char *func; while (buf) { func = strsep(&buf, ","); /* we allow only one expression at a time */ ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, func); if (ret) printk(KERN_DEBUG "ftrace: function %s not " "traceable\n", func); } }
0
openssl
bc8923b1ec9c467755cd86f7848c50ee8812e441
NOT_APPLICABLE
NOT_APPLICABLE
int ssl3_get_client_hello(SSL *s) { int i,j,ok,al,ret= -1; unsigned int cookie_len; long n; unsigned long id; unsigned char *p,*d,*q; SSL_CIPHER *c; #ifndef OPENSSL_NO_COMP SSL_COMP *comp=NULL; #endif STACK_OF(SSL_CIPHER) *ciphers=NULL; /* We do this so that we will respond with our native type. * If we are TLSv1 and we get SSLv3, we will respond with TLSv1, * This down switching should be handled by a different method. * If we are SSLv3, we will respond with SSLv3, even if prompted with * TLSv1. */ if (s->state == SSL3_ST_SR_CLNT_HELLO_A ) { s->state=SSL3_ST_SR_CLNT_HELLO_B; } s->first_packet=1; n=s->method->ssl_get_message(s, SSL3_ST_SR_CLNT_HELLO_B, SSL3_ST_SR_CLNT_HELLO_C, SSL3_MT_CLIENT_HELLO, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); s->first_packet=0; d=p=(unsigned char *)s->init_msg; /* use version from inside client hello, not from record header * (may differ: see RFC 2246, Appendix E, second paragraph) */ s->client_version=(((int)p[0])<<8)|(int)p[1]; p+=2; if ((s->version == DTLS1_VERSION && s->client_version > s->version) || (s->version != DTLS1_VERSION && s->client_version < s->version)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); if ((s->client_version>>8) == SSL3_VERSION_MAJOR && !s->enc_write_ctx && !s->write_hash) { /* similar to ssl3_get_record, send alert using remote version number */ s->version = s->client_version; } al = SSL_AD_PROTOCOL_VERSION; goto f_err; } /* If we require cookies and this ClientHello doesn't * contain one, just return since we do not want to * allocate any memory yet. So check cookie length... */ if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { unsigned int session_length, cookie_length; session_length = *(p + SSL3_RANDOM_SIZE); cookie_length = *(p + SSL3_RANDOM_SIZE + session_length + 1); if (cookie_length == 0) return 1; } /* load the client random */ memcpy(s->s3->client_random,p,SSL3_RANDOM_SIZE); p+=SSL3_RANDOM_SIZE; /* get the session-id */ j= *(p++); s->hit=0; /* Versions before 0.9.7 always allow clients to resume sessions in renegotiation. * 0.9.7 and later allow this by default, but optionally ignore resumption requests * with flag SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new flag rather * than a change to default behavior so that applications relying on this for security * won't even compile against older library versions). * * 1.0.1 and later also have a function SSL_renegotiate_abbreviated() to request * renegotiation but not a new session (s->new_session remains unset): for servers, * this essentially just means that the SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION * setting will be ignored. */ if ((s->new_session && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION))) { if (!ssl_get_new_session(s,1)) goto err; } else { i=ssl_get_prev_session(s, p, j, d + n); if (i == 1) { /* previous session */ s->hit=1; } else if (i == -1) goto err; else /* i == 0 */ { if (!ssl_get_new_session(s,1)) goto err; } } p+=j; if (s->version == DTLS1_VERSION || s->version == DTLS1_BAD_VER) { /* cookie stuff */ cookie_len = *(p++); /* * The ClientHello may contain a cookie even if the * HelloVerify message has not been sent--make sure that it * does not cause an overflow. */ if ( cookie_len > sizeof(s->d1->rcvd_cookie)) { /* too much data */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* verify the cookie if appropriate option is set. */ if ((SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) && cookie_len > 0) { memcpy(s->d1->rcvd_cookie, p, cookie_len); if ( s->ctx->app_verify_cookie_cb != NULL) { if ( s->ctx->app_verify_cookie_cb(s, s->d1->rcvd_cookie, cookie_len) == 0) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* else cookie verification succeeded */ } else if ( memcmp(s->d1->rcvd_cookie, s->d1->cookie, s->d1->cookie_len) != 0) /* default verification */ { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } ret = 2; } p += cookie_len; } n2s(p,i); if ((i == 0) && (j != 0)) { /* we need a cipher if we are not resuming a session */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_CIPHERS_SPECIFIED); goto f_err; } if ((p+i) >= (d+n)) { /* not enough data */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_LENGTH_MISMATCH); goto f_err; } if ((i > 0) && (ssl_bytes_to_cipher_list(s,p,i,&(ciphers)) == NULL)) { goto err; } p+=i; /* If it is a hit, check that the cipher is in the list */ if ((s->hit) && (i > 0)) { j=0; id=s->session->cipher->id; #ifdef CIPHER_DEBUG printf("client sent %d ciphers\n",sk_num(ciphers)); #endif for (i=0; i<sk_SSL_CIPHER_num(ciphers); i++) { c=sk_SSL_CIPHER_value(ciphers,i); #ifdef CIPHER_DEBUG printf("client [%2d of %2d]:%s\n", i,sk_num(ciphers),SSL_CIPHER_get_name(c)); #endif if (c->id == id) { j=1; break; } } /* Disabled because it can be used in a ciphersuite downgrade * attack: CVE-2010-4180. */ #if 0 if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG) && (sk_SSL_CIPHER_num(ciphers) == 1)) { /* Special case as client bug workaround: the previously used cipher may * not be in the current list, the client instead might be trying to * continue using a cipher that before wasn't chosen due to server * preferences. We'll have to reject the connection if the cipher is not * enabled, though. */ c = sk_SSL_CIPHER_value(ciphers, 0); if (sk_SSL_CIPHER_find(SSL_get_ciphers(s), c) >= 0) { s->session->cipher = c; j = 1; } } #endif if (j == 0) { /* we need to have the cipher in the cipher * list if we are asked to reuse it */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_REQUIRED_CIPHER_MISSING); goto f_err; } } /* compression */ i= *(p++); if ((p+i) > (d+n)) { /* not enough data */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_LENGTH_MISMATCH); goto f_err; } q=p; for (j=0; j<i; j++) { if (p[j] == 0) break; } p+=i; if (j >= i) { /* no compress */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_COMPRESSION_SPECIFIED); goto f_err; } #ifndef OPENSSL_NO_TLSEXT /* TLS extensions*/ if (s->version >= SSL3_VERSION) { if (!ssl_parse_clienthello_tlsext(s,&p,d,n, &al)) { /* 'al' set by ssl_parse_clienthello_tlsext */ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_PARSE_TLSEXT); goto f_err; } } if (ssl_check_clienthello_tlsext_early(s) <= 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); goto err; } /* Check if we want to use external pre-shared secret for this * handshake for not reused session only. We need to generate * server_random before calling tls_session_secret_cb in order to allow * SessionTicket processing to use it in key derivation. */ { unsigned char *pos; pos=s->s3->server_random; if (ssl_fill_hello_random(s, 1, pos, SSL3_RANDOM_SIZE) <= 0) { al=SSL_AD_INTERNAL_ERROR; goto f_err; } } if (!s->hit && s->version >= TLS1_VERSION && s->tls_session_secret_cb) { SSL_CIPHER *pref_cipher=NULL; s->session->master_key_length=sizeof(s->session->master_key); if(s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length, ciphers, &pref_cipher, s->tls_session_secret_cb_arg)) { s->hit=1; s->session->ciphers=ciphers; s->session->verify_result=X509_V_OK; ciphers=NULL; /* check if some cipher was preferred by call back */ pref_cipher=pref_cipher ? pref_cipher : ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s)); if (pref_cipher == NULL) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER); goto f_err; } s->session->cipher=pref_cipher; if (s->cipher_list) sk_SSL_CIPHER_free(s->cipher_list); if (s->cipher_list_by_id) sk_SSL_CIPHER_free(s->cipher_list_by_id); s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers); } } #endif /* Worst case, we will use the NULL compression, but if we have other * options, we will now look for them. We have i-1 compression * algorithms from the client, starting at q. */ s->s3->tmp.new_compression=NULL; #ifndef OPENSSL_NO_COMP /* This only happens if we have a cache hit */ if (s->session->compress_meth != 0) { int m, comp_id = s->session->compress_meth; /* Perform sanity checks on resumed compression algorithm */ /* Can't disable compression */ if (s->options & SSL_OP_NO_COMPRESSION) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } /* Look for resumed compression method */ for (m = 0; m < sk_SSL_COMP_num(s->ctx->comp_methods); m++) { comp=sk_SSL_COMP_value(s->ctx->comp_methods,m); if (comp_id == comp->id) { s->s3->tmp.new_compression=comp; break; } } if (s->s3->tmp.new_compression == NULL) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INVALID_COMPRESSION_ALGORITHM); goto f_err; } /* Look for resumed method in compression list */ for (m = 0; m < i; m++) { if (q[m] == comp_id) break; } if (m >= i) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING); goto f_err; } } else if (s->hit) comp = NULL; else if (!(s->options & SSL_OP_NO_COMPRESSION) && s->ctx->comp_methods) { /* See if we have a match */ int m,nn,o,v,done=0; nn=sk_SSL_COMP_num(s->ctx->comp_methods); for (m=0; m<nn; m++) { comp=sk_SSL_COMP_value(s->ctx->comp_methods,m); v=comp->id; for (o=0; o<i; o++) { if (v == q[o]) { done=1; break; } } if (done) break; } if (done) s->s3->tmp.new_compression=comp; else comp=NULL; } #else /* If compression is disabled we'd better not try to resume a session * using compression. */ if (s->session->compress_meth != 0) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } #endif /* Given s->session->ciphers and SSL_get_ciphers, we must * pick a cipher */ if (!s->hit) { #ifdef OPENSSL_NO_COMP s->session->compress_meth=0; #else s->session->compress_meth=(comp == NULL)?0:comp->id; #endif if (s->session->ciphers != NULL) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers=ciphers; if (ciphers == NULL) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_CIPHERS_PASSED); goto f_err; } ciphers=NULL; c=ssl3_choose_cipher(s,s->session->ciphers, SSL_get_ciphers(s)); if (c == NULL) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER); goto f_err; } s->s3->tmp.new_cipher=c; } else { /* Session-id reuse */ #ifdef REUSE_CIPHER_BUG STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *nc=NULL; SSL_CIPHER *ec=NULL; if (s->options & SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG) { sk=s->session->ciphers; for (i=0; i<sk_SSL_CIPHER_num(sk); i++) { c=sk_SSL_CIPHER_value(sk,i); if (c->algorithm_enc & SSL_eNULL) nc=c; if (SSL_C_IS_EXPORT(c)) ec=c; } if (nc != NULL) s->s3->tmp.new_cipher=nc; else if (ec != NULL) s->s3->tmp.new_cipher=ec; else s->s3->tmp.new_cipher=s->session->cipher; } else #endif s->s3->tmp.new_cipher=s->session->cipher; } if (TLS1_get_version(s) < TLS1_2_VERSION || !(s->verify_mode & SSL_VERIFY_PEER)) { if (!ssl3_digest_cached_records(s)) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } } /* we now have the following setup. * client_random * cipher_list - our prefered list of ciphers * ciphers - the clients prefered list of ciphers * compression - basically ignored right now * ssl version is set - sslv3 * s->session - The ssl session has been setup. * s->hit - session reuse flag * s->tmp.new_cipher - the new cipher to use. */ /* Handles TLS extensions that we couldn't check earlier */ if (s->version >= SSL3_VERSION) { if (ssl_check_clienthello_tlsext_late(s) <= 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } } if (ret < 0) ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } err: if (ciphers != NULL) sk_SSL_CIPHER_free(ciphers); return(ret); }
0
ImageMagick
8c35502217c1879cb8257c617007282eee3fe1cc
NOT_APPLICABLE
NOT_APPLICABLE
void Magick::Image::filterType(const Magick::FilterType filterType_) { modifyImage(); image()->filter=filterType_; }
0
linux
6817ae225cd650fb1c3295d769298c38b1eba818
NOT_APPLICABLE
NOT_APPLICABLE
static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff) { struct whiteheat_set_rdb dtr_command; dtr_command.port = port->port_number + 1; dtr_command.state = onoff; return firm_send_command(port, WHITEHEAT_SET_DTR, (__u8 *)&dtr_command, sizeof(dtr_command)); }
0
uriparser
864f5d4c127def386dd5cc926ad96934b297f04e
NOT_APPLICABLE
NOT_APPLICABLE
void testUriUserInfoHostPort23_Bug3510198_2() { UriParserStateA stateA; UriUriA uriA; stateA.uri = &uriA; int res; res = uriParseUriA(&stateA, "http" "://" "%2Fuser:%2F21" "@" "host" "/"); TEST_ASSERT(URI_SUCCESS == res); TEST_ASSERT(!memcmp(uriA.userInfo.first, "%2Fuser:%2F21", 13 * sizeof(char))); TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 13); TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char))); TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4); TEST_ASSERT(uriA.portText.first == NULL); TEST_ASSERT(uriA.portText.afterLast == NULL); uriFreeUriMembersA(&uriA); }
0
samba
31f1a36901b5b8959dc51401c09c114829b50392
NOT_APPLICABLE
NOT_APPLICABLE
static void __pam_log_debug(const pam_handle_t *pamh, int ctrl, int err, const char *format, ...) { va_list args; if (!_pam_log_is_debug_enabled(ctrl)) { return; } va_start(args, format); _pam_log_int(pamh, err, format, args); va_end(args); }
0
Chrome
0bd1a6ddb5fb23dfea3e72d60e5e8df4cf5826bc
NOT_APPLICABLE
NOT_APPLICABLE
bool GetWindowDesktop(XID window, int* desktop) { return GetIntProperty(window, "_NET_WM_DESKTOP", desktop); }
0
mbedtls
740b218386083dc708ce98ccc94a63a95cd5629e
NOT_APPLICABLE
NOT_APPLICABLE
static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; size_t n = 0, offset = 0; unsigned char hash[48]; unsigned char *hash_start = hash; mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE; unsigned int hashlen; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write certificate verify" ) ); if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret ); return( ret ); } if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) ); ssl->state++; return( 0 ); } if( ssl->client_auth == 0 || mbedtls_ssl_own_cert( ssl ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) ); ssl->state++; return( 0 ); } if( mbedtls_ssl_own_key( ssl ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no private key for certificate" ) ); return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ); } /* * Make an RSA signature of the handshake digests */ ssl->handshake->calc_verify( ssl, hash ); #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) if( ssl->minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 ) { /* * digitally-signed struct { * opaque md5_hash[16]; * opaque sha_hash[20]; * }; * * md5_hash * MD5(handshake_messages); * * sha_hash * SHA(handshake_messages); */ hashlen = 36; md_alg = MBEDTLS_MD_NONE; /* * For ECDSA, default hash is SHA-1 only */ if( mbedtls_pk_can_do( mbedtls_ssl_own_key( ssl ), MBEDTLS_PK_ECDSA ) ) { hash_start += 16; hashlen -= 16; md_alg = MBEDTLS_MD_SHA1; } } else #endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \ MBEDTLS_SSL_PROTO_TLS1_1 */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 ) { /* * digitally-signed struct { * opaque handshake_messages[handshake_messages_length]; * }; * * Taking shortcut here. We assume that the server always allows the * PRF Hash function and has sent it in the allowed signature * algorithms list received in the Certificate Request message. * * Until we encounter a server that does not, we will take this * shortcut. * * Reason: Otherwise we should have running hashes for SHA512 and SHA224 * in order to satisfy 'weird' needs from the server side. */ if( ssl->transform_negotiate->ciphersuite_info->mac == MBEDTLS_MD_SHA384 ) { md_alg = MBEDTLS_MD_SHA384; ssl->out_msg[4] = MBEDTLS_SSL_HASH_SHA384; } else { md_alg = MBEDTLS_MD_SHA256; ssl->out_msg[4] = MBEDTLS_SSL_HASH_SHA256; } ssl->out_msg[5] = mbedtls_ssl_sig_from_pk( mbedtls_ssl_own_key( ssl ) ); /* Info from md_alg will be used instead */ hashlen = 0; offset = 2; } else #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } if( ( ret = mbedtls_pk_sign( mbedtls_ssl_own_key( ssl ), md_alg, hash_start, hashlen, ssl->out_msg + 6 + offset, &n, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_sign", ret ); return( ret ); } ssl->out_msg[4 + offset] = (unsigned char)( n >> 8 ); ssl->out_msg[5 + offset] = (unsigned char)( n ); ssl->out_msglen = 6 + n + offset; ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; ssl->out_msg[0] = MBEDTLS_SSL_HS_CERTIFICATE_VERIFY; ssl->state++; if( ( ret = mbedtls_ssl_write_record( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_record", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write certificate verify" ) ); return( ret ); }
0
linux-2.6
8faece5f906725c10e7a1f6caf84452abadbdc7b
CVE-2009-0787
CWE-189
ecryptfs_write_metadata_to_contents(struct ecryptfs_crypt_stat *crypt_stat, struct dentry *ecryptfs_dentry, char *virt) { int rc; rc = ecryptfs_write_lower(ecryptfs_dentry->d_inode, virt, 0, crypt_stat->num_header_bytes_at_front); if (rc) printk(KERN_ERR "%s: Error attempting to write header " "information to lower file; rc = [%d]\n", __func__, rc); return rc; }
1
linux
a4270d6795b0580287453ea55974d948393e66ef
NOT_APPLICABLE
NOT_APPLICABLE
static int __netdev_adjacent_dev_insert(struct net_device *dev, struct net_device *adj_dev, struct list_head *dev_list, void *private, bool master) { struct netdev_adjacent *adj; int ret; adj = __netdev_find_adj(adj_dev, dev_list); if (adj) { adj->ref_nr += 1; pr_debug("Insert adjacency: dev %s adj_dev %s adj->ref_nr %d\n", dev->name, adj_dev->name, adj->ref_nr); return 0; } adj = kmalloc(sizeof(*adj), GFP_KERNEL); if (!adj) return -ENOMEM; adj->dev = adj_dev; adj->master = master; adj->ref_nr = 1; adj->private = private; dev_hold(adj_dev); pr_debug("Insert adjacency: dev %s adj_dev %s adj->ref_nr %d; dev_hold on %s\n", dev->name, adj_dev->name, adj->ref_nr, adj_dev->name); if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) { ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); if (ret) goto free_adj; } /* Ensure that master link is always the first item in list. */ if (master) { ret = sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj), "master"); if (ret) goto remove_symlinks; list_add_rcu(&adj->list, dev_list); } else { list_add_tail_rcu(&adj->list, dev_list); } return 0; remove_symlinks: if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); free_adj: kfree(adj); dev_put(adj_dev); return ret;
0
Android
e68cbc3e9e66df4231e70efa3e9c41abc12aea20
NOT_APPLICABLE
NOT_APPLICABLE
native_handle* Parcel::readNativeHandle() const { int numFds, numInts; status_t err; err = readInt32(&numFds); if (err != NO_ERROR) return 0; err = readInt32(&numInts); if (err != NO_ERROR) return 0; native_handle* h = native_handle_create(numFds, numInts); if (!h) { return 0; } for (int i=0 ; err==NO_ERROR && i<numFds ; i++) { h->data[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; } err = read(h->data + numFds, sizeof(int)*numInts); if (err != NO_ERROR) { native_handle_close(h); native_handle_delete(h); h = 0; } return h; }
0
frr
6d58272b4cf96f0daa846210dd2104877900f921
NOT_APPLICABLE
NOT_APPLICABLE
DEFUN (address_family_ipv4_safi, address_family_ipv4_safi_cmd, "address-family ipv4 (unicast|multicast)", "Enter Address Family command mode\n" "Address family\n" "Address Family modifier\n" "Address Family modifier\n") { if (strncmp (argv[0], "m", 1) == 0) vty->node = BGP_IPV4M_NODE; else vty->node = BGP_IPV4_NODE; return CMD_SUCCESS; }
0
w3m
4e464819dd360ffd3d58fa2a89216fe413cfcc74
NOT_APPLICABLE
NOT_APPLICABLE
registerHref(Buffer *buf, char *url, char *target, char *referer, char *title, unsigned char key, int line, int pos) { Anchor *a; buf->href = putAnchor(buf->href, url, target, &a, referer, title, key, line, pos); return a; }
0
linux
0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd
NOT_APPLICABLE
NOT_APPLICABLE
static int vfat_unlink(struct inode *dir, struct dentry *dentry) { struct inode *inode = dentry->d_inode; struct super_block *sb = dir->i_sb; struct fat_slot_info sinfo; int err; lock_super(sb); err = vfat_find(dir, &dentry->d_name, &sinfo); if (err) goto out; err = fat_remove_entries(dir, &sinfo); /* and releases bh */ if (err) goto out; clear_nlink(inode); inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; fat_detach(inode); out: unlock_super(sb); return err; }
0
Android
68f67ef6cf1f41e77337be3bc4bff91f3a3c6324
NOT_APPLICABLE
NOT_APPLICABLE
bool ASessionDescription::isValid() const { return mIsValid; }
0
linux
59c4bd853abcea95eccc167a7d7fd5f1a5f47b98
NOT_APPLICABLE
NOT_APPLICABLE
static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu) { if (static_cpu_has(X86_FEATURE_FPU) && !(current->flags & PF_KTHREAD)) { if (!copy_fpregs_to_fpstate(old_fpu)) old_fpu->last_cpu = -1; else old_fpu->last_cpu = cpu; /* But leave fpu_fpregs_owner_ctx! */ trace_x86_fpu_regs_deactivated(old_fpu); } }
0
Chrome
c552cd7b8a0862f6b3c8c6a07f98bda3721101eb
NOT_APPLICABLE
NOT_APPLICABLE
bool BrowserView::CanActivate() const { app_modal::AppModalDialogQueue* queue = app_modal::AppModalDialogQueue::GetInstance(); if (!queue->active_dialog() || !queue->active_dialog()->native_dialog() || !queue->active_dialog()->native_dialog()->IsShowing()) { return true; } #if defined(USE_AURA) && defined(OS_CHROMEOS) queue->ActivateModalDialog(); #else base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&BrowserView::ActivateAppModalDialog, activate_modal_dialog_factory_.GetWeakPtr())); #endif return false; }
0
linux
72a763d805a48ac8c0bf48fdb510e84c12de51fe
NOT_APPLICABLE
NOT_APPLICABLE
static void __exit algif_hash_exit(void) { int err = af_alg_unregister_type(&algif_type_hash); BUG_ON(err); }
0
linux
983d8e60f50806f90534cc5373d0ce867e5aaf79
NOT_APPLICABLE
NOT_APPLICABLE
xfs_attr_filter( u32 ioc_flags) { if (ioc_flags & XFS_IOC_ATTR_ROOT) return XFS_ATTR_ROOT; if (ioc_flags & XFS_IOC_ATTR_SECURE) return XFS_ATTR_SECURE; return 0; }
0
Chrome
93bc623489bdcfc7e9127614fcfb3258edf3f0f9
NOT_APPLICABLE
NOT_APPLICABLE
void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { ConsoleHelper helper(info); String16 title = helper.firstArgToString(String16()); String16 identifier; if (title.isEmpty()) { std::unique_ptr<V8StackTraceImpl> stackTrace = V8StackTraceImpl::capture(nullptr, 0, 1); if (stackTrace) identifier = stackTrace->topSourceURL() + ":" + String16::fromInteger(stackTrace->topLineNumber()); } else { identifier = title + "@"; } v8::Local<v8::Map> countMap; if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; helper.setIntOnMap(countMap, identifier, count); helper.reportCallWithArgument(ConsoleAPIType::kCount, title + ": " + String16::fromInteger(count)); }
0
Chrome
1777aa6484af15014b8691082a8c3075418786f5
NOT_APPLICABLE
NOT_APPLICABLE
void QQuickWebViewFlickablePrivate::_q_resume() { if (!interactionEngine) return; pageIsSuspended = false; webPageProxy->resumeActiveDOMObjectsAndAnimations(); if (isTransitioningToNewPage) { isTransitioningToNewPage = false; postTransitionState->apply(); } _q_commitScaleChange(); }
0
Android
65c49d5b382de4085ee5668732bcb0f6ecaf7148
NOT_APPLICABLE
NOT_APPLICABLE
long VideoTrack::Seek(long long time_ns, const BlockEntry*& pResult) const { const long status = GetFirst(pResult); if (status < 0) // buffer underflow, etc return status; assert(pResult); if (pResult->EOS()) return 0; const Cluster* pCluster = pResult->GetCluster(); assert(pCluster); assert(pCluster->GetIndex() >= 0); if (time_ns <= pResult->GetBlock()->GetTime(pCluster)) return 0; Cluster** const clusters = m_pSegment->m_clusters; assert(clusters); const long count = m_pSegment->GetCount(); // loaded only, not pre-loaded assert(count > 0); Cluster** const i = clusters + pCluster->GetIndex(); assert(i); assert(*i == pCluster); assert(pCluster->GetTime() <= time_ns); Cluster** const j = clusters + count; Cluster** lo = i; Cluster** hi = j; while (lo < hi) { Cluster** const mid = lo + (hi - lo) / 2; assert(mid < hi); pCluster = *mid; assert(pCluster); assert(pCluster->GetIndex() >= 0); assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters)); const long long t = pCluster->GetTime(); if (t <= time_ns) lo = mid + 1; else hi = mid; assert(lo <= hi); } assert(lo == hi); assert(lo > i); assert(lo <= j); pCluster = *--lo; assert(pCluster); assert(pCluster->GetTime() <= time_ns); pResult = pCluster->GetEntry(this, time_ns); if ((pResult != 0) && !pResult->EOS()) // found a keyframe return 0; while (lo != i) { pCluster = *--lo; assert(pCluster); assert(pCluster->GetTime() <= time_ns); pResult = pCluster->GetEntry(this, time_ns); if ((pResult != 0) && !pResult->EOS()) return 0; } pResult = GetEOS(); return 0; }
0
linux
072684e8c58d17e853f8e8b9f6d9ce2e58d2b036
NOT_APPLICABLE
NOT_APPLICABLE
static void hidg_unbind(struct usb_configuration *c, struct usb_function *f) { struct f_hidg *hidg = func_to_hidg(f); device_destroy(hidg_class, MKDEV(major, hidg->minor)); cdev_del(&hidg->cdev); usb_free_all_descriptors(f); }
0
memcached
d9cd01ede97f4145af9781d448c62a3318952719
NOT_APPLICABLE
NOT_APPLICABLE
static const char *prot_text(enum protocol prot) { char *rv = "unknown"; switch(prot) { case ascii_prot: rv = "ascii"; break; case binary_prot: rv = "binary"; break; case negotiating_prot: rv = "auto-negotiate"; break; } return rv; }
0
linux
6b3a707736301c2128ca85ce85fb13f60b5e350a
NOT_APPLICABLE
NOT_APPLICABLE
void trace_buffered_event_disable(void) { int cpu; WARN_ON_ONCE(!mutex_is_locked(&event_mutex)); if (WARN_ON_ONCE(!trace_buffered_event_ref)) return; if (--trace_buffered_event_ref) return; preempt_disable(); /* For each CPU, set the buffer as used. */ smp_call_function_many(tracing_buffer_mask, disable_trace_buffered_event, NULL, 1); preempt_enable(); /* Wait for all current users to finish */ synchronize_rcu(); for_each_tracing_cpu(cpu) { free_page((unsigned long)per_cpu(trace_buffered_event, cpu)); per_cpu(trace_buffered_event, cpu) = NULL; } /* * Make sure trace_buffered_event is NULL before clearing * trace_buffered_event_cnt. */ smp_wmb(); preempt_disable(); /* Do the work on each cpu */ smp_call_function_many(tracing_buffer_mask, enable_trace_buffered_event, NULL, 1); preempt_enable(); }
0
libarchive
a550daeecf6bc689ade371349892ea17b5b97c77
NOT_APPLICABLE
NOT_APPLICABLE
skip(struct archive_read *a) { struct mtree *mtree; mtree = (struct mtree *)(a->format->data); if (mtree->fd >= 0) { close(mtree->fd); mtree->fd = -1; } return (ARCHIVE_OK); }
0
hhvm
8e7266fef1f329b805b37f32c9ad0090215ab269
NOT_APPLICABLE
NOT_APPLICABLE
SimpleXMLElement() { auto obj = Native::object<SimpleXMLElement>(this); obj->setAttribute(ObjectData::HasPropEmpty); obj->setAttribute(ObjectData::CallToImpl); }
0
tcpdump
061e7371a944588f231cb1b66d6fb070b646e376
NOT_APPLICABLE
NOT_APPLICABLE
ikev2_ID_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct ikev2_id id; int id_len, idtype_len, i; unsigned int dumpascii, dumphex; const unsigned char *typedata; ND_TCHECK(*ext); UNALIGNED_MEMCPY(&id, ext, sizeof(id)); ikev2_pay_print(ndo, NPSTR(tpay), id.h.critical); id_len = ntohs(id.h.len); ND_PRINT((ndo," len=%d", id_len - 4)); if (2 < ndo->ndo_vflag && 4 < id_len) { ND_PRINT((ndo," ")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), id_len - 4)) goto trunc; } idtype_len =id_len - sizeof(struct ikev2_id); dumpascii = 0; dumphex = 0; typedata = (const unsigned char *)(ext)+sizeof(struct ikev2_id); switch(id.type) { case ID_IPV4_ADDR: ND_PRINT((ndo, " ipv4:")); dumphex=1; break; case ID_FQDN: ND_PRINT((ndo, " fqdn:")); dumpascii=1; break; case ID_RFC822_ADDR: ND_PRINT((ndo, " rfc822:")); dumpascii=1; break; case ID_IPV6_ADDR: ND_PRINT((ndo, " ipv6:")); dumphex=1; break; case ID_DER_ASN1_DN: ND_PRINT((ndo, " dn:")); dumphex=1; break; case ID_DER_ASN1_GN: ND_PRINT((ndo, " gn:")); dumphex=1; break; case ID_KEY_ID: ND_PRINT((ndo, " keyid:")); dumphex=1; break; } if(dumpascii) { ND_TCHECK2(*typedata, idtype_len); for(i=0; i<idtype_len; i++) { if(ND_ISPRINT(typedata[i])) { ND_PRINT((ndo, "%c", typedata[i])); } else { ND_PRINT((ndo, ".")); } } } if(dumphex) { if (!rawprint(ndo, (const uint8_t *)typedata, idtype_len)) goto trunc; } return (const u_char *)ext + id_len; trunc: ND_PRINT((ndo," [|%s]", NPSTR(tpay))); return NULL; }
0
Chrome
7f3d85b096f66870a15b37c2f40b219b2e292693
NOT_APPLICABLE
NOT_APPLICABLE
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) { #ifdef PNG_SETJMP_SUPPORTED jmp_buf tmp_jmp; #endif png_error_ptr error_fn; png_error_ptr warning_fn; png_voidp error_ptr; #ifdef PNG_USER_MEM_SUPPORTED png_free_ptr free_fn; #endif png_debug(1, "in png_read_destroy"); if (info_ptr != NULL) png_info_destroy(png_ptr, info_ptr); if (end_info_ptr != NULL) png_info_destroy(png_ptr, end_info_ptr); png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->big_row_buf); png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->chunkdata); #ifdef PNG_READ_DITHER_SUPPORTED png_free(png_ptr, png_ptr->palette_lookup); png_free(png_ptr, png_ptr->dither_index); #endif #ifdef PNG_READ_GAMMA_SUPPORTED png_free(png_ptr, png_ptr->gamma_table); #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED png_free(png_ptr, png_ptr->gamma_from_1); png_free(png_ptr, png_ptr->gamma_to_1); #endif #ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_PLTE) png_zfree(png_ptr, png_ptr->palette); png_ptr->free_me &= ~PNG_FREE_PLTE; #else if (png_ptr->flags & PNG_FLAG_FREE_PLTE) png_zfree(png_ptr, png_ptr->palette); png_ptr->flags &= ~PNG_FLAG_FREE_PLTE; #endif #if defined(PNG_tRNS_SUPPORTED) || \ defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) #ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_TRNS) png_free(png_ptr, png_ptr->trans); png_ptr->free_me &= ~PNG_FREE_TRNS; #else if (png_ptr->flags & PNG_FLAG_FREE_TRNS) png_free(png_ptr, png_ptr->trans); png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; #endif #endif #ifdef PNG_READ_hIST_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_HIST) png_free(png_ptr, png_ptr->hist); png_ptr->free_me &= ~PNG_FREE_HIST; #else if (png_ptr->flags & PNG_FLAG_FREE_HIST) png_free(png_ptr, png_ptr->hist); png_ptr->flags &= ~PNG_FLAG_FREE_HIST; #endif #endif #ifdef PNG_READ_GAMMA_SUPPORTED if (png_ptr->gamma_16_table != NULL) { int i; int istop = (1 << (8 - png_ptr->gamma_shift)); for (i = 0; i < istop; i++) { png_free(png_ptr, png_ptr->gamma_16_table[i]); } png_free(png_ptr, png_ptr->gamma_16_table); } #ifdef PNG_READ_BACKGROUND_SUPPORTED if (png_ptr->gamma_16_from_1 != NULL) { int i; int istop = (1 << (8 - png_ptr->gamma_shift)); for (i = 0; i < istop; i++) { png_free(png_ptr, png_ptr->gamma_16_from_1[i]); } png_free(png_ptr, png_ptr->gamma_16_from_1); } if (png_ptr->gamma_16_to_1 != NULL) { int i; int istop = (1 << (8 - png_ptr->gamma_shift)); for (i = 0; i < istop; i++) { png_free(png_ptr, png_ptr->gamma_16_to_1[i]); } png_free(png_ptr, png_ptr->gamma_16_to_1); } #endif #endif #ifdef PNG_TIME_RFC1123_SUPPORTED png_free(png_ptr, png_ptr->time_buffer); #endif inflateEnd(&png_ptr->zstream); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED png_free(png_ptr, png_ptr->save_buffer); #endif /* Save the important info out of the png_struct, in case it is * being used again. */ #ifdef PNG_SETJMP_SUPPORTED png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif error_fn = png_ptr->error_fn; warning_fn = png_ptr->warning_fn; error_ptr = png_ptr->error_ptr; #ifdef PNG_USER_MEM_SUPPORTED free_fn = png_ptr->free_fn; #endif png_memset(png_ptr, 0, png_sizeof(png_struct)); png_ptr->error_fn = error_fn; png_ptr->warning_fn = warning_fn; png_ptr->error_ptr = error_ptr; #ifdef PNG_USER_MEM_SUPPORTED png_ptr->free_fn = free_fn; #endif #ifdef PNG_SETJMP_SUPPORTED png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); #endif }
0
linux
189b0ddc245139af81198d1a3637cac74f96e13a
NOT_APPLICABLE
NOT_APPLICABLE
int create_pipe_files(struct file **res, int flags) { struct inode *inode = get_pipe_inode(); struct file *f; int error; if (!inode) return -ENFILE; if (flags & O_NOTIFICATION_PIPE) { error = watch_queue_init(inode->i_pipe); if (error) { free_pipe_info(inode->i_pipe); iput(inode); return error; } } f = alloc_file_pseudo(inode, pipe_mnt, "", O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)), &pipefifo_fops); if (IS_ERR(f)) { free_pipe_info(inode->i_pipe); iput(inode); return PTR_ERR(f); } f->private_data = inode->i_pipe; res[0] = alloc_file_clone(f, O_RDONLY | (flags & O_NONBLOCK), &pipefifo_fops); if (IS_ERR(res[0])) { put_pipe_info(inode, inode->i_pipe); fput(f); return PTR_ERR(res[0]); } res[0]->private_data = inode->i_pipe; res[1] = f; stream_open(inode, res[0]); stream_open(inode, res[1]); return 0; }
0
iperf
91f2fa59e8ed80dfbf400add0164ee0e508e412a
NOT_APPLICABLE
NOT_APPLICABLE
iperf_get_test_one_off(struct iperf_test *ipt) { return ipt->one_off; }
0
linux
a2d859e3fc97e79d907761550dbc03ff1b36479c
NOT_APPLICABLE
NOT_APPLICABLE
struct sctp_chunk *sctp_make_shutdown_complete( const struct sctp_association *asoc, const struct sctp_chunk *chunk) { struct sctp_chunk *retval; __u8 flags = 0; /* Set the T-bit if we have no association (vtag will be * reflected) */ flags |= asoc ? 0 : SCTP_CHUNK_FLAG_T; retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN_COMPLETE, flags, 0, GFP_ATOMIC); /* RFC 2960 6.4 Multi-homed SCTP Endpoints * * An endpoint SHOULD transmit reply chunks (e.g., SACK, * HEARTBEAT ACK, * etc.) to the same destination transport * address from which it * received the DATA or control chunk * to which it is replying. * * [Report SHUTDOWN COMPLETE back to where the SHUTDOWN ACK * came from.] */ if (retval && chunk) retval->transport = chunk->transport; return retval; }
0
Chrome
36fd3c9a6ba9fce9dd80c442c3ba5decd8e4c065
NOT_APPLICABLE
NOT_APPLICABLE
FakeExternalProtocolHandlerDelegate() : block_state_(ExternalProtocolHandler::BLOCK), os_state_(shell_integration::UNKNOWN_DEFAULT), has_launched_(false), has_prompted_(false), has_blocked_(false) {}
0
jsish
430ea27accd4d4ffddc946c9402e7c9064835a18
NOT_APPLICABLE
NOT_APPLICABLE
char *jsi_utf_tocase(const char *cp, int upper, Jsi_DString *dsPtr) { char unibuf[10]; while (*cp) { #if JSI__UTF8 if (*cp&0x80) { int32_t c; Jsi_UtfToUniChar(cp, &c); int n = Jsi_UniCharToUtf(c, unibuf); unibuf[n] = 0; cp += n; } else #endif { unibuf[0] = (upper?toupper(*cp):tolower(*cp)); unibuf[1] = 0; cp++; } if (upper==2) //totile upper = 0; Jsi_DSAppend(dsPtr, unibuf, NULL); } return Jsi_DSValue(dsPtr); }
0
Chrome
5a2de6455f565783c73e53eae2c8b953e7d48520
NOT_APPLICABLE
NOT_APPLICABLE
const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); String overrideEncoding = core(webView)->mainFrame()->loader()->documentLoader()->overrideEncoding(); if (overrideEncoding.isEmpty()) return 0; webView->priv->customEncoding = overrideEncoding.utf8(); return webView->priv->customEncoding.data(); }
0
php-src
b34d7849ed90ced9345f8ea1c59bc8d101c18468
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(gethostbyname) { char *hostname; int hostname_len; char *addr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { return; } addr = php_gethostbyname(hostname); RETVAL_STRING(addr, 0); }
0
gpac
3dbe11b37d65c8472faf0654410068e5500b3adb
NOT_APPLICABLE
NOT_APPLICABLE
void gpp_read_style(GF_BitStream *bs, GF_StyleRecord *rec) { rec->startCharOffset = gf_bs_read_u16(bs); rec->endCharOffset = gf_bs_read_u16(bs); rec->fontID = gf_bs_read_u16(bs); rec->style_flags = gf_bs_read_u8(bs); rec->font_size = gf_bs_read_u8(bs); rec->text_color = gpp_read_rgba(bs); }
0
tensorflow
5f7975d09eac0f10ed8a17dbb6f5964977725adc
NOT_APPLICABLE
NOT_APPLICABLE
TEST(FloatPoolingOpTest, MaxPoolActivationRelu1) { FloatPoolingOpModel m(BuiltinOperator_MAX_POOL_2D, /*input=*/{TensorType_FLOAT32, {1, 2, 4, 1}}, /*filter_width=*/2, /*filter_height=*/2, /*output=*/{TensorType_FLOAT32, {}}, Padding_VALID, 2, 2, ActivationFunctionType_RELU_N1_TO_1); m.SetInput({ -2.75, -6, 0.2, 0.4, // -3, -2, -0.3, 0.7, // }); m.Invoke(); EXPECT_THAT(m.GetOutput(), ElementsAreArray({-1.0, 0.7})); m.SetInput({ -2.75, -6, -2, -4, // -3, -2, 10, -7, // }); m.Invoke(); EXPECT_THAT(m.GetOutput(), ElementsAreArray({-1.0, 1.0})); }
0
linux
d6f5e358452479fa8a773b5c6ccc9e4ec5a20880
NOT_APPLICABLE
NOT_APPLICABLE
smb2_set_credits(struct TCP_Server_Info *server, const int val) { int scredits, in_flight; spin_lock(&server->req_lock); server->credits = val; if (val == 1) server->reconnect_instance++; scredits = server->credits; in_flight = server->in_flight; spin_unlock(&server->req_lock); trace_smb3_set_credits(server->CurrentMid, server->conn_id, server->hostname, scredits, val, in_flight); cifs_dbg(FYI, "%s: set %u credits\n", __func__, val); /* don't log while holding the lock */ if (val == 1) cifs_dbg(FYI, "set credits to 1 due to smb2 reconnect\n"); }
0
openssl
3f3582139fbb259a1c3cbb0a25236500a409bf26
NOT_APPLICABLE
NOT_APPLICABLE
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) { if (pad) ctx->flags &= ~EVP_CIPH_NO_PADDING; else ctx->flags |= EVP_CIPH_NO_PADDING; return 1; }
0
openssl
e97763c92c655dcf4af2860b3abd2bc4c8a267f9
NOT_APPLICABLE
NOT_APPLICABLE
static int tls1_check_ec_key(SSL *s, unsigned char *curve_id, unsigned char *comp_id) { const unsigned char *pformats, *pcurves; size_t num_formats, num_curves, i; int j; /* * If point formats extension present check it, otherwise everything is * supported (see RFC4492). */ if (comp_id && s->session->tlsext_ecpointformatlist) { pformats = s->session->tlsext_ecpointformatlist; num_formats = s->session->tlsext_ecpointformatlist_length; for (i = 0; i < num_formats; i++, pformats++) { if (*comp_id == *pformats) break; } if (i == num_formats) return 0; } if (!curve_id) return 1; /* Check curve is consistent with client and server preferences */ for (j = 0; j <= 1; j++) { if (!tls1_get_curvelist(s, j, &pcurves, &num_curves)) return 0; if (j == 1 && num_curves == 0) { /* * If we've not received any curves then skip this check. * RFC 4492 does not require the supported elliptic curves extension * so if it is not sent we can just choose any curve. * It is invalid to send an empty list in the elliptic curves * extension, so num_curves == 0 always means no extension. */ break; } for (i = 0; i < num_curves; i++, pcurves += 2) { if (pcurves[0] == curve_id[0] && pcurves[1] == curve_id[1]) break; } if (i == num_curves) return 0; /* For clients can only check sent curve list */ if (!s->server) break; } return 1; }
0
libarchive
59357157706d47c365b2227739e17daba3607526
NOT_APPLICABLE
NOT_APPLICABLE
lookup_uname(struct cpio *cpio, uid_t uid) { return (lookup_name(cpio, &cpio->uname_cache, &lookup_uname_helper, (id_t)uid)); }
0
Chrome
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
NOT_APPLICABLE
NOT_APPLICABLE
xsltFreeStylePreComps(xsltStylesheetPtr style) { xsltElemPreCompPtr cur, next; if (style == NULL) return; cur = style->preComps; while (cur != NULL) { next = cur->next; if (cur->type == XSLT_FUNC_EXTENSION) cur->free(cur); else xsltFreeStylePreComp((xsltStylePreCompPtr) cur); cur = next; } }
0
busybox
352f79acbd759c14399e39baef21fc4ffe180ac2
NOT_APPLICABLE
NOT_APPLICABLE
static const char *valid_domain_label(const char *label) { unsigned char ch; unsigned pos = 0; for (;;) { ch = *label; if ((ch|0x20) < 'a' || (ch|0x20) > 'z') { if (ch < '0' || ch > '9') { if (ch == '\0' || ch == '.') return label; /* DNS allows only '-', but we are more permissive */ if (ch != '-' && ch != '_') return NULL; } } label++; pos++; } }
0
linux
fc739a058d99c9297ef6bfd923b809d85855b9a9
NOT_APPLICABLE
NOT_APPLICABLE
static void fastrpc_free_map(struct kref *ref) { struct fastrpc_map *map; map = container_of(ref, struct fastrpc_map, refcount); if (map->table) { dma_buf_unmap_attachment(map->attach, map->table, DMA_BIDIRECTIONAL); dma_buf_detach(map->buf, map->attach); dma_buf_put(map->buf); } kfree(map); }
0
Chrome
f7038db6ef172459f14b1b67a5155b8dd210be0f
NOT_APPLICABLE
NOT_APPLICABLE
inline J_DITHER_MODE ditherMode() { return JDITHER_NONE; }
0
Chrome
c442b3eda2f1fdd4d1d4864c34c43cbaf223acae
NOT_APPLICABLE
NOT_APPLICABLE
void SettingLevelBubble::ShowBubble(double percent, bool enabled) { hide_timer_.Stop(); const double old_target_percent = target_percent_; UpdateTargetPercent(percent); SkBitmap* current_icon = increase_icon_; if (!enabled || target_percent_ == 0) current_icon = disabled_icon_; else if (old_target_percent >= 0 && target_percent_ < old_target_percent) current_icon = decrease_icon_; if (!view_) { view_ = CreateView(); view_->Init(current_icon, percent, enabled); } else { SettingLevelBubbleDelegateView* delegate = static_cast<SettingLevelBubbleDelegateView*> (view_->GetWidget()->widget_delegate()); delegate->ResetFade(); view_->SetIcon(current_icon); view_->SetEnabled(enabled); } view_->GetWidget()->Show(); hide_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kBubbleShowTimeoutMs), this, &SettingLevelBubble::OnHideTimeout); }
0
Chrome
d662b905d30cec7899bbb15140dcfacd73506167
NOT_APPLICABLE
NOT_APPLICABLE
void PluginObserver::OnMissingPluginStatus(int status) { #if defined(OS_WIN) if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) { tab_contents_->AddInfoBar( new PluginInstallerInfoBarDelegate(tab_contents())); return; } DCHECK_EQ(webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD, status); for (size_t i = 0; i < tab_contents_->infobar_count(); ++i) { InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i); if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) { tab_contents_->RemoveInfoBar(delegate); return; } } #endif }
0
postgresql
08fa47c4850cea32c3116665975bca219fbf2fe6
NOT_APPLICABLE
NOT_APPLICABLE
elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text) { Jsonb *jb = PG_GETARG_JSONB(0); ReturnSetInfo *rsi; Tuplestorestate *tuple_store; TupleDesc tupdesc; TupleDesc ret_tdesc; MemoryContext old_cxt, tmp_cxt; bool skipNested = false; JsonbIterator *it; JsonbValue v; int r; if (JB_ROOT_IS_SCALAR(jb)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot extract elements from a scalar"))); else if (!JB_ROOT_IS_ARRAY(jb)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot extract elements from an object"))); rsi = (ReturnSetInfo *) fcinfo->resultinfo; if (!rsi || !IsA(rsi, ReturnSetInfo) || (rsi->allowedModes & SFRM_Materialize) == 0 || rsi->expectedDesc == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-valued function called in context that " "cannot accept a set"))); rsi->returnMode = SFRM_Materialize; /* it's a simple type, so don't use get_call_result_type() */ tupdesc = rsi->expectedDesc; old_cxt = MemoryContextSwitchTo(rsi->econtext->ecxt_per_query_memory); ret_tdesc = CreateTupleDescCopy(tupdesc); BlessTupleDesc(ret_tdesc); tuple_store = tuplestore_begin_heap(rsi->allowedModes & SFRM_Materialize_Random, false, work_mem); MemoryContextSwitchTo(old_cxt); tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, "jsonb_array_elements temporary cxt", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); it = JsonbIteratorInit(&jb->root); while ((r = JsonbIteratorNext(&it, &v, skipNested)) != WJB_DONE) { skipNested = true; if (r == WJB_ELEM) { HeapTuple tuple; Datum values[1]; bool nulls[1] = {false}; /* use the tmp context so we can clean up after each tuple is done */ old_cxt = MemoryContextSwitchTo(tmp_cxt); if (!as_text) { Jsonb *val = JsonbValueToJsonb(&v); values[0] = PointerGetDatum(val); } else { if (v.type == jbvNull) { /* a json null is an sql null in text mode */ nulls[0] = true; values[0] = (Datum) NULL; } else { text *sv; if (v.type == jbvString) { /* in text mode scalar strings should be dequoted */ sv = cstring_to_text_with_len(v.val.string.val, v.val.string.len); } else { /* turn anything else into a json string */ StringInfo jtext = makeStringInfo(); Jsonb *jb = JsonbValueToJsonb(&v); (void) JsonbToCString(jtext, &jb->root, 0); sv = cstring_to_text_with_len(jtext->data, jtext->len); } values[0] = PointerGetDatum(sv); } } tuple = heap_form_tuple(ret_tdesc, values, nulls); tuplestore_puttuple(tuple_store, tuple); /* clean up and switch back */ MemoryContextSwitchTo(old_cxt); MemoryContextReset(tmp_cxt); } } MemoryContextDelete(tmp_cxt); rsi->setResult = tuple_store; rsi->setDesc = ret_tdesc; PG_RETURN_NULL(); }
0
php-src
1c0d06441aefee18b30520e2b1ae89cbfcf56a59
NOT_APPLICABLE
NOT_APPLICABLE
static void exif_thumbnail_build(image_info_type *ImageInfo) { size_t new_size, new_move, new_value; char *new_data; void *value_ptr; int i, byte_count; image_info_list *info_list; image_info_data *info_data; #ifdef EXIF_DEBUG char tagname[64]; #endif if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) { return; /* ignore this call */ } #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: filetype = %d", ImageInfo->Thumbnail.filetype); #endif switch(ImageInfo->Thumbnail.filetype) { default: case IMAGE_FILETYPE_JPEG: /* done */ break; case IMAGE_FILETYPE_TIFF_II: case IMAGE_FILETYPE_TIFF_MM: info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; new_size = 8 + 2 + info_list->count * 12 + 4; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: size of signature + directory(%d): 0x%02X", info_list->count, new_size); #endif new_value= new_size; /* offset for ifd values outside ifd directory */ for (i=0; i<info_list->count; i++) { info_data = &info_list->list[i]; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; if (byte_count > 4) { new_size += byte_count; } } new_move = new_size; new_data = safe_erealloc(ImageInfo->Thumbnail.data, 1, ImageInfo->Thumbnail.size, new_size); ImageInfo->Thumbnail.data = new_data; memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); ImageInfo->Thumbnail.size += new_size; /* fill in data */ if (ImageInfo->motorola_intel) { memmove(new_data, "MM\x00\x2a\x00\x00\x00\x08", 8); } else { memmove(new_data, "II\x2a\x00\x08\x00\x00\x00", 8); } new_data += 8; php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel); new_data += 2; for (i=0; i<info_list->count; i++) { info_data = &info_list->list[i]; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", info_data->tag, exif_get_tagname(info_data->tag, tagname, -12, tag_table_IFD), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count); #endif if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) { php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel); } else { php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel); value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel); if (byte_count <= 4) { memmove(new_data+8, value_ptr, 4); } else { php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: writing with value offset: 0x%04X + 0x%02X", new_value, byte_count); #endif memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); new_value += byte_count; } efree(value_ptr); } new_data += 12; } memset(new_data, 0, 4); /* next ifd pointer */ #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: created"); #endif break; } }
0
linux
294f2fc6da27620a506e6c050241655459ccd6bd
NOT_APPLICABLE
NOT_APPLICABLE
static int check_helper_mem_access(struct bpf_verifier_env *env, int regno, int access_size, bool zero_size_allowed, struct bpf_call_arg_meta *meta) { struct bpf_reg_state *regs = cur_regs(env), *reg = &regs[regno]; switch (reg->type) { case PTR_TO_PACKET: case PTR_TO_PACKET_META: return check_packet_access(env, regno, reg->off, access_size, zero_size_allowed); case PTR_TO_MAP_VALUE: if (check_map_access_type(env, regno, reg->off, access_size, meta && meta->raw_mode ? BPF_WRITE : BPF_READ)) return -EACCES; return check_map_access(env, regno, reg->off, access_size, zero_size_allowed); default: /* scalar_value|ptr_to_stack or invalid ptr */ return check_stack_boundary(env, regno, access_size, zero_size_allowed, meta); } }
0
linux
52c479697c9b73f628140dcdfcd39ea302d05482
NOT_APPLICABLE
NOT_APPLICABLE
static inline int ep_events_available(struct eventpoll *ep) { return !list_empty_careful(&ep->rdllist) || READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR; }
0
jsish
430ea27accd4d4ffddc946c9402e7c9064835a18
NOT_APPLICABLE
NOT_APPLICABLE
static Jsi_OpCodes *code_inc(jsi_Pstate *p, jsi_Pline *line, int e) { JSI_NEW_CODESLN(0,OP_INC, e); }
0
linux
6d8c50dcb029872b298eea68cc6209c866fd3e14
NOT_APPLICABLE
NOT_APPLICABLE
static int sock_close(struct inode *inode, struct file *filp) { __sock_release(SOCKET_I(inode), inode); return 0; }
0
tensorflow
e6cf28c72ba2eb949ca950d834dd6d66bb01cfae
NOT_APPLICABLE
NOT_APPLICABLE
ALWAYS_INLINE void ScalarMulAdd3Way(const float a1, const float a2, const float a3, const float** inp1, const float** inp2, const float** inp3, float** out) { **out += a1 * **inp1 + a2 * **inp2 + a3 * **inp3; ++*out; ++*inp1; ++*inp2; ++*inp3; }
0
Chrome
503bea2643350c6378de5f7a268b85cf2480e1ac
NOT_APPLICABLE
NOT_APPLICABLE
void AudioInputRendererHost::OnAssociateStreamWithConsumer(int stream_id, int render_view_id) { DVLOG(1) << "AudioInputRendererHost@" << this << "::OnAssociateStreamWithConsumer(stream_id=" << stream_id << ", render_view_id=" << render_view_id << ")"; }
0
linux
d1f82808877bb10d3deee7cf3374a4eb3fb582db
NOT_APPLICABLE
NOT_APPLICABLE
static int io_iopoll_check(struct io_ring_ctx *ctx, long min) { unsigned int nr_events = 0; int ret = 0; /* * We disallow the app entering submit/complete with polling, but we * still need to lock the ring to prevent racing with polled issue * that got punted to a workqueue. */ mutex_lock(&ctx->uring_lock); /* * Don't enter poll loop if we already have events pending. * If we do, we can potentially be spinning for commands that * already triggered a CQE (eg in error). */ if (test_bit(0, &ctx->cq_check_overflow)) __io_cqring_overflow_flush(ctx, false); if (io_cqring_events(ctx)) goto out; do { /* * If a submit got punted to a workqueue, we can have the * application entering polling for a command before it gets * issued. That app will hold the uring_lock for the duration * of the poll right here, so we need to take a breather every * now and then to ensure that the issue has a chance to add * the poll to the issued list. Otherwise we can spin here * forever, while the workqueue is stuck trying to acquire the * very same mutex. */ if (list_empty(&ctx->iopoll_list)) { mutex_unlock(&ctx->uring_lock); io_run_task_work(); mutex_lock(&ctx->uring_lock); if (list_empty(&ctx->iopoll_list)) break; } ret = io_do_iopoll(ctx, &nr_events, min); } while (!ret && nr_events < min && !need_resched()); out: mutex_unlock(&ctx->uring_lock); return ret; }
0
ovs
65c61b0c23a0d474696d7b1cea522a5016a8aeb3
NOT_APPLICABLE
NOT_APPLICABLE
parse_FIN_TIMEOUT(char *arg, const struct ofpact_parse_params *pp) { struct ofpact_fin_timeout *oft = ofpact_put_FIN_TIMEOUT(pp->ofpacts); char *key, *value; while (ofputil_parse_key_value(&arg, &key, &value)) { char *error; if (!strcmp(key, "idle_timeout")) { error = str_to_u16(value, key, &oft->fin_idle_timeout); } else if (!strcmp(key, "hard_timeout")) { error = str_to_u16(value, key, &oft->fin_hard_timeout); } else { error = xasprintf("invalid key '%s' in 'fin_timeout' argument", key); } if (error) { return error; } } return NULL; }
0
linux
621b5060e823301d0cba4cb52a7ee3491922d291
NOT_APPLICABLE
NOT_APPLICABLE
static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, unsigned long nbytes) { unsigned long stack_page; unsigned long cpu = task_cpu(p); /* * Avoid crashing if the stack has overflowed and corrupted * task_cpu(p), which is in the thread_info struct. */ if (cpu < NR_CPUS && cpu_possible(cpu)) { stack_page = (unsigned long) hardirq_ctx[cpu]; if (sp >= stack_page + sizeof(struct thread_struct) && sp <= stack_page + THREAD_SIZE - nbytes) return 1; stack_page = (unsigned long) softirq_ctx[cpu]; if (sp >= stack_page + sizeof(struct thread_struct) && sp <= stack_page + THREAD_SIZE - nbytes) return 1; } return 0; }
0
NetHack
612755bfb5c412079795c68ba392df5d93874ed8
NOT_APPLICABLE
NOT_APPLICABLE
change_inv_order(op) char *op; { int oc_sym, num; char *sp, buf[BUFSZ]; num = 0; #ifndef GOLDOBJ if (!index(op, GOLD_SYM)) buf[num++] = COIN_CLASS; #else /* !!!! probably unnecessary with gold as normal inventory */ #endif for (sp = op; *sp; sp++) { oc_sym = def_char_to_objclass(*sp); /* reject bad or duplicate entries */ if (oc_sym == MAXOCLASSES || oc_sym == RANDOM_CLASS || oc_sym == ILLOBJ_CLASS || !index(flags.inv_order, oc_sym) || index(sp+1, *sp)) return 0; /* retain good ones */ buf[num++] = (char) oc_sym; } buf[num] = '\0'; /* fill in any omitted classes, using previous ordering */ for (sp = flags.inv_order; *sp; sp++) if (!index(buf, *sp)) { buf[num++] = *sp; buf[num] = '\0'; /* explicitly terminate for next index() */ } Strcpy(flags.inv_order, buf); return 1; }
0
CImg
ac8003393569aba51048c9d67e1491559877b1d1
NOT_APPLICABLE
NOT_APPLICABLE
Tfloat _linear_atXYZ(const float fx, const float fy=0, const float fz=0, const int c=0) const { const float nfx = cimg::cut(fx,0,width() - 1), nfy = cimg::cut(fy,0,height() - 1), nfz = cimg::cut(fz,0,depth() - 1); const unsigned int x = (unsigned int)nfx, y = (unsigned int)nfy, z = (unsigned int)nfz; const float dx = nfx - x, dy = nfy - y, dz = nfz - z; const unsigned int nx = dx>0?x + 1:x, ny = dy>0?y + 1:y, nz = dz>0?z + 1:z; const Tfloat Iccc = (Tfloat)(*this)(x,y,z,c), Incc = (Tfloat)(*this)(nx,y,z,c), Icnc = (Tfloat)(*this)(x,ny,z,c), Innc = (Tfloat)(*this)(nx,ny,z,c), Iccn = (Tfloat)(*this)(x,y,nz,c), Incn = (Tfloat)(*this)(nx,y,nz,c), Icnn = (Tfloat)(*this)(x,ny,nz,c), Innn = (Tfloat)(*this)(nx,ny,nz,c); return Iccc + dx*(Incc - Iccc + dy*(Iccc + Innc - Icnc - Incc + dz*(Iccn + Innn + Icnc + Incc - Icnn - Incn - Iccc - Innc)) + dz*(Iccc + Incn - Iccn - Incc)) + dy*(Icnc - Iccc + dz*(Iccc + Icnn - Iccn - Icnc)) + dz*(Iccn - Iccc);
0
core
85fcb895ca7f0bcb8ee72047fe0e1e78532ff90b
NOT_APPLICABLE
NOT_APPLICABLE
const char *imap_parser_read_word(struct imap_parser *parser) { const unsigned char *data; size_t i, data_size; data = i_stream_get_data(parser->input, &data_size); for (i = 0; i < data_size; i++) { if (data[i] == ' ' || data[i] == '\r' || data[i] == '\n') break; } if (i < data_size) { data_size = i + (data[i] == ' ' ? 1 : 0); parser->line_size += data_size; i_stream_skip(parser->input, data_size); return p_strndup(parser->pool, data, i); } else { return NULL; } }
0
unicorn
c733bbada356b0373fa8aa72c044574bb855fd24
NOT_APPLICABLE
NOT_APPLICABLE
static uint8_t *encode_sleb128(uint8_t *p, target_long val) { int more, byte; do { byte = val & 0x7f; val >>= 7; more = !((val == 0 && (byte & 0x40) == 0) || (val == -1 && (byte & 0x40) != 0)); if (more) { byte |= 0x80; } *p++ = byte; } while (more); return p; }
0
cJSON
be749d7efa7c9021da746e685bd6dec79f9dd99b
NOT_APPLICABLE
NOT_APPLICABLE
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) { cJSON *item = cJSON_New_Item(&global_hooks); if (item != NULL) { item->type = cJSON_String | cJSON_IsReference; item->valuestring = (char*)cast_away_const(string); } return item; }
0
OpenSC
8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
NOT_APPLICABLE
NOT_APPLICABLE
authentic_reduce_path(struct sc_card *card, struct sc_path *path) { struct sc_context *ctx = card->ctx; struct sc_path in_path, cur_path; size_t offs; LOG_FUNC_CALLED(ctx); if (!path || path->len <= 2 || path->type == SC_PATH_TYPE_DF_NAME) LOG_FUNC_RETURN(ctx, SC_SUCCESS); if (!card->cache.valid || !card->cache.current_df) LOG_FUNC_RETURN(ctx, 0); in_path = *path; cur_path = card->cache.current_df->path; if (!memcmp(cur_path.value, "\x3F\x00", 2) && memcmp(in_path.value, "\x3F\x00", 2)) { memmove(in_path.value + 2, in_path.value, in_path.len); memcpy(in_path.value, "\x3F\x00", 2); in_path.len += 2; } for (offs=0; offs < in_path.len && offs < cur_path.len; offs += 2) { if (cur_path.value[offs] != in_path.value[offs]) break; if (cur_path.value[offs + 1] != in_path.value[offs + 1]) break; } memmove(in_path.value, in_path.value + offs, sizeof(in_path.value) - offs); in_path.len -= offs; *path = in_path; LOG_FUNC_RETURN(ctx, offs); }
0
server
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
NOT_APPLICABLE
NOT_APPLICABLE
void Item_in_optimizer::keep_top_level_cache() { cache->keep_array(); save_cache= 1; }
0
End of preview. Expand in Data Studio

Merged BigVul and PrimeVul Dataset

Dataset ID: mahdin70/merged_bigvul_primevul

This dataset is a merged and preprocessed combination of the BigVul (bstee615/bigvul) and PrimeVul (colin/PrimeVul, "default" configuration) datasets, designed for vulnerability analysis and machine learning tasks. The preprocessing ensures consistency in column names, data types, and formats, making it suitable for fine-tuning models.

Dataset Overview

The dataset integrates vulnerability data from two sources:

The merged dataset retains key information about projects, commits, functions, and vulnerabilities, standardized for consistency.

Columns

The dataset contains the following columns:

  • project: String - The name of the project (e.g., "qemu", "linux-2.6").
  • commit_id: String - Unique identifier of the commit associated with the function.
  • func: String - The source code of the function before fixing (from func_before in BigVul).
  • vul: Int8 - Vulnerability label (1 = vulnerable, 0 = not vulnerable).
  • CVE ID: String - Common Vulnerabilities and Exposures identifier (e.g., CVE-2007-1320), or NOT_APPLICABLE if vul = 0.
  • CWE ID: String - Common Weakness Enumeration identifier (e.g., CWE-20), or NOT_APPLICABLE if vul = 0.

Splits

  • Train: Combined training data from BigVul and PrimeVul.
  • Test: Combined testing data from BigVul and PrimeVul.
  • Validation: Combined validation data from BigVul and PrimeVul.

Preprocessing Steps

The dataset was preprocessed to ensure consistency and quality:

BigVul Preprocessing

  • Source Columns:
    • project, commit_id, CVE ID, CWE ID, func_before, vul.
  • Transformations:
    • Renamed func_before to func.
    • Kept CWE ID in its original format (CWE-XXX).
    • Converted vul to int8.

PrimeVul Preprocessing

  • Source Columns:
    • project, commit_id, cve, cwe, func, target.
  • Transformations:
    • Renamed cve to CVE ID, cwe to CWE ID, target to vul.
    • Standardized CWE ID by removing brackets from list format (e.g., ["CWE-XXX"]CWE-XXX), taking the first element if multiple CWEs exist.
    • Converted vul from int64 to int8.

Merging and Final Preprocessing

  • Merging: Concatenated preprocessed BigVul and PrimeVul data for each split (train, test, validation).
  • Final Steps:
    • Removed rows with any null values.
    • Removed duplicates based on the func column.
    • For rows where vul = 0, replaced CVE ID and CWE ID with "NOT_APPLICABLE.

Dataset Statistics

Below are the analysis results for the final merged dataset:

Train Split

  • Number of rows: 239,822
  • Unique CWE IDs (excluding NOT_APPLICABLE): 127
  • Unique commit IDs: 7,559
  • Vulnerable functions (vul = 1): 9,037

Test Split

  • Number of rows: 51,390
  • Unique CWE IDs (excluding NOT_APPLICABLE): 87
  • Unique commit IDs: 6,032
  • Vulnerable functions (vul = 1): 1,911

Validation Split

  • Number of rows: 51,392
  • Unique CWE IDs (excluding NOT_APPLICABLE): 91
  • Unique commit IDs: 6,059
  • Vulnerable functions (vul = 1): 1,933

Usage

Loading the Dataset

from datasets import load_dataset

dataset = load_dataset("mahdin70/merged_bigvul_primevul")
Downloads last month
92