instruction
stringclasses
1 value
input
stringlengths
64
129k
output
int64
0
1
__index_level_0__
int64
0
30k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SVGDocumentExtensions::registerPendingSVGFontFaceElementsForRemoval(PassRefPtrWillBeRawPtr<SVGFontFaceElement> font) { m_pendingSVGFontFaceElementsForRemoval.add(font); } Commit Message: SVG: Moving animating <svg> to other iframe should not crash. Moving SVGSVGElement with its SMILTimeContainer alread...
0
18,651
Analyze the following 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 mcryptd_hash_enqueue(struct ahash_request *req, crypto_completion_t complete) { int ret; struct mcryptd_hash_request_ctx *rctx = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct mcryptd_queue *queue = mcryptd_get_queue(crypto_ahash_tfm(tfm)); rctx->comple...
0
12,478
Analyze the following 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 main(int argc, char** argv) { /* Kernel starts us with all fd's closed. * But it's dangerous: * fprintf(stderr) can dump messages into random fds, etc. * Ensure that if any of fd 0,1,2 is closed, we open it to /dev/null. */ int fd = xopen("/dev/null", O_RDWR); while (fd < 2) f...
1
5,471
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MockOfflinePageModel* model() const { return model_; } Commit Message: Remove unused histograms from the background loader offliner. Bug: 975512 Change-Id: I87b0a91bed60e3a9e8a1fd9ae9b18cac27a0859f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1683361 Reviewed-by: Cathy Li <chili@chro...
0
5,133
Analyze the following 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::webkitExitFullscreen() { Document* currentDoc = this; if (m_fullScreenElementStack.isEmpty()) return; Deque<RefPtr<Document> > descendants; for (Frame* descendant = frame() ? frame()->tree()->traverseNext() : 0; descendant; descendant = descendant->tree()->travers...
0
9,324
Analyze the following 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 verify_stack(unsigned long sp) { if (sp < PAGE_OFFSET || (sp > (unsigned long)high_memory && high_memory != NULL)) return -EFAULT; return 0; } Commit Message: ARM: 7735/2: Preserve the user r/w register TPIDRURW on context switch and fork Since commit 6a1c53124aa1 the user writeable TLS reg...
0
27,269
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: image_transform_png_set_scale_16_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_set_scale_16(pp); this->next->set(this->next, that, pp, pi); } Commit Message: DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b...
1
18,448
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct resv_map *vma_resv_map(struct vm_area_struct *vma) { VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); if (vma->vm_flags & VM_MAYSHARE) { struct address_space *mapping = vma->vm_file->f_mapping; struct inode *inode = mapping->host; return inode_resv_map(inode); } else { return (struct resv_...
0
14,309
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static bool tsk_conn_cong(struct tipc_sock *tsk) { return tsk->snt_unacked >= tsk->snd_win; } Commit Message: tipc: check nl sock before parsing nested attributes Make sure the socket for which the user is listing publication exists before parsing the socket netlink attributes. Prior to this patch a call with...
0
10,842
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void vb2_ops_wait_prepare(struct vb2_queue *vq) { mutex_unlock(vq->lock); } Commit Message: [media] videobuf2-v4l2: Verify planes array in buffer dequeueing When a buffer is being dequeued using VIDIOC_DQBUF IOCTL, the exact buffer which will be dequeued is not known until the buffer has been removed from the ...
0
27,842
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WallpaperManagerBase::DeleteUserWallpapers( const AccountId& account_id, const std::string& path_to_file) { std::vector<base::FilePath> file_to_remove; base::FilePath wallpaper_path = GetCustomWallpaperDir(kSmallWallpaperSubDir); file_to_remove.push_back(wallpaper_path.Append(account_id.GetUser...
0
29,849
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: node_allows_single_hop_exits(const node_t *node) { if (node && node->ri) return node->ri->allow_single_hop_exits; else return 0; } Commit Message: Consider the exit family when applying guard restrictions. When the new path selection logic went into place, I accidentally dropped the code that consid...
0
17,642
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, struct timespec __user *, utime, u32 __user *, uaddr2, u32, val3) { struct timespec ts; ktime_t t, *tp = NULL; u32 val2 = 0; int cmd = op & FUTEX_CMD_MASK; if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || cmd == FUTEX_WAIT_...
0
22,519
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static unsigned long read_pmc(int idx) { unsigned long val; switch (idx) { case 1: val = mfspr(SPRN_PMC1); break; case 2: val = mfspr(SPRN_PMC2); break; case 3: val = mfspr(SPRN_PMC3); break; case 4: val = mfspr(SPRN_PMC4); break; case 5: val = mfspr(SPRN_PMC5); break; case 6: val =...
0
25,196
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: person_set_ignore_persons(person_t* person, bool ignoring) { person->ignore_all_persons = ignoring; } Commit Message: Fix integer overflow in layer_resize in map_engine.c (#268) * Fix integer overflow in layer_resize in map_engine.c There's a buffer overflow bug in the function layer_resize. It allocates a...
0
29,645
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Ins_MINDEX( INS_ARG ) { FT_Long L, K; L = args[0]; if ( L <= 0 || L > CUR.args ) { CUR.error = TT_Err_Invalid_Reference; return; } K = CUR.stack[CUR.args - L]; FT_ARRAY_MOVE( &CUR.stack[CUR.args - L ], &CUR.stack[CUR.args - L + 1], ...
0
6,817
Analyze the following 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 BrowserPolicyConnector::InitializeDevicePolicySubsystem() { #if defined(OS_CHROMEOS) if (device_cloud_policy_subsystem_.get()) { device_cloud_policy_subsystem_->CompleteInitialization( prefs::kDevicePolicyRefreshRate, kServiceInitializationStartupDelay); } #endif } Commit Message: Re...
0
5,764
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( GLenum target, GLint image_id) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR...
0
5,120
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ftp_quit(ftpbuf_t *ftp) { if (ftp == NULL) { return 0; } if (!ftp_putcmd(ftp, "QUIT", NULL)) { return 0; } if (!ftp_getresp(ftp) || ftp->resp != 221) { return 0; } if (ftp->pwd) { efree(ftp->pwd); ftp->pwd = NULL; } return 1; } Commit Message: CWE ID: CWE-119
0
11,201
Analyze the following 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 modbus_mapping_free(modbus_mapping_t *mb_mapping) { if (mb_mapping == NULL) { return; } free(mb_mapping->tab_input_registers); free(mb_mapping->tab_registers); free(mb_mapping->tab_input_bits); free(mb_mapping->tab_bits); free(mb_mapping); } Commit Message: Fix VD-1301 a...
0
22,779
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) { SpritePtr pSprite = NULL; WindowPtr win = NULL; CursorPtr pCursor; if (!pScreen) return; if (!pDev->spriteInfo->sprite) return; pSprite = pDev->spriteInfo->sprite; win = pScreen->root; pSprite->hotPh...
0
22,897
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Track::EOSBlock::EOSBlock() : BlockEntry(NULL, LONG_MIN) {} Commit Message: external/libvpx/libwebm: Update snapshot Update libwebm snapshot. This update contains security fixes from upstream. Upstream git hash: 229f49347d19b0ca0941e072b199a242ef6c5f2b BUG=23167726 Change-Id: Id3e140e7b31ae11294724b1ecfe2e9c...
0
4,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 void __blk_rq_prep_clone(struct request *dst, struct request *src) { dst->cpu = src->cpu; dst->__sector = blk_rq_pos(src); dst->__data_len = blk_rq_bytes(src); if (src->rq_flags & RQF_SPECIAL_PAYLOAD) { dst->rq_flags |= RQF_SPECIAL_PAYLOAD; dst->special_vec = src->special_vec; } dst->nr_phys_segm...
0
9,337
Analyze the following 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 fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { SourcePictPtr pGradient = pict->pSourcePict; GradientWalker walker; CARD32 *end = buffer + width; _gradient_walker_init (&walker, pGradient, pict->repeat); ...
0
28,100
Analyze the following 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 nbd_disconnect(int fd) { return -ENOTSUP; } Commit Message: CWE ID: CWE-20
0
25,250
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: asmlinkage void sparc_lvl15_nmi(struct pt_regs *regs, unsigned long serr, unsigned long svaddr, unsigned long aerr, unsigned long avaddr) { sun4c_complete_all_stores(); printk("FAULT: NMI received\n"); printk("SREGS: Synchronous Error %08lx\n", serr); printk(" Synchronous Vaddr %08lx\n", svaddr)...
0
14,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: poolGrow(STRING_POOL *pool) { if (pool->freeBlocks) { if (pool->start == 0) { pool->blocks = pool->freeBlocks; pool->freeBlocks = pool->freeBlocks->next; pool->blocks->next = NULL; pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; pool->ptr = po...
0
7,340
Analyze the following 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 WebMediaPlayerMS::SetGpuMemoryBufferVideoForTesting( media::GpuMemoryBufferVideoFramePool* gpu_memory_buffer_pool) { CHECK(frame_deliverer_); frame_deliverer_->gpu_memory_buffer_pool_.reset(gpu_memory_buffer_pool); } Commit Message: Simplify "WouldTaintOrigin" concept in media/blink Currently WebMe...
0
22,136
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, ffs_entity_callback entity, void *priv) { const unsigned _len = len; unsigned long num = 0; ENTER(); for (;;) { int ret; if (num == count) data = NULL; /* Record "descriptor" entity */ ret = entity(FFS_DESCR...
0
18,630
Analyze the following 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 CommandBufferProxyImpl::Flush(int32_t put_offset) { CheckLock(); base::AutoLock lock(last_state_lock_); if (last_state_.error != gpu::error::kNoError) return; TRACE_EVENT1("gpu", "CommandBufferProxyImpl::Flush", "put_offset", put_offset); OrderingBarrierHelper(put_offset); i...
0
7,180
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: off_t size_autodetect(int fhandle) { off_t es; u64 bytes; struct stat stat_buf; int error; #ifdef HAVE_SYS_MOUNT_H #ifdef HAVE_SYS_IOCTL_H #ifdef BLKGETSIZE64 DEBUG("looking for export size with ioctl BLKGETSIZE64\n"); if (!ioctl(fhandle, BLKGETSIZE64, &bytes) && bytes) { return (off_t)bytes; } #endif /...
0
10,150
Analyze the following 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 test_probable_prime_coprime(BIO *bp, BN_CTX *ctx) { int i, j, ret = 0; BIGNUM r; BN_ULONG primes[5] = { 2, 3, 5, 7, 11 }; BN_init(&r); for (i = 0; i < 1000; i++) { if (!bn_probable_prime_dh_coprime(&r, 1024, ctx)) goto err; for (j = 0; j < 5; j++) { if (BN_mod_word(&r, primes[j]) == 0)...
0
10,182
Analyze the following 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 OverloadedPerWorldBindingsMethod2MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "overloadedPerWorldBindingsMethod"); TestObject* impl = V8TestObject::ToImpl(info.Holder()); ...
0
13,628
Analyze the following 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 mov_read_coll(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int version; if (c->fc->nb_streams < 1) return AVERROR_INVALIDDATA; sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; if (atom.size < 5) { av_log(c->fc, AV_LOG_ERROR, "Empty C...
0
9,253
Analyze the following 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 vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data, unsigned int data_sz, vpx_codec_stream_info_t *si, int *is_intra_only, vpx_decrypt_cb decrypt_cb, void *decrypt_state) { int intra_only_flag...
1
1,592
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int32_t TestURLLoader::PrepareFileForPost( const pp::FileRef& file_ref, const std::string& data, std::string* message) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); pp::FileIO file_io(instance_); callback.WaitForResult(file_io.Open(file_ref, ...
0
7,853
Analyze the following 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 RunLoop::IsRunningOnCurrentThread() { Delegate* delegate = tls_delegate.Get().Get(); return delegate && !delegate->active_run_loops_.empty(); } Commit Message: Introduce RunLoop::Type::NESTABLE_TASKS_ALLOWED to replace MessageLoop::ScopedNestableTaskAllower. (as well as MessageLoop::SetNestableTasksAll...
0
2,222
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: VirtualKeyboardController::VirtualKeyboardController() : has_external_keyboard_(false), has_internal_keyboard_(false), has_touchscreen_(false), ignore_external_keyboard_(false) { Shell::GetInstance()->AddShellObserver(this); ui::DeviceDataManager::GetInstance()->AddObserver(this); Upda...
0
27,982
Analyze the following 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 ChromeContentBrowserClient::GetEffectiveURL( content::BrowserContext* browser_context, const GURL& url) { Profile* profile = Profile::FromBrowserContext(browser_context); if (!profile) return url; #if !defined(OS_ANDROID) if (search::ShouldAssignURLToInstantRenderer(url, profile)) retu...
0
28,519
Analyze the following 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 predictor_decode_mono_3950(APEContext *ctx, int count) { APEPredictor *p = &ctx->predictor; int32_t *decoded0 = ctx->decoded[0]; int32_t predictionA, currentA, A, sign; ape_apply_filters(ctx, ctx->decoded[0], NULL, count); currentA = p->lastA[0]; while (count--) { A ...
0
29,229
Analyze the following 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 iwbmp_calc_bitfields_masks(struct iwbmpwcontext *wctx, int num_masks) { int k; int bits[4]; // R, G, B, A int tot_bits = 0; for(k=0;k<num_masks;k++) { bits[k] = iw_max_color_to_bitdepth(wctx->maxcolor[k]); tot_bits += bits[k]; } if(tot_bits > 32) { iw_set_error(wctx->ctx,"Cannot write a B...
0
5,676
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: IndexedDBTransaction::IndexedDBTransaction( int64_t id, IndexedDBConnection* connection, const std::set<int64_t>& object_store_ids, blink::WebIDBTransactionMode mode, IndexedDBBackingStore::Transaction* backing_store_transaction) : id_(id), object_store_ids_(object_store_ids), ...
1
15,082
Analyze the following 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 BackendImpl::FirstEviction() { DCHECK(data_->header.create_time); if (!GetEntryCount()) return; // This is just for unit tests. Time create_time = Time::FromInternalValue(data_->header.create_time); CACHE_UMA(AGE, "FillupAge", 0, create_time); int64_t use_time = stats_.GetCounter(Stats::TIME...
0
27,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 int qeth_idx_activate_get_answer(struct qeth_channel *channel, void (*idx_reply_cb)(struct qeth_channel *, struct qeth_cmd_buffer *)) { struct qeth_cmd_buffer *iob; unsigned long flags; int rc; struct qeth_card *card; QETH_DBF_TEXT(SETUP, 2, "idxanswr"); card = CARD_FROM_CDEV(channel->ccwdev); ...
0
7,599
Analyze the following 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 pdf_creator_t *new_creator(int *n_elements) { pdf_creator_t *daddy; static const pdf_creator_t creator_template[] = { {"Title", ""}, {"Author", ""}, {"Subject", ""}, {"Keywords", ""}, {"Creator", ""}, {"Producer", ...
1
16,622
Analyze the following 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 null_stdfds(void) { int fd, ret = -1; fd = open("/dev/null", O_RDWR); if (fd < 0) return -1; if (dup2(fd, 0) < 0) goto err; if (dup2(fd, 1) < 0) goto err; if (dup2(fd, 2) < 0) goto err; ret = 0; err: close(fd); return ret; } Commit Message: CVE-2015-1335: Protect container mounts against ...
0
11,327
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: kex_send_ext_info(struct ssh *ssh) { int r; char *algs; if ((algs = sshkey_alg_list(0, 1, ',')) == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = sshpkt_start(ssh, SSH2_MSG_EXT_INFO)) != 0 || (r = sshpkt_put_u32(ssh, 1)) != 0 || (r = sshpkt_put_cstring(ssh, "server-sig-algs")) != 0 || (r = sshpkt...
0
26,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: bool NormalPageArena::IsConsistentForGC() { for (size_t i = 0; i < kBlinkPageSizeLog2; ++i) { for (FreeListEntry* free_list_entry = free_list_.free_lists_[i]; free_list_entry; free_list_entry = free_list_entry->Next()) { if (PagesToBeSweptContains(free_list_entry->GetAddress())) retur...
0
25,865
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ExecutableAllocator::dumpProfile() { allocator->dumpProfile(); } Commit Message: Add missing sys/mman.h include on Mac https://bugs.webkit.org/show_bug.cgi?id=98089 Patch by Jonathan Liu <net147@gmail.com> on 2013-01-16 Reviewed by Darin Adler. The madvise function and MADV_FREE constant require sys/m...
0
24,925
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static bool VerifyNumber(const uint8* buffer, int buffer_size, int* offset, int max_digits) { RCHECK(*offset < buffer_size); while (isspace(buffer[*offset])) { ++(*offset); RCHECK(*offset < buffer_size); } int numSeen = 0...
0
23,549
Analyze the following 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 snd_usb_gamecon780_boot_quirk(struct usb_device *dev) { /* set the initial volume and don't change; other values are either * too loud or silent due to firmware bug (bko#65251) */ u8 buf[2] = { 0x74, 0xe3 }; return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, USB_RECIP_INTERFACE...
0
23,518
Analyze the following 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 IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) { DCHECK_EQ(thread_id, CurrentWorkerId()); WebIDBTransactionCallbacks* callbacks = pending_transaction_callbacks_.Lookup(transaction_id); if (!callbacks) return; callbacks->onComplete(); pending_transaction_callbacks_....
0
1,586
Analyze the following 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_dx_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent) { struct dx_countlimit *c; struct dx_tail *t; int count_offset, limit, count; if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) return 1; c = get_dx_countlimit(inode, dirent...
0
12,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 bool convert_bpf_extensions(struct sock_filter *fp, struct sock_filter_int **insnp) { struct sock_filter_int *insn = *insnp; switch (fp->k) { case SKF_AD_OFF + SKF_AD_PROTOCOL: BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, protocol) != 2); insn->code = BPF_LDX | BPF_MEM | BPF_H; insn->a_reg =...
0
11,985
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PPResultAndExceptionToNPResult::~PPResultAndExceptionToNPResult() { DCHECK(checked_exception_); ObjectVar::PluginReleasePPVar(exception_); } Commit Message: Fix invalid read in ppapi code BUG=77493 TEST=attached test Review URL: http://codereview.chromium.org/6883059 git-svn-id: svn://svn.chromium.org/ch...
0
22,820
Analyze the following 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 mdat_dump(GF_Box *a, FILE * trace) { GF_MediaDataBox *p; const char *name = (a->type==GF_ISOM_BOX_TYPE_IDAT ? "ItemDataBox" : "MediaDataBox"); p = (GF_MediaDataBox *)a; gf_isom_box_dump_start(a, name, trace); fprintf(trace, "dataSize=\""LLD"\">\n", LLD_CAST p->dataSize); gf_isom_box_dump_done(name, a...
0
5,079
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int ocfs2_change_file_space(struct file *file, unsigned int cmd, struct ocfs2_space_resv *sr) { struct inode *inode = file_inode(file); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); int ret; if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && !ocfs2_writes_unwritten_extents(osb)) r...
0
69
Analyze the following 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 WebGLRenderingContextBase::clear(GLbitfield mask) { if (isContextLost()) return; if (mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) { SynthesizeGLError(GL_INVALID_VALUE, "clear", "invalid mask"); return; } const char* reason = "framebuffer incomplete"; ...
0
14,196
Analyze the following 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 DiskCacheBackendTest::BackendEviction() { const int kMaxSize = 200 * 1024; const int kMaxEntryCount = 20; const int kWriteSize = kMaxSize / kMaxEntryCount; const int kWriteEntryCount = kMaxEntryCount * 2; static_assert(kWriteEntryCount * kWriteSize > kMaxSize, "must write more tha...
0
29,559
Analyze the following 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 gboolean rpc_event_prepare(GSource *source, gint *timeout) { *timeout = -1; return FALSE; } Commit Message: Support all the new variables added CWE ID: CWE-264
0
29,398
Analyze the following 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 handle_unlink(struct fuse* fuse, struct fuse_handler* handler, const struct fuse_in_header* hdr, const char* name) { struct node* parent_node; struct node* child_node; char parent_path[PATH_MAX]; char child_path[PATH_MAX]; pthread_mutex_lock(&fuse->global->lock); parent_node = lookup_node...
0
23,306
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline int compute_score(struct sock *sk, struct net *net, const unsigned short hnum, const struct in6_addr *daddr, const int dif) { int score = -1; if (net_eq(sock_net(sk), net) && inet_sk(sk)->inet_num == hnum && sk->sk_family == PF_INET6) { const struct ipv6_pinfo *np = inet6_sk(sk...
0
5,551
Analyze the following 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 Image *OverviewImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { Image *montage_image; MontageInfo *montage_info; register Image *p; /* Create the PCD Overview image. */ for (p=image; p != (Image *) NULL; p=p->next) { (void) DeleteImageProper...
0
11,044
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int SocketStream::DoSSLHandleCertError(int result) { DCHECK_EQ(STATE_NONE, next_state_); DCHECK(IsCertificateError(result)); result = HandleCertificateError(result); if (result == OK || result == ERR_IO_PENDING) next_state_ = STATE_SSL_HANDLE_CERT_ERROR_COMPLETE; else next_state_ = STATE_CLOSE; ...
0
21,541
Analyze the following 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 IsZipArchiverPackerEnabled() { return !base::CommandLine::ForCurrentProcess()->HasSwitch( kDisableZipArchiverPacker); } Commit Message: Add a fake DriveFS launcher client. Using DriveFS requires building and deploying ChromeOS. Add a client for the fake DriveFS launcher to allow the use of a real D...
0
19,252
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SWFShape_addLineStyle2(SWFShape shape, unsigned short width, byte r, byte g, byte b, byte a, int flags, float miterLimit) { growLineArray(shape); SWFShape_useVersion(shape, SWF_SHAPE4); shape->lines[shape->nLines] = newSWFLineStyle2(width, r, g, b, a, flags, miterLim...
0
21,148
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Ins_FLIPRGON( TT_ExecContext exc, FT_Long* args ) { FT_UShort I, K, L; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->...
0
8,287
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static ssize_t usbip_debug_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if (sscanf(buf, "%lx", &usbip_debug_flag) != 1) return -EINVAL; return count; } Commit Message: USB: usbip: fix potential out-of-bounds write Fix potential out-of-bounds write to ur...
0
24,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: base::string16 GetEmailDomains() { std::vector<wchar_t> email_domains(16); ULONG length = email_domains.size(); HRESULT hr = GetGlobalFlag(kEmailDomainsKey, &email_domains[0], &length); if (FAILED(hr)) { if (hr == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) { email_domains.resize(length + 1); len...
0
14,312
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line, off_t off, size_t len, const char *name, const char *extra, int nt) { size_t i; const char *l = line; struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1]; char *buf = (char *)m + off; if (buf[0] != '\0') { ...
0
22,872
Analyze the following 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 OxideQQuickWebView::loadProgress() const { Q_D(const OxideQQuickWebView); return d->load_progress_; } Commit Message: CWE ID: CWE-20
0
8,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: ChromeExtensionWebContentsObserver::ChromeExtensionWebContentsObserver( content::WebContents* web_contents) : ExtensionWebContentsObserver(web_contents) {} Commit Message: This patch implements a mechanism for more granular link URL permissions (filtering on scheme/host). This fixes the bug that allowed ...
0
27,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: GF_Err hnti_Read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read_ex(s, bs, hnti_AddBox, s->type); } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
21,534
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: std::string GetMimeType(const base::FilePath& path) { std::string mime_type; net::GetMimeTypeFromFile(path, &mime_type); return mime_type; } Commit Message: Downloads : Fixed an issue of opening incorrect download file When one download overwrites another completed download, calling download.open in the o...
0
7,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: static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route) { if (idev->addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64) { struct in6_addr addr; ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); /* addrconf_add_linklocal also adds a prefix_route and we * only need to care about prefix routes if ...
0
430
Analyze the following 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::PageSizeAndMarginsInPixels(int page_index, DoubleSize& page_size, int& margin_top, int& margin_right, int& margin_bottom, ...
0
25,210
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int cmd_rev_list(int argc, const char **argv, const char *prefix) { struct rev_info revs; struct rev_list_info info; int i; int bisect_list = 0; int bisect_show_vars = 0; int bisect_find_all = 0; int use_bitmap_index = 0; git_config(git_default_config, NULL); init_revisions(&revs, prefix); revs.abbrev ...
0
2,671
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: base::string16 GlobalConfirmInfoBar::DelegateProxy::GetMessageText() const { return global_info_bar_ ? global_info_bar_->delegate_->GetMessageText() : base::string16(); } Commit Message: Allow to specify elide behavior for confrim infobar message Used in "<extension name> is debugg...
0
3,342
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: String PropertyTreeState::ToString() const { return String::Format("t:%p c:%p e:%p", Transform(), Clip(), Effect()); } Commit Message: Reland "[CI] Make paint property nodes non-ref-counted" This reverts commit 887383b30842d9d9006e11bb6932660a3cb5b1b7. Reason for revert: Retry in M69. Original change's desc...
0
2,247
Analyze the following 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 SyncManager::SetPassphrase(const std::string& passphrase, bool is_explicit, bool user_provided) { DCHECK(thread_checker_.CalledOnValidThread()); data_->SetPassphrase(passphrase, is_explicit, user_provided); } Commit Message: sync: remove Ch...
0
15,557
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RenderMessageFilter::~RenderMessageFilter() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(plugin_host_clients_.empty()); } Commit Message: Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/ BUG=172573 Review URL: https://codereview.chromium.org/12177018 git-s...
0
18,565
Analyze the following 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 *rdev_get_drvdata(struct regulator_dev *rdev) { return rdev->reg_data; } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by...
0
19,036
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int generic_delete_inode(struct inode *inode) { return 1; } Commit Message: fs,userns: Change inode_capable to capable_wrt_inode_uidgid The kernel has no concept of capabilities with respect to inodes; inodes exist independently of namespaces. For example, inode_capable(inode, CAP_LINUX_IMMUTABLE) would be no...
0
27,795
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: get_worker(text *json, char **tpath, int *ipath, int npath, bool normalize_results) { JsonLexContext *lex = makeJsonLexContext(json, true); JsonSemAction *sem = palloc0(sizeof(JsonSemAction)); GetState *state = palloc0(sizeof(GetState)); Assert(npath >= 0); state->lex = lex; /* is it...
0
8,575
Analyze the following 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 jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno, jas_image_t *srcimage, int srccmptno) { jas_image_cmpt_t *newcmpt; if (dstimage->numcmpts_ >= dstimage->maxcmpts_) { if (jas_image_growcmpts(dstimage, dstimage->maxcmpts_ + 128)) { return -1; } } if (!(newcmpt = jas_image_cmpt_copy(srcimage...
0
4,525
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: error::Error GLES2DecoderImpl::HandleGenSharedIdsCHROMIUM( uint32 immediate_data_size, const cmds::GenSharedIdsCHROMIUM& c) { GLuint namespace_id = static_cast<GLuint>(c.namespace_id); GLuint id_offset = static_cast<GLuint>(c.id_offset); GLsizei n = static_cast<GLsizei>(c.n); uint32 data_size; if (!...
0
13,302
Analyze the following 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 Com_RealTime(qtime_t *qtime) { time_t t; struct tm *tms; t = time(NULL); if (!qtime) return t; tms = localtime(&t); if (tms) { qtime->tm_sec = tms->tm_sec; qtime->tm_min = tms->tm_min; qtime->tm_hour = tms->tm_hour; qtime->tm_mday = tms->tm_mday; qtime->tm_mon = tms->tm_mon; qtime->tm_yea...
0
9,107
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void CompareCharArraysWithHexError( const string& description, const char* actual, const int actual_len, const char* expected, const int expected_len) { const int min_len = min(actual_len, expected_len); const int max_len = max(actual_len, expected_len); scoped_array<bool> marks(new bool...
0
25,726
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: is_afio_large(const char *h, size_t len) { if (len < afiol_header_size) return (0); if (h[afiol_ino_m_offset] != 'm' || h[afiol_mtime_n_offset] != 'n' || h[afiol_xsize_s_offset] != 's' || h[afiol_filesize_c_offset] != ':') return (0); if (!is_hex(h + afiol_dev_offset, afiol_ino_m_offset - af...
0
28,643
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: BOOLEAN check_cod(const bt_bdaddr_t *remote_bdaddr, uint32_t cod) { uint32_t remote_cod; bt_property_t prop_name; /* check if we already have it in our btif_storage cache */ BTIF_STORAGE_FILL_PROPERTY(&prop_name, BT_PROPERTY_CLASS_OF_DEVICE, sizeof(uint32_t), &remote_cod); if (btif_storage_get_remote...
0
25,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: static int handle_task_switch(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); unsigned long exit_qualification; bool has_error_code = false; u32 error_code = 0; u16 tss_selector; int reason, type, idt_v, idt_index; idt_v = (vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK); idt_index = (...
0
2,463
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: String Notification::permission(ExecutionContext* context) { return permissionString(checkPermission(context)); } Commit Message: Notification actions may have an icon url. This is behind a runtime flag for two reasons: * The implementation is incomplete. * We're still evaluating the API design. Intent to ...
0
28,340
Analyze the following 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 MagickBooleanType WriteMTVImage(const ImageInfo *image_info,Image *image) { char buffer[MaxTextExtent]; MagickBooleanType status; MagickOffsetType scene; register const PixelPacket *p; register ssize_t x; register unsigned char *q; ssize_t y; unsigned char...
0
19,478
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: float GetVisualViewportScale(FrameTreeNode* node) { double scale; EXPECT_TRUE(ExecuteScriptAndExtractDouble( node, "window.domAutomationController.send(visualViewport.scale);", &scale)); return static_cast<float>(scale); } Commit Message: Add a check for disallowing remote frame n...
0
11,645
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ui::Compositor* RenderWidgetHostViewAura::GetCompositor() { aura::RootWindow* root_window = window_->GetRootWindow(); return root_window ? root_window->compositor() : NULL; } Commit Message: Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down an...
0
5,973
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool virtio_should_notify(VirtIODevice *vdev, VirtQueue *vq) { uint16_t old, new; bool v; /* We need to expose used array entries before checking used event. */ smp_mb(); /* Always notify when queue is empty (when feature acknowledge) */ if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFY_ON...
0
26,973
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) { int i; int y; int miny, maxy, pmaxy; int x1, y1; int x2, y2; int ind1, ind2; int ints; int fill_color; if (n <= 0) { return; } if (overflow2(sizeof(int), n)) { return; } if (c == gdAntiAliased) { fill_color = im->AA_colo...
0
9,929
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline int is_cgroup_event(struct perf_event *event) { return 0; } Commit Message: perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interr...
0
2,099
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: getnetnum( const char *num, sockaddr_u *addr, int complain, enum gnn_type a_type /* ignored */ ) { NTP_REQUIRE(AF_UNSPEC == AF(addr) || AF_INET == AF(addr) || AF_INET6 == AF(addr)); if (!is_ip_address(num, AF(addr), addr)) return 0; if (IS_IPV6(addr) && !ipv6_works) return -1; # ifdef I...
0
4,735
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) { struct reg_window32 *win; if(reg < 16) return (!reg ? 0 : regs->u_regs[reg]); /* Ho hum, the slightly complicated case. */ win = (struct reg_window32 *) regs->u_regs[UREG_FP]; return win->locals[reg - 16]; /* yes, I know what...
0
14,406