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
savannah
efb795c74fe954b9544074aafcebb1be4452b03a
NOT_APPLICABLE
NOT_APPLICABLE
string_remove_quotes (const char *string, const char *quotes) { int length; const char *pos_start, *pos_end; if (!string || !quotes) return NULL; if (!string[0]) return strdup (string); pos_start = string; while (pos_start[0] == ' ') { pos_start++; } length = strlen (string); pos_end = string + length - 1; while ((pos_end[0] == ' ') && (pos_end > pos_start)) { pos_end--; } if (!pos_start[0] || !pos_end[0] || (pos_end <= pos_start)) return strdup (string); if (strchr (quotes, pos_start[0]) && (pos_end[0] == pos_start[0])) { if (pos_end == (pos_start + 1)) return strdup (""); return string_strndup (pos_start + 1, pos_end - pos_start - 1); } return strdup (string); }
0
sqlite
57f7ece78410a8aae86aa4625fb7556897db384c
NOT_APPLICABLE
NOT_APPLICABLE
char sqlite3CompareAffinity(Expr *pExpr, char aff2){ char aff1 = sqlite3ExprAffinity(pExpr); if( aff1>SQLITE_AFF_NONE && aff2>SQLITE_AFF_NONE ){ /* Both sides of the comparison are columns. If one has numeric ** affinity, use that. Otherwise use no affinity. */ if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){ return SQLITE_AFF_NUMERIC; }else{ return SQLITE_AFF_BLOB; } }else{ /* One side is a column, the other is not. Use the columns affinity. */ assert( aff1<=SQLITE_AFF_NONE || aff2<=SQLITE_AFF_NONE ); return (aff1<=SQLITE_AFF_NONE ? aff2 : aff1) | SQLITE_AFF_NONE; } }
0
ioq3
b173ac05993f634a42be3d3535e1b158de0c3372
NOT_APPLICABLE
NOT_APPLICABLE
void Con_DrawInput (void) { int y; if ( clc.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) { return; } y = con.vislines - ( SMALLCHAR_HEIGHT * 2 ); re.SetColor( con.color ); SCR_DrawSmallChar( con.xadjust + 1 * SMALLCHAR_WIDTH, y, ']' ); Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue, qtrue ); }
0
leptonica
5ba34b1fe741d69d43a6c8cf767756997eadd87c
NOT_APPLICABLE
NOT_APPLICABLE
fopenTiffMemstream(const char *filename, const char *operation, l_uint8 **pdata, size_t *pdatasize) { L_MEMSTREAM *mstream; TIFF *tif; PROCNAME("fopenTiffMemstream"); if (!filename) return (TIFF *)ERROR_PTR("filename not defined", procName, NULL); if (!operation) return (TIFF *)ERROR_PTR("operation not defined", procName, NULL); if (!pdata) return (TIFF *)ERROR_PTR("&data not defined", procName, NULL); if (!pdatasize) return (TIFF *)ERROR_PTR("&datasize not defined", procName, NULL); if (strcmp(operation, "r") && strcmp(operation, "w")) return (TIFF *)ERROR_PTR("op not 'r' or 'w'", procName, NULL); if (!strcmp(operation, "r")) mstream = memstreamCreateForRead(*pdata, *pdatasize); else mstream = memstreamCreateForWrite(pdata, pdatasize); TIFFSetWarningHandler(NULL); /* disable warnings */ TIFFSetErrorHandler(NULL); /* disable error messages */ tif = TIFFClientOpen(filename, operation, (thandle_t)mstream, tiffReadCallback, tiffWriteCallback, tiffSeekCallback, tiffCloseCallback, tiffSizeCallback, tiffMapCallback, tiffUnmapCallback); if (!tif) LEPT_FREE(mstream); return tif; }
0
poppler
27354e9d9696ee2bc063910a6c9a6b27c5184a52
NOT_APPLICABLE
NOT_APPLICABLE
JBIG2Bitmap::JBIG2Bitmap(unsigned int segNumA, int wA, int hA) : JBIG2Segment(segNumA) { w = wA; h = hA; int auxW; if (unlikely(checkedAdd(wA, 7, &auxW))) { error(errSyntaxError, -1, "invalid width"); data = nullptr; return; } line = auxW >> 3; if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { error(errSyntaxError, -1, "invalid width/height"); data = nullptr; return; } // need to allocate one extra guard byte for use in combine() data = (unsigned char *)gmalloc_checkoverflow(h * line + 1); if (data != nullptr) { data[h * line] = 0; } }
0
jdk11u
6c0ba0785a2f0900be301f72764cf4dcfa720991
NOT_APPLICABLE
NOT_APPLICABLE
void ciEnv::validate_compile_task_dependencies(ciMethod* target) { if (failing()) return; // no need for further checks Dependencies::DepType result = dependencies()->validate_dependencies(_task); if (result != Dependencies::end_marker) { if (result == Dependencies::call_site_target_value) { _inc_decompile_count_on_failure = false; record_failure("call site target change"); } else if (Dependencies::is_klass_type(result)) { record_failure("concurrent class loading"); } else { record_failure("invalid non-klass dependency"); } } }
0
Chrome
9cfe470d793da6e09b966d435c8fa2ba1625d5fe
NOT_APPLICABLE
NOT_APPLICABLE
FidoCableHandshakeHandler::FidoCableHandshakeHandler( FidoCableDevice* cable_device, base::span<const uint8_t, 8> nonce, base::span<const uint8_t, 32> session_pre_key) : cable_device_(cable_device), nonce_(fido_parsing_utils::Materialize(nonce)), session_pre_key_(fido_parsing_utils::Materialize(session_pre_key)), handshake_key_(GenerateKey( fido_parsing_utils::ConvertToStringPiece(session_pre_key_), fido_parsing_utils::ConvertToStringPiece(nonce_), kCableHandshakeKeyInfo)), weak_factory_(this) { crypto::RandBytes(client_session_random_.data(), client_session_random_.size()); }
0
php-src
72dbb7f416160f490c4e9987040989a10ad431c7?w=1
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(curl_exec) { CURLcode error; zval *zid; php_curl *ch; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zid) == FAILURE) { return; } if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) { RETURN_FALSE; } _php_curl_verify_handlers(ch, 1); _php_curl_cleanup_handle(ch); error = curl_easy_perform(ch->cp); SAVE_CURL_ERROR(ch, error); /* CURLE_PARTIAL_FILE is returned by HEAD requests */ if (error != CURLE_OK && error != CURLE_PARTIAL_FILE) { smart_str_free(&ch->handlers->write->buf); RETURN_FALSE; } if (!Z_ISUNDEF(ch->handlers->std_err)) { php_stream *stream; stream = (php_stream*)zend_fetch_resource2_ex(&ch->handlers->std_err, NULL, php_file_le_stream(), php_file_le_pstream()); if (stream) { php_stream_flush(stream); } } if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) { smart_str_0(&ch->handlers->write->buf); RETURN_STR_COPY(ch->handlers->write->buf.s); } /* flush the file handle, so any remaining data is synched to disk */ if (ch->handlers->write->method == PHP_CURL_FILE && ch->handlers->write->fp) { fflush(ch->handlers->write->fp); } if (ch->handlers->write_header->method == PHP_CURL_FILE && ch->handlers->write_header->fp) { fflush(ch->handlers->write_header->fp); } if (ch->handlers->write->method == PHP_CURL_RETURN) { RETURN_EMPTY_STRING(); } else { RETURN_TRUE; } }
0
linux
a0ad220c96692eda76b2e3fd7279f3dcd1d8a8ff
NOT_APPLICABLE
NOT_APPLICABLE
static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pcu) { const struct usb_cdc_union_desc *union_desc; struct usb_host_interface *alt; union_desc = ims_pcu_get_cdc_union_desc(intf); if (!union_desc) return -EINVAL; pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev, union_desc->bMasterInterface0); if (!pcu->ctrl_intf) return -EINVAL; alt = pcu->ctrl_intf->cur_altsetting; pcu->ep_ctrl = &alt->endpoint[0].desc; pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl); pcu->data_intf = usb_ifnum_to_if(pcu->udev, union_desc->bSlaveInterface0); if (!pcu->data_intf) return -EINVAL; alt = pcu->data_intf->cur_altsetting; if (alt->desc.bNumEndpoints != 2) { dev_err(pcu->dev, "Incorrect number of endpoints on data interface (%d)\n", alt->desc.bNumEndpoints); return -EINVAL; } pcu->ep_out = &alt->endpoint[0].desc; if (!usb_endpoint_is_bulk_out(pcu->ep_out)) { dev_err(pcu->dev, "First endpoint on data interface is not BULK OUT\n"); return -EINVAL; } pcu->max_out_size = usb_endpoint_maxp(pcu->ep_out); if (pcu->max_out_size < 8) { dev_err(pcu->dev, "Max OUT packet size is too small (%zd)\n", pcu->max_out_size); return -EINVAL; } pcu->ep_in = &alt->endpoint[1].desc; if (!usb_endpoint_is_bulk_in(pcu->ep_in)) { dev_err(pcu->dev, "Second endpoint on data interface is not BULK IN\n"); return -EINVAL; } pcu->max_in_size = usb_endpoint_maxp(pcu->ep_in); if (pcu->max_in_size < 8) { dev_err(pcu->dev, "Max IN packet size is too small (%zd)\n", pcu->max_in_size); return -EINVAL; } return 0; }
0
Chrome
80742f2ffeb9e90cd85cbee27acb9f924ffebd16
NOT_APPLICABLE
NOT_APPLICABLE
void AutofillManager::GetCreditCardSuggestions(FormStructure* form, const FormField& field, AutofillFieldType type, std::vector<string16>* values, std::vector<string16>* labels, std::vector<string16>* icons, std::vector<int>* unique_ids) { for (std::vector<CreditCard*>::const_iterator iter = personal_data_->credit_cards().begin(); iter != personal_data_->credit_cards().end(); ++iter) { CreditCard* credit_card = *iter; string16 creditcard_field_value = credit_card->GetInfo(type); if (!creditcard_field_value.empty() && StartsWith(creditcard_field_value, field.value, false)) { if (type == CREDIT_CARD_NUMBER) creditcard_field_value = credit_card->ObfuscatedNumber(); string16 label; if (credit_card->number().empty()) { label = credit_card->GetInfo(CREDIT_CARD_NAME); } else { label = kCreditCardPrefix; label.append(credit_card->LastFourDigits()); } values->push_back(creditcard_field_value); labels->push_back(label); icons->push_back(UTF8ToUTF16(credit_card->type())); unique_ids->push_back(PackGUIDs(GUIDPair(credit_card->guid(), 0), GUIDPair(std::string(), 0))); } } }
0
percona-xtradb-cluster
8a338477c9184dd0e03a5c661e9c3a79456de8a4
NOT_APPLICABLE
NOT_APPLICABLE
static void wsrep_sst_complete(THD *thd, int const rcode) { Wsrep_client_service client_service(thd, thd->wsrep_cs()); Wsrep_server_state::instance().sst_received(client_service, rcode, &sst_awaiting_callback); }
0
Chrome
0d151e09e13a704e9738ea913d117df7282e6c7d
NOT_APPLICABLE
NOT_APPLICABLE
~ProxyPlatform() { blink::Platform::initialize(m_platform); }
0
gpac
7bb1b4a4dd23c885f9db9f577dfe79ecc5433109
NOT_APPLICABLE
NOT_APPLICABLE
void gf_m4v_rewrite_pl(u8 **o_data, u32 *o_dataLen, u8 PL) { u32 pos = 0; unsigned char *data = (unsigned char *)*o_data; u32 dataLen = *o_dataLen; while (pos + 4 < dataLen) { if (!data[pos] && !data[pos + 1] && (data[pos + 2] == 0x01) && (data[pos + 3] == M4V_VOS_START_CODE)) { data[pos + 4] = PL; return; } pos++; } /*emulate VOS at beggining*/ (*o_data) = (char *)gf_malloc(sizeof(char)*(dataLen + 5)); (*o_data)[0] = 0; (*o_data)[1] = 0; (*o_data)[2] = 1; (*o_data)[3] = (char)M4V_VOS_START_CODE; (*o_data)[4] = PL; memcpy((*o_data + 5), data, sizeof(char)*dataLen); gf_free(data); (*o_dataLen) = dataLen + 5; }
0
linux
d80b64ff297e40c2b6f7d7abc1b3eba70d22a068
NOT_APPLICABLE
NOT_APPLICABLE
static inline void set_exception_intercept(struct vcpu_svm *svm, int bit) { struct vmcb *vmcb = get_host_vmcb(svm); vmcb->control.intercept_exceptions |= (1U << bit); recalc_intercepts(svm); }
0
gpac
a69b567b8c95c72f9560c873c5ab348be058f340
NOT_APPLICABLE
NOT_APPLICABLE
GF_AVCConfig *gf_odf_avc_cfg_read(u8 *dsi, u32 dsi_size) { u32 i, count; GF_AVCConfig *avcc = gf_odf_avc_cfg_new(); GF_BitStream *bs = gf_bs_new(dsi, dsi_size, GF_BITSTREAM_READ); avcc->configurationVersion = gf_bs_read_int(bs, 8); avcc->AVCProfileIndication = gf_bs_read_int(bs, 8); avcc->profile_compatibility = gf_bs_read_int(bs, 8); avcc->AVCLevelIndication = gf_bs_read_int(bs, 8); gf_bs_read_int(bs, 6); avcc->nal_unit_size = 1 + gf_bs_read_int(bs, 2); gf_bs_read_int(bs, 3); count = gf_bs_read_int(bs, 5); for (i=0; i<count; i++) { GF_NALUFFParam *sl = (GF_NALUFFParam *)gf_malloc(sizeof(GF_NALUFFParam)); sl->size = gf_bs_read_int(bs, 16); sl->data = (char*)gf_malloc(sizeof(char)*sl->size); gf_bs_read_data(bs, sl->data, sl->size); gf_list_add(avcc->sequenceParameterSets, sl); } count = gf_bs_read_int(bs, 8); for (i=0; i<count; i++) { GF_NALUFFParam *sl = (GF_NALUFFParam *)gf_malloc(sizeof(GF_NALUFFParam)); sl->size = gf_bs_read_int(bs, 16); sl->data = (char*)gf_malloc(sizeof(char)*sl->size); gf_bs_read_data(bs, sl->data, sl->size); gf_list_add(avcc->pictureParameterSets, sl); } if (gf_avc_is_rext_profile(avcc->AVCProfileIndication)) { gf_bs_read_int(bs, 6); avcc->chroma_format = gf_bs_read_int(bs, 2); gf_bs_read_int(bs, 5); avcc->luma_bit_depth = 8 + gf_bs_read_int(bs, 3); gf_bs_read_int(bs, 5); avcc->chroma_bit_depth = 8 + gf_bs_read_int(bs, 3); count = gf_bs_read_int(bs, 8); if (count) { avcc->sequenceParameterSetExtensions = gf_list_new(); for (i=0; i<count; i++) { GF_NALUFFParam *sl = (GF_NALUFFParam *)gf_malloc(sizeof(GF_NALUFFParam)); sl->size = gf_bs_read_u16(bs); sl->data = (char *)gf_malloc(sizeof(char) * sl->size); gf_bs_read_data(bs, sl->data, sl->size); gf_list_add(avcc->sequenceParameterSetExtensions, sl); } } } gf_bs_del(bs); return avcc; }
0
vim
399c297aa93afe2c0a39e2a1b3f972aebba44c9d
NOT_APPLICABLE
NOT_APPLICABLE
wordtree_compress(spellinfo_T *spin, wordnode_T *root) { hashtab_T ht; int n; int tot = 0; int perc; /* Skip the root itself, it's not actually used. The first sibling is the * start of the tree. */ if (root->wn_sibling != NULL) { hash_init(&ht); n = node_compress(spin, root->wn_sibling, &ht, &tot); #ifndef SPELL_PRINTTREE if (spin->si_verbose || p_verbose > 2) #endif { if (tot > 1000000) perc = (tot - n) / (tot / 100); else if (tot == 0) perc = 0; else perc = (tot - n) * 100 / tot; vim_snprintf((char *)IObuff, IOSIZE, _("Compressed %d of %d nodes; %d (%d%%) remaining"), n, tot, tot - n, perc); spell_message(spin, IObuff); } #ifdef SPELL_PRINTTREE spell_print_tree(root->wn_sibling); #endif hash_clear(&ht); } }
0
linux
1f461dcdd296eecedaffffc6bae2bfa90bd7eb89
NOT_APPLICABLE
NOT_APPLICABLE
ppp_set_compress(struct ppp *ppp, unsigned long arg) { int err; struct compressor *cp, *ocomp; struct ppp_option_data data; void *state, *ostate; unsigned char ccp_option[CCP_MAX_OPTION_LENGTH]; err = -EFAULT; if (copy_from_user(&data, (void __user *) arg, sizeof(data))) goto out; if (data.length > CCP_MAX_OPTION_LENGTH) goto out; if (copy_from_user(ccp_option, (void __user *) data.ptr, data.length)) goto out; err = -EINVAL; if (data.length < 2 || ccp_option[1] < 2 || ccp_option[1] > data.length) goto out; cp = try_then_request_module( find_compressor(ccp_option[0]), "ppp-compress-%d", ccp_option[0]); if (!cp) goto out; err = -ENOBUFS; if (data.transmit) { state = cp->comp_alloc(ccp_option, data.length); if (state) { ppp_xmit_lock(ppp); ppp->xstate &= ~SC_COMP_RUN; ocomp = ppp->xcomp; ostate = ppp->xc_state; ppp->xcomp = cp; ppp->xc_state = state; ppp_xmit_unlock(ppp); if (ostate) { ocomp->comp_free(ostate); module_put(ocomp->owner); } err = 0; } else module_put(cp->owner); } else { state = cp->decomp_alloc(ccp_option, data.length); if (state) { ppp_recv_lock(ppp); ppp->rstate &= ~SC_DECOMP_RUN; ocomp = ppp->rcomp; ostate = ppp->rc_state; ppp->rcomp = cp; ppp->rc_state = state; ppp_recv_unlock(ppp); if (ostate) { ocomp->decomp_free(ostate); module_put(ocomp->owner); } err = 0; } else module_put(cp->owner); } out: return err; }
0
Chrome
eb4bcacd683a68534bbe2e4d8d6eeafafc7f57ba
NOT_APPLICABLE
NOT_APPLICABLE
void ResourceDispatcherHostImpl::RemoveResourceContext( ResourceContext* context) { CHECK(ContainsKey(active_resource_contexts_, context)); active_resource_contexts_.erase(context); }
0
qemu
d710e1e7bd3d5bfc26b631f02ae87901ebe646b0
NOT_APPLICABLE
NOT_APPLICABLE
static inline bool ehci_async_enabled(EHCIState *s) { return ehci_enabled(s) && (s->usbcmd & USBCMD_ASE); }
0
Chrome
5cb799a393ba9e732f89f687ff3a322b4514ebfb
NOT_APPLICABLE
NOT_APPLICABLE
void HTMLFormControlElement::setFormEnctype(const AtomicString& value) { setAttribute(kFormenctypeAttr, value); }
0
CImg
ac8003393569aba51048c9d67e1491559877b1d1
NOT_APPLICABLE
NOT_APPLICABLE
template<typename t> CImg(const t *const values, const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_shared=false):_is_shared(false) { if (is_shared) { _width = _height = _depth = _spectrum = 0; _data = 0; throw CImgArgumentException(_cimg_instance "CImg(): Invalid construction request of a (%u,%u,%u,%u) shared instance " "from a (%s*) buffer (pixel types are different).", cimg_instance, size_x,size_y,size_z,size_c,CImg<t>::pixel_type()); } const size_t siz = (size_t)size_x*size_y*size_z*size_c; if (values && siz) { _width = size_x; _height = size_y; _depth = size_z; _spectrum = size_c; try { _data = new T[siz]; } catch (...) { _width = _height = _depth = _spectrum = 0; _data = 0; throw CImgInstanceException(_cimg_instance "CImg(): Failed to allocate memory (%s) for image (%u,%u,%u,%u).", cimg_instance, cimg::strbuffersize(sizeof(T)*size_x*size_y*size_z*size_c), size_x,size_y,size_z,size_c); } const t *ptrs = values; cimg_for(*this,ptrd,T) *ptrd = (T)*(ptrs++); } else { _width = _height = _depth = _spectrum = 0; _data = 0; }
0
Chrome
2f663de43634c1197a7a2ed8afc12cb6dc565bd0
NOT_APPLICABLE
NOT_APPLICABLE
void WaitForFence(EGLDisplay display, EGLSyncKHR fence) { eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR); }
0