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: status_t SoftAVC::resetPlugin() { mIsInFlush = false; mReceivedEOS = false; memset(mTimeStamps, 0, sizeof(mTimeStamps)); memset(mTimeStampsValid, 0, sizeof(mTimeStampsValid)); /* Initialize both start and end times */ gettimeofday(&mTimeStart, NULL); gettimeofday(&mTimeEnd, NULL); retu...
0
23,781
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool ASF_LegacyManager::IsLeapYear ( long year ) { if ( year < 0 ) year = -year + 1; // Fold the negative years, assuming there is a year 0. if ( (year % 4) != 0 ) return false; // Not a multiple of 4. if ( (year % 100) != 0 ) return true; // A multiple of 4 but not a multiple of 100. if ( (year % 400) ==...
0
21,126
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void OnShowCreatedWindow(int pending_widget_routing_id, WindowOpenDisposition disposition, const gfx::Rect& initial_rect, bool user_gesture) { base::PostTaskWithTraits( FROM_HERE, {content::BrowserThread::UI}, b...
0
13,361
Analyze the following 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 ModuleSystem::Private(const v8::FunctionCallbackInfo<v8::Value>& args) { CHECK_EQ(1, args.Length()); if (!args[0]->IsObject() || args[0]->IsNull()) { GetIsolate()->ThrowException( v8::Exception::TypeError(ToV8StringUnsafe(GetIsolate(), args[0]->IsUndefined() ? "Met...
0
4,055
Analyze the following 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 FileBrowserHandlerCustomBindings::GetExternalFileEntry( const v8::FunctionCallbackInfo<v8::Value>& args) { //// TODO(zelidrag): Make this magic work on other platforms when file browser //// matures enough on ChromeOS. #if defined(OS_CHROMEOS) CHECK(args.Length() == 1); CHECK(args[0]->IsObjec...
1
17,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: void __audit_ipc_obj(struct kern_ipc_perm *ipcp) { struct audit_context *context = current->audit_context; context->ipc.uid = ipcp->uid; context->ipc.gid = ipcp->gid; context->ipc.mode = ipcp->mode; context->ipc.has_perm = 0; security_ipc_getsecid(ipcp, &context->ipc.osid); context->type = AUDIT_IPC; } Co...
0
16,528
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::RemoveFocusedElementOfSubtree(Node& node, bool among_children_only) { if (!focused_element_) return; if (!node.isConnected()) return; bool contains = node.IsShadowIncludingInclusiveAncestorOf(focused_element_.Get()); if (contains &...
0
8,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: void GlobalConfirmInfoBar::OnManagerShuttingDown( infobars::InfoBarManager* manager) { manager->RemoveObserver(this); proxies_.erase(manager); } Commit Message: Allow to specify elide behavior for confrim infobar message Used in "<extension name> is debugging this browser" infobar. Bug: 823194 Change-I...
0
25,988
Analyze the following 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 endswith(const char *s, const char *postfix) { size_t sl, pl; assert(s); assert(postfix); sl = strlen(s); pl = strlen(postfix); if (pl == 0) return true; if (sl < pl) return false; return memcmp(s + sl - pl, ...
0
20,526
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void AsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } Commit Message: Remove BlobRegistry indirection since there is onl...
0
24,623
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_FUNCTION(substr) { zend_string *str; zend_long l = 0, f; int argc = ZEND_NUM_ARGS(); #ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &str, &f, &l) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(str) Z_PARAM_LONG(f) Z_PARAM_OPTIONAL Z_PARAM_LONG...
0
7,685
Analyze the following 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 lua_apr_b64decode(lua_State *L) { const char *encoded; char *plain; size_t encoded_len, decoded_len; request_rec *r; r = ap_lua_check_request_rec(L, 1); luaL_checktype(L, 2, LUA_TSTRING); encoded = lua_tolstring(L, 2, &encoded_len); decoded_len...
0
6,864
Analyze the following 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 BrowserView::SetBookmarkBarParent(views::View* new_parent) { if (new_parent == this) { views::View* target_view = nullptr; if (ui::MaterialDesignController::IsRefreshUi()) { target_view = infobar_container_; } else { target_view = top_container_; } const int target_index = ...
0
25,458
Analyze the following 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 UserSelectionScreen::RecordClickOnLockIcon(const AccountId& account_id) { EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); if (!service) return; service->RecordClickOnLockIcon(); } Commit Message: cros: Check initial auth type when showing views login. Bug: 859611 Change-Id: ...
0
19,841
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static unsigned int task_scan_min(struct task_struct *p) { unsigned int scan_size = READ_ONCE(sysctl_numa_balancing_scan_size); unsigned int scan, floor; unsigned int windows = 1; if (scan_size < MAX_SCAN_WINDOW) windows = MAX_SCAN_WINDOW / scan_size; floor = 1000 / windows; scan = sysctl_numa_balancing...
0
27,530
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: running_bfd(void) { return (__test_bit(DAEMON_BFD, &daemon_mode) && (global_data->have_bfd_config || __test_bit(RUN_ALL_CHILDREN, &daemon_mode))); } Commit Message: Add command line and configuration option to set umask Issue #1048 identified that files created by keepalived are created with mode 06...
0
18,285
Analyze the following 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 nntp_check_msgid(struct Context *ctx, const char *msgid) { struct NntpData *nntp_data = ctx->data; char buf[LONG_STRING]; FILE *fp = mutt_file_mkstemp(); if (!fp) { mutt_perror("mutt_file_mkstemp() failed!"); return -1; } snprintf(buf, sizeof(buf), "HEAD %s\r\n", msgid); int rc = nnt...
0
13,789
Analyze the following 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 cirrus_vga_write_cr(CirrusVGAState * s, int reg_value) { switch (s->vga.cr_index) { case 0x00: // Standard VGA case 0x01: // Standard VGA case 0x02: // Standard VGA case 0x03: // Standard VGA case 0x04: // Standard VGA case 0x05: // Standard VGA case 0x06: ...
0
2,178
Analyze the following 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 php_wddx_add_var(wddx_packet *packet, zval *name_var) { zval **val; HashTable *target_hash; TSRMLS_FETCH(); if (Z_TYPE_P(name_var) == IS_STRING) { if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } if (zend_hash_find(EG(active_symbol_table), Z_STRVAL_P(name_var), ...
0
9,295
Analyze the following 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 UINT32 dvcman_get_channel_id(IWTSVirtualChannel* channel) { return ((DVCMAN_CHANNEL*) channel)->channel_id; } Commit Message: Fix for #4866: Added additional length checks CWE ID:
0
14,494
Analyze the following 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 tm_cfpr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { u64 buf[33]; int i; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENO...
0
10,200
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SendReplyAndDeleteThis() { filter_->Send(reply_msg_); delete this; } Commit Message: Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/ BUG=172573 Review URL: https://codereview.chromium.org/12177018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180600 0039d...
0
3,303
Analyze the following 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 CL_OpenedPK3List_f( void ) { Com_Printf("Opened PK3 Names: %s\n", FS_LoadedPakNames()); } Commit Message: Don't load .pk3s as .dlls, and don't load user config files from .pk3s. CWE ID: CWE-269
0
10,521
Analyze the following 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 ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) { info->tcpi_rto = ccid3_hc_tx_sk(sk)->tx_t_rto; info->tcpi_rtt = ccid3_hc_tx_sk(sk)->tx_rtt; } Commit Message: dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO) The CCID3 code fails to initialize the trailing padding bytes o...
0
23,255
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: update_circuit_on_cmux_(circuit_t *circ, cell_direction_t direction, const char *file, int lineno) { channel_t *chan = NULL; or_circuit_t *or_circ = NULL; circuitmux_t *cmux = NULL; tor_assert(circ); /* Okay, get the channel */ if (direction == CELL_DIRECTION_OUT) { chan ...
0
13,006
Analyze the following 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 setup_hwaccel(AVCodecContext *avctx, const enum AVPixelFormat fmt, const char *name) { AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt); int ret = 0; if (avctx->active_thread_type & FF_THREAD_FRAME) { av_log(avctx, AV_LOG_...
0
12,831
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: dest_write_back_narrow (pixman_iter_t *iter) { bits_image_t * image = &iter->image->bits; int x = iter->x; int y = iter->y; int width = iter->width; const uint32_t *buffer = iter->buffer; image->store_scanline_32 (image, x, y, width, buffer...
0
808
Analyze the following 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 LRUTestGenKey(char *buf, size_t buflen) { snprintf(buf, buflen, "lru:%lld", powerLawRand(1, config.lru_test_sample_size, 6.2)); } Commit Message: Security: fix redis-cli buffer overflow. Thanks to Fakhri Zulkifli for reporting it. The fix switched to dynamic allocation, copying the final promp...
0
23,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: static int php_zip_add_file(struct zip *za, const char *filename, size_t filename_len, char *entry_name, size_t entry_name_len, long offset_start, long offset_len) /* {{{ */ { struct zip_source *zs; char resolved_path[MAXPATHLEN]; zval exists_flag; if (ZIP_OPENBASEDIR_CHECKPATH(filename)) { return -1; }...
0
545
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: OmniboxAcceptNotificationObserver::~OmniboxAcceptNotificationObserver() { } Commit Message: Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 00...
0
1,703
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: svc_release_buffer(struct svc_rqst *rqstp) { unsigned int i; for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++) if (rqstp->rq_pages[i]) put_page(rqstp->rq_pages[i]); } Commit Message: Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update fr...
0
12,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: __imlib_Ellipse_DrawToData(int xc, int yc, int a, int b, DATA32 color, DATA32 * dst, int dstw, int clx, int cly, int clw, int clh, ImlibOp op, char dst_alpha, char blend) { ImlibPointDrawFunction pfunc; int xx, yy, x, y, prev_x, prev_y, t...
1
10,762
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void show_vma_header_prefix(struct seq_file *m, unsigned long start, unsigned long end, vm_flags_t flags, unsigned long long pgoff, dev_t dev, unsigned long ino) { seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); seq_put_hex_ll(m, NULL, start, 8); seq_put_hex_ll(m, "-", end, 8); seq_p...
0
18,873
Analyze the following 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 PeopleHandler::InitializeSyncBlocker() { if (!web_ui()) return; WebContents* web_contents = web_ui()->GetWebContents(); if (web_contents) { ProfileSyncService* service = GetSyncService(); const GURL current_url = web_contents->GetVisibleURL(); if (service && current_url == chrom...
0
5,238
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: init_cifs_idmap(void) { struct cred *cred; struct key *keyring; int ret; cifs_dbg(FYI, "Registering the %s key type\n", cifs_idmap_key_type.name); /* create an override credential set with a special thread keyring in * which requests are cached * * this is used to prevent malicious redirections fr...
0
2,569
Analyze the following 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 smtp_get_message(char *buffer, char **outptr) { size_t len = strlen(buffer); char *message = NULL; if(len > 4) { /* Find the start of the message */ len -= 4; for(message = buffer + 4; *message == ' ' || *message == '\t'; message++, len--) ; /* Find the end of the...
0
7,137
Analyze the following 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 FindInspectedBrowserAndTabIndex( WebContents* inspected_web_contents, Browser** browser, int* tab) { if (!inspected_web_contents) return false; for (auto* b : *BrowserList::GetInstance()) { int tab_index = b->tab_strip_model()->GetIndexOfWebContents(inspected_web_contents); if (t...
0
12,797
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void V8TestObject::VoidMethodSequenceLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodSequenceLongArg"); test_object_v8_internal::VoidMethodSequenceLongArgMethod(info); } Commit Message: bindi...
0
13,829
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Line_Down( RAS_ARGS Long x1, Long y1, Long x2, Long y2, Long miny, Long maxy ) { Bool result, fresh; fresh = ras.fresh; result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny...
0
14,906
Analyze the following 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 IRCView::insertMarkerLine() //slot { if (lastBlockIsLine(BlockIsMarker)) return; appendLine(IRCView::MarkerLine); } Commit Message: CWE ID:
0
13,858
Analyze the following 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 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
22,491
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: BluetoothSocketGetSocketsFunction::BluetoothSocketGetSocketsFunction() {} Commit Message: chrome.bluetoothSocket: Fix regression in send() In https://crrev.com/c/997098, params_ was changed to a local variable, but it needs to last longer than that since net::WrappedIOBuffer may use the data after the local var...
0
18,091
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( const gfx::Rect& rect) { Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); } Commit Message: Check that RWHI isn't deleted manually while owned by a scoped_ptr in RVHI BUG=590284 Review URL: https://codereview.chromiu...
0
15,522
Analyze the following 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 br_multicast_send_query(struct net_bridge *br, struct net_bridge_port *port, u32 sent) { unsigned long time; struct br_ip br_group; if (!netif_running(br->dev) || br->multicast_disabled || !br->multicast_querier || timer_pending(&br->multicast_querier_timer)) return; memset(&...
0
7,788
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame) { DCHECK(!frame_ || frame_ == frame); WebDataSource* ds = frame->provisionalDataSource(); if (!ds) return; DocumentState* document_state = DocumentState::FromDataSource(ds); CHECK((ds->request().url() != GURL(kSwappedOutUR...
0
17,143
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out) { node_assert_ok(node); tor_assert(ap_out); /* Check ri first, because rewrite_node_address_for_bridge() updates * node->ri with the configured bridge address. * Prefer rs over md for consistency with the fascist_firewall_* functi...
0
24,154
Analyze the following 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 CheckNoSuggestionsAvailableOnFieldFocus() { EXPECT_FALSE( external_delegate_->has_suggestions_available_on_field_focus()); } Commit Message: [AF] Don't simplify/dedupe suggestions for (partially) filled sections. Since Autofill does not fill field by field anymore, this simplifying and dedu...
0
18,759
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt, int line) { LPVOID lpMsgBuf; DWORD dw = GetLastError (); FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL);...
0
26,435
Analyze the following 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 vmxnet3_reset_interrupt_states(VMXNET3State *s) { int i; for (i = 0; i < ARRAY_SIZE(s->interrupt_states); i++) { s->interrupt_states[i].is_asserted = false; s->interrupt_states[i].is_pending = false; s->interrupt_states[i].is_masked = true; } } Commit Message: CWE...
0
17,112
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport MagickBooleanType OrderedDitherImage(Image *image) { MagickBooleanType status; status=OrderedDitherImageChannel(image,DefaultChannels,&image->exception); return(status); } Commit Message: https://github.com/ImageMagick/ImageMagick/issues/1609 CWE ID: CWE-125
0
5,470
Analyze the following 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 RenderFrameHostManager::SetIsLoading(bool is_loading) { render_frame_host_->render_view_host()->GetWidget()->SetIsLoading(is_loading); } Commit Message: Fix issue with pending NavigationEntry being discarded incorrectly This CL fixes an issue where we would attempt to discard a pending NavigationEntry wh...
0
8,326
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: char *npw_asprintf(const char *format, ...) { va_list args; va_start(args, format); int alen = vsnprintf(NULL, 0, format, args); va_end(args); char *str = malloc(alen+1); if (str == NULL) return NULL; va_start(args, format); int rlen = vsnprintf(str, alen+1, format, args); va_end(args); if (r...
0
17,623
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: KURL Document::VirtualCompleteURL(const String& url) const { return CompleteURL(url); } Commit Message: Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Change-Id: I1e57b50da17f...
0
29,686
Analyze the following 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 name_show(struct device *dev, struct device_attribute *attr, char *buf) { struct regulator_dev *rdev = dev_get_drvdata(dev); return sprintf(buf, "%s\n", rdev_get_name(rdev)); } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin fr...
0
24,338
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline void mntfree(struct mount *mnt) { struct vfsmount *m = &mnt->mnt; struct super_block *sb = m->mnt_sb; /* * This probably indicates that somebody messed * up a mnt_want/drop_write() pair. If this * happens, the filesystem was probably unable * to make r/w->r/o transitions. */ /* * T...
0
26,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 MagickBooleanType WriteVIPSImage(const ImageInfo *image_info, Image *image) { const char *metadata; MagickBooleanType status; register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; ssize_t y; unsigned int channels; assert...
0
8,349
Analyze the following 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 SetupFakeClock(TabIcon* icon) { icon->clock_ = &fake_clock_; } Commit Message: Paint tab groups with the group color. * The background of TabGroupHeader now uses the group color. * The backgrounds of tabs in the group are tinted with the group color. This treatment, along with the colors chosen, are int...
0
22,379
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: struct usb_interface *usbhid_find_interface(int minor) { return usb_find_interface(&hid_driver, minor); } Commit Message: HID: usbhid: fix out-of-bounds bug The hid descriptor identifies the length and type of subordinate descriptors for a device. If the received hid descriptor is smaller than the size of the ...
0
1,088
Analyze the following 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 print_fatal_signal(int signr) { struct pt_regs *regs = signal_pt_regs(); printk("%s/%d: potentially unexpected fatal signal %d.\n", current->comm, task_pid_nr(current), signr); #if defined(__i386__) && !defined(__arch_um__) printk("code at %08lx: ", regs->ip); { int i; for (i = 0; i < 16; i...
0
16,520
Analyze the following 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 hash_recvmsg(struct kiocb *unused, struct socket *sock, struct msghdr *msg, size_t len, int flags) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct hash_ctx *ctx = ask->private; unsigned ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); int err; if (len > ds...
1
2,071
Analyze the following 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 VRDisplay::StopPresenting() { if (is_presenting_) { if (!capabilities_->hasExternalDisplay()) { if (layer_.source().isHTMLCanvasElement()) { } else { } } else { } is_presenting_ = false; OnPresentChange(); } rendering_context_ = nullptr; context_gl_ = nullptr; ...
0
796
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int __init iwch_cm_init(void) { skb_queue_head_init(&rxq); workq = create_singlethread_workqueue("iw_cxgb3"); if (!workq) return -ENOMEM; return 0; } Commit Message: iw_cxgb3: Fix incorrectly returning error on success The cxgb3_*_send() functions return NET_XMIT_ values, which are positive integers val...
0
3,563
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: XInsertModifiermapEntry(XModifierKeymap *map, #if NeedWidePrototypes unsigned int keycode, #else KeyCode keycode, #endif int modifier) { XModifierKeymap *newmap; int i, row = modifier * map->max_keypermod, newrow, lastrow; for (i=0; i<map->max_keypermod; i++) { if (map->modifierma...
0
13,684
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gs_interpret(i_ctx_t **pi_ctx_p, ref * pref, int user_errors, int *pexit_code, ref * perror_object) { i_ctx_t *i_ctx_p = *pi_ctx_p; gs_gc_root_t error_root; int code; gs_register_ref_root(imemory_system, &error_root, (void **)&perror_object, "gs_interpret"); ...
0
10,111
Analyze the following 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 SkIcoCodec::onDimensionsSupported(const SkISize& dim) { return this->chooseCodec(dim, 0) >= 0; } Commit Message: RESTRICT AUTOMERGE: Cherry-pick "begin cleanup of malloc porting layer" Bug: 78354855 Test: Not feasible Original description: =================================================================...
0
24,665
Analyze the following 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::setXMLVersion(const String& version, ExceptionState& exceptionState) { if (!XMLDocumentParser::supportsXMLVersion(version)) { exceptionState.throwDOMException(NotSupportedError, "This document does not support the XML version '" + version + "'."); return; } m_xmlVersion...
0
5,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: NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs, int num_reqs) { struct smbXcli_req_state *state; struct tevent_req *subreq; struct iovec *iov; int i, num_iov, nbt_len; int tf_iov = -1; const DATA_BLOB *encryption_key = NULL; uint64_t encryption_session_id = 0; uint64_t nonce_high =...
0
233
Analyze the following 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 netlink_has_listeners(struct sock *sk, unsigned int group) { int res = 0; struct listeners *listeners; BUG_ON(!netlink_is_kernel(sk)); rcu_read_lock(); listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners); if (listeners && group - 1 < nl_table[sk->sk_protocol].groups) res = test_bit(gro...
0
28,475
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gfx::NativeView WebContentsImpl::GetNativeView() { return view_->GetNativeView(); } Commit Message: Don't call WebContents::DownloadImage() callback if the WebContents were deleted BUG=583718 Review URL: https://codereview.chromium.org/1685343004 Cr-Commit-Position: refs/heads/master@{#375700} CWE ID:
0
4,752
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gpc_noop(Pixel *out, const Pixel *in, const Background *back) { (void)back; out->r = in->r; out->g = in->g; out->b = in->b; out->a = in->a; } Commit Message: DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b63bc0bf46084833 (cherry picked from commit bbe98b40cda...
0
14,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: gsm_xsmp_server_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GsmXsmpServer *self; self = GSM_XSMP_SERVER (object); switch (prop_id) { ...
0
15,266
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) { struct sock *rsk; #ifdef CONFIG_TCP_MD5SIG /* * We really want to reject the packet as early as possible * if: * o We're expecting an MD5'd packet and this is no MD5 tcp option * o There is an MD5 option and we're not expecting one */ if (tc...
0
2,835
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int _regulator_can_change_status(struct regulator_dev *rdev) { if (!rdev->constraints) return 0; if (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_STATUS) return 1; else return 0; } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing...
0
14,939
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool AppModalDialog::IsJavaScriptModalDialog() { return false; } Commit Message: Fix a Windows crash bug with javascript alerts from extension popups. BUG=137707 Review URL: https://chromiumcodereview.appspot.com/10828423 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152716 0039d316-1c4b-4281-b951-d8...
0
4,246
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void xt_proto_fini(struct net *net, u_int8_t af) { #ifdef CONFIG_PROC_FS char buf[XT_FUNCTION_MAXNAMELEN]; strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_TABLES, sizeof(buf)); remove_proc_entry(buf, net->proc_net); strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_TARGETS, sizeo...
0
16,790
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: open_files () { register int i; int f, fd_table_size; fd_table_size = getdtablesize (); fprintf (stderr, "pid %ld open files:", (long)getpid ()); for (i = 3; i < fd_table_size; i++) { if ((f = fcntl (i, F_GETFD, 0)) != -1) fprintf (stderr, " %d (%s)", i, f ? "close" : "open"); } fprin...
0
2,509
Analyze the following 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 path_is_under(struct path *path1, struct path *path2) { int res; br_read_lock(&vfsmount_lock); res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); br_read_unlock(&vfsmount_lock); return res; } Commit Message: vfs: Carefully propogate mounts across user namespaces As a matter of polic...
0
16,125
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ExtensionSettingsHandler::HandleReloadMessage(const ListValue* args) { std::string extension_id = UTF16ToUTF8(ExtractStringValue(args)); CHECK(!extension_id.empty()); extension_service_->ReloadExtension(extension_id); } Commit Message: [i18n-fixlet] Make strings branding specific in extension code. I...
0
28,382
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: FloatRect DragController::ClippedSelection(const LocalFrame& frame) { DCHECK(frame.View()); return DataTransfer::ClipByVisualViewport( FloatRect(frame.Selection().UnclippedBoundsInDocument()), frame); } Commit Message: Move user activation check to RemoteFrame::Navigate's callers. Currently RemoteFram...
0
29,197
Analyze the following 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 Plugin::HistogramStartupTimeMedium(const std::string& name, float dt) { if (nexe_size_ > 0) { float size_in_MB = static_cast<float>(nexe_size_) / (1024.f * 1024.f); HistogramTimeMedium(name, static_cast<int64_t>(dt)); HistogramTimeMedium(name + "PerMB", static_cast<int64_t>(dt / size_in_MB)); ...
0
17,024
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebLayer* WebGLRenderingContextBase::PlatformLayer() const { return isContextLost() ? 0 : GetDrawingBuffer()->PlatformLayer(); } Commit Message: Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test R=kbr...
0
19,126
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gs_pattern1_uses_base_space(const gs_pattern_template_t *ptemp) { return ((const gs_pattern1_template_t *)ptemp)->PaintType == 2; } Commit Message: CWE ID: CWE-704
0
26,014
Analyze the following 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 dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, bool *ret_cache_flush, size_t *start) { _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL; _cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL; _cleanup_(rewind_dns_packet) DnsPacketRewinder rewinder; ...
0
19,806
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ExtensionSettingsHandler::HandleInspectMessage(const ListValue* args) { std::string render_process_id_str; std::string render_view_id_str; int render_process_id; int render_view_id; CHECK_EQ(2U, args->GetSize()); CHECK(args->GetString(0, &render_process_id_str)); CHECK(args->GetString(1, &rende...
0
24,741
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) { int err; struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); const struct net_device_ops *ops; if (!dev) return -ENODEV; ops = dev->netdev_ops; switch (cmd) { case SIOCSIFFLAGS: /* Set interface flags */ return...
0
2,512
Analyze the following 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 __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) { int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP); struct scm_timestamping tss; int empty = 1; struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); /* Race occurred between timestamp enabling and packe...
1
13,932
Analyze the following 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 MultibufferDataSource::assume_fully_buffered() { return !url_data()->url().SchemeIsHTTPOrHTTPS(); } Commit Message: Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessChe...
0
12,596
Analyze the following 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 kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { int r; sigset_t sigsaved; if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { kvm_vcpu_block(vcpu); clear_bit(KVM_REQ_UNHALT, &vcpu-...
0
24,473
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: virtual bool UseInProcessPlugins() const { return false; } Commit Message: Allow browser to handle all WebUI navigations. BUG=113496 TEST="Google Dashboard" link in Sync settings loads in new process. Review URL: http://codereview.chromium.org/9663045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12...
0
22,692
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: raptor_rdfxml_parser_stats_print(raptor_rdfxml_parser* rdf_xml_parser, FILE *stream) { fputs("rdf:ID set ", stream); raptor_id_set_stats_print(rdf_xml_parser->id_set, stream); } Commit Message: CVE-2012-0037 Enforce entity loading policy in raptor_libxml_resolveEntity and r...
0
17,425
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AudioInputRendererHost::AudioEntry* AudioInputRendererHost::LookupById( int stream_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); AudioEntryMap::iterator i = audio_entries_.find(stream_id); if (i != audio_entries_.end()) return i->second; return NULL; } Commit Message: Improve vali...
0
17,987
Analyze the following 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 VoidMethodDefaultDoubleOrStringArgsMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodDefaultDoubleOrStringArgs"); TestObject* impl = V8TestObject::ToImpl(info.Holder()); Double...
0
21,122
Analyze the following 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 dtls1_process_buffered_records(SSL *s) { pitem *item; SSL3_BUFFER *rb; item = pqueue_peek(s->rlayer.d->unprocessed_rcds.q); if (item) { /* Check if epoch is current. */ if (s->rlayer.d->unprocessed_rcds.epoch != s->rlayer.d->r_epoch) return (1); /* ...
1
27,584
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg) { struct snd_codec *params; int retval; if (!stream->ops->get_params) return -EBADFD; params = kmalloc(sizeof(*params), GFP_KERNEL); if (!params) return -ENOMEM; retval = stream->ops->get_params(stream, params); if (retval) go...
0
17,231
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void LongOrNullAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); bool is_null = false; int32_t cpp_value(impl->longOrNullAttribute(is_null)); if (is_null) { V8SetReturn...
0
363
Analyze the following 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 CL_LoadTransTable( const char *fileName ) { char translated[MAX_LANGUAGES][MAX_VA_STRING]; char original[MAX_VA_STRING]; qboolean aborted; char *text; fileHandle_t f; char *text_p; char *token; int len, i; trans_t *t; int count; count = 0; aborted = qfalse; cl.corruptedTranslationFile = qfalse;...
0
29,486
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err xml_dump(GF_Box *a, FILE * trace) { GF_XMLBox *p = (GF_XMLBox *)a; gf_isom_box_dump_start(a, "XMLBox", trace); fprintf(trace, ">\n"); fprintf(trace, "<![CDATA[\n"); if (p->xml) gf_fwrite(p->xml, strlen(p->xml), 1, trace); fprintf(trace, "]]>\n"); gf_isom_box_dump_done("XMLBox", a, trace); return ...
0
356
Analyze the following 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 __init create_extent_cache(void) { extent_tree_slab = f2fs_kmem_cache_create("f2fs_extent_tree", sizeof(struct extent_tree)); if (!extent_tree_slab) return -ENOMEM; extent_node_slab = f2fs_kmem_cache_create("f2fs_extent_node", sizeof(struct extent_node)); if (!extent_node_slab) { kmem_cache_dest...
0
29,402
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RootWindow::SetHostBounds(const gfx::Rect& bounds_in_pixel) { DispatchHeldMouseMove(); host_->SetBounds(bounds_in_pixel); last_mouse_location_ = ui::ConvertPointToDIP(layer(), host_->QueryMouseLocation()); synthesize_mouse_move_ = false; } Commit Message: Introduce XGetImage() for GrabWindowSn...
0
9,376
Analyze the following 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 string_to_crypto_cipher_type(const char* crypto_cipher_type) { if (strcmp(crypto_cipher_type, "none") == 0) { return CRYPTO_CIPHER_TYPE_NONE; } else if (strcmp(crypto_cipher_type, "aes256") == 0) { return CRYPTO_CIPHER_TYPE_AES256; } else if (strcmp(crypto_cipher_type, "aes192") == 0) { return...
0
25,789