project
stringclasses
788 values
commit_id
stringlengths
6
81
CVE ID
stringlengths
13
16
CWE ID
stringclasses
126 values
func
stringlengths
14
482k
vul
int8
0
1
Chrome
c0da7c1c6e9ffe5006e146b6426f987238d4bf2e
NOT_APPLICABLE
NOT_APPLICABLE
static void TerminateWorker(scoped_refptr<WorkerData> worker_data) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&TerminateWorkerOnIOThread, worker_data)); content::RunMessageLoop(); }
0
Chrome
5788690fb1395dc672ff9b3385dbfb1180ed710a
NOT_APPLICABLE
NOT_APPLICABLE
void DelegatedFrameHost::DidCreateNewRendererCompositorFrameSink( viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) { ResetCompositorFrameSinkSupport(); renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; CreateCompositorFrameSinkSupport(); has_frame_ = false; }
0
linux
6f24f892871acc47b40dd594c63606a17c714f77
CVE-2012-2319
CWE-264
int hfsplus_rename_cat(u32 cnid, struct inode *src_dir, struct qstr *src_name, struct inode *dst_dir, struct qstr *dst_name) { struct super_block *sb = src_dir->i_sb; struct hfs_find_data src_fd, dst_fd; hfsplus_cat_entry entry; int entry_size, type; int err; dprint(DBG_CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", cnid, src_dir->i_ino, src_name->name, dst_dir->i_ino, dst_name->name); err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &src_fd); if (err) return err; dst_fd = src_fd; /* find the old dir entry and read the data */ hfsplus_cat_build_key(sb, src_fd.search_key, src_dir->i_ino, src_name); err = hfs_brec_find(&src_fd); if (err) goto out; hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, src_fd.entrylength); /* create new dir entry with the data from the old entry */ hfsplus_cat_build_key(sb, dst_fd.search_key, dst_dir->i_ino, dst_name); err = hfs_brec_find(&dst_fd); if (err != -ENOENT) { if (!err) err = -EEXIST; goto out; } err = hfs_brec_insert(&dst_fd, &entry, src_fd.entrylength); if (err) goto out; dst_dir->i_size++; dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; /* finally remove the old entry */ hfsplus_cat_build_key(sb, src_fd.search_key, src_dir->i_ino, src_name); err = hfs_brec_find(&src_fd); if (err) goto out; err = hfs_brec_remove(&src_fd); if (err) goto out; src_dir->i_size--; src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; /* remove old thread entry */ hfsplus_cat_build_key(sb, src_fd.search_key, cnid, NULL); err = hfs_brec_find(&src_fd); if (err) goto out; type = hfs_bnode_read_u16(src_fd.bnode, src_fd.entryoffset); err = hfs_brec_remove(&src_fd); if (err) goto out; /* create new thread entry */ hfsplus_cat_build_key(sb, dst_fd.search_key, cnid, NULL); entry_size = hfsplus_fill_cat_thread(sb, &entry, type, dst_dir->i_ino, dst_name); err = hfs_brec_find(&dst_fd); if (err != -ENOENT) { if (!err) err = -EEXIST; goto out; } err = hfs_brec_insert(&dst_fd, &entry, entry_size); hfsplus_mark_inode_dirty(dst_dir, HFSPLUS_I_CAT_DIRTY); hfsplus_mark_inode_dirty(src_dir, HFSPLUS_I_CAT_DIRTY); out: hfs_bnode_put(dst_fd.bnode); hfs_find_exit(&src_fd); return err; }
1
gpac
3b84ffcbacf144ce35650df958432f472b6483f8
NOT_APPLICABLE
NOT_APPLICABLE
GF_Err gf_isom_get_cenc_info(GF_ISOFile *the_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion) { GF_TrackBox *trak; GF_ProtectionSchemeInfoBox *sinf; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak) return GF_BAD_PARAM; sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CENC_SCHEME, NULL); if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CBC_SCHEME, NULL); if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CENS_SCHEME, NULL); if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_CBCS_SCHEME, NULL); if (!sinf) sinf = isom_get_sinf_entry(trak, sampleDescriptionIndex, GF_ISOM_PIFF_SCHEME, NULL); if (!sinf) return GF_BAD_PARAM; if (outOriginalFormat) { *outOriginalFormat = sinf->original_format->data_format; if (IsMP4Description(sinf->original_format->data_format)) *outOriginalFormat = GF_ISOM_SUBTYPE_MPEG4; } if (outSchemeType) *outSchemeType = sinf->scheme_type->scheme_type; if (outSchemeVersion) *outSchemeVersion = sinf->scheme_type->scheme_version; return GF_OK; }
0
Chrome
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
CVE-2016-1683
CWE-119
xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNsPtr cur) { xmlNsPtr ret = NULL, tmp; xmlNsPtr p = NULL,q; if (cur == NULL) return(NULL); if (cur->type != XML_NAMESPACE_DECL) return(NULL); /* * One can add namespaces only on element nodes */ if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) node = NULL; while (cur != NULL) { if (cur->type != XML_NAMESPACE_DECL) break; /* * Avoid duplicating namespace declarations in the tree if * a matching declaration is in scope. */ if (node != NULL) { if ((node->ns != NULL) && (xmlStrEqual(node->ns->prefix, cur->prefix)) && (xmlStrEqual(node->ns->href, cur->href))) { cur = cur->next; continue; } tmp = xmlSearchNs(node->doc, node, cur->prefix); if ((tmp != NULL) && (xmlStrEqual(tmp->href, cur->href))) { cur = cur->next; continue; } } #ifdef XSLT_REFACTORED /* * Namespace exclusion and ns-aliasing is performed at * compilation-time in the refactored code. */ q = xmlNewNs(node, cur->href, cur->prefix); if (p == NULL) { ret = p = q; } else { p->next = q; p = q; } #else /* * TODO: Remove this if the refactored code gets enabled. */ if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) { const xmlChar *URI; /* TODO apply cascading */ URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases, cur->href); if (URI == UNDEFINED_DEFAULT_NS) continue; if (URI != NULL) { q = xmlNewNs(node, URI, cur->prefix); } else { q = xmlNewNs(node, cur->href, cur->prefix); } if (p == NULL) { ret = p = q; } else { p->next = q; p = q; } } #endif cur = cur->next; } return(ret); }
1
node
78b0e30954111cfaba0edbeee85450d8cbc6fdf6
NOT_APPLICABLE
NOT_APPLICABLE
uchar Utf8::CalculateValue(const byte* str, unsigned length, unsigned* cursor) { // We only get called for non-ASCII characters. if (length == 1) { *cursor += 1; return kBadChar; } byte first = str[0]; byte second = str[1] ^ 0x80; if (second & 0xC0) { *cursor += 1; return kBadChar; } if (first < 0xE0) { if (first < 0xC0) { *cursor += 1; return kBadChar; } uchar code_point = ((first << 6) | second) & kMaxTwoByteChar; if (code_point <= kMaxOneByteChar) { *cursor += 1; return kBadChar; } *cursor += 2; return code_point; } if (length == 2) { *cursor += 1; return kBadChar; } byte third = str[2] ^ 0x80; if (third & 0xC0) { *cursor += 1; return kBadChar; } if (first < 0xF0) { uchar code_point = ((((first << 6) | second) << 6) | third) & kMaxThreeByteChar; if (code_point <= kMaxTwoByteChar) { *cursor += 1; return kBadChar; } *cursor += 3; return code_point; } if (length == 3) { *cursor += 1; return kBadChar; } byte fourth = str[3] ^ 0x80; if (fourth & 0xC0) { *cursor += 1; return kBadChar; } if (first < 0xF8) { uchar code_point = (((((first << 6 | second) << 6) | third) << 6) | fourth) & kMaxFourByteChar; if (code_point <= kMaxThreeByteChar) { *cursor += 1; return kBadChar; } *cursor += 4; return code_point; } *cursor += 1; return kBadChar; }
0
php
2cc4e69cc6d8dbc4b3568ad3dd583324a7c11d64
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(pg_copy_from) { zval *pgsql_link = NULL, *pg_rows; zval **tmp; char *table_name, *pg_delim = NULL, *pg_null_as = NULL; int table_name_len, pg_delim_len, pg_null_as_len; int pg_null_as_free = 0; char *query; HashPosition pos; int id = -1; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, "rsa|ss", &pgsql_link, &table_name, &table_name_len, &pg_rows, &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) { return; } if (!pg_delim) { pg_delim = "\t"; } if (!pg_null_as) { pg_null_as = safe_estrdup("\\\\N"); pg_null_as_free = 1; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } pgsql_result = PQexec(pgsql, query); if (pg_null_as_free) { efree(pg_null_as); } efree(query); if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_COPY_IN: if (pgsql_result) { int command_failed = 0; PQclear(pgsql_result); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(pg_rows), &pos); #if HAVE_PQPUTCOPYDATA while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { zval *value; ALLOC_ZVAL(value); INIT_PZVAL_COPY(value, *tmp); zval_copy_ctor(value); convert_to_string_ex(&value); query = (char *)emalloc(Z_STRLEN_P(value) + 2); strlcpy(query, Z_STRVAL_P(value), Z_STRLEN_P(value) + 2); if(Z_STRLEN_P(value) > 0 && *(query + Z_STRLEN_P(value) - 1) != '\n') { strlcat(query, "\n", Z_STRLEN_P(value) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); zval_dtor(value); efree(value); PHP_PQ_ERROR("copy failed: %s", pgsql); RETURN_FALSE; } efree(query); zval_dtor(value); efree(value); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputCopyEnd(pgsql, NULL) != 1) { PHP_PQ_ERROR("putcopyend failed: %s", pgsql); RETURN_FALSE; } #else while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { zval *value; ALLOC_ZVAL(value); INIT_PZVAL_COPY(value, *tmp); zval_copy_ctor(value); convert_to_string_ex(&value); query = (char *)emalloc(Z_STRLEN_P(value) + 2); strlcpy(query, Z_STRVAL_P(value), Z_STRLEN_P(value) + 2); if(Z_STRLEN_P(value) > 0 && *(query + Z_STRLEN_P(value) - 1) != '\n') { strlcat(query, "\n", Z_STRLEN_P(value) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); zval_dtor(value); efree(value); PHP_PQ_ERROR("copy failed: %s", pgsql); RETURN_FALSE; } efree(query); zval_dtor(value); efree(value); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputline(pgsql, "\\.\n") == EOF) { PHP_PQ_ERROR("putline failed: %s", pgsql); RETURN_FALSE; } if (PQendcopy(pgsql)) { PHP_PQ_ERROR("endcopy failed: %s", pgsql); RETURN_FALSE; } #endif while ((pgsql_result = PQgetResult(pgsql))) { if (PGRES_COMMAND_OK != PQresultStatus(pgsql_result)) { PHP_PQ_ERROR("Copy command failed: %s", pgsql); command_failed = 1; } PQclear(pgsql_result); } if (command_failed) { RETURN_FALSE; } } else { PQclear(pgsql_result); RETURN_FALSE; } RETURN_TRUE; break; default: PQclear(pgsql_result); PHP_PQ_ERROR("Copy command failed: %s", pgsql); RETURN_FALSE; break; } }
0
linux
38ea1eac7d88072bbffb630e2b3db83ca649b826
NOT_APPLICABLE
NOT_APPLICABLE
int rndis_set_param_medium(struct rndis_params *params, u32 medium, u32 speed) { pr_debug("%s: %u %u\n", __func__, medium, speed); if (!params) return -1; params->medium = medium; params->speed = speed; return 0; }
0
tcpdump
0cb1b8a434b599b8d636db029aadb757c24e39d6
NOT_APPLICABLE
NOT_APPLICABLE
olsr_print_lq_neighbor4(netdissect_options *ndo, const u_char *msg_data, u_int hello_len) { const struct olsr_lq_neighbor4 *lq_neighbor; while (hello_len >= sizeof(struct olsr_lq_neighbor4)) { lq_neighbor = (const struct olsr_lq_neighbor4 *)msg_data; if (!ND_TTEST(*lq_neighbor)) return (-1); ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2f%%" ", neighbor-link-quality %.2f%%", ipaddr_string(ndo, lq_neighbor->neighbor), ((double)lq_neighbor->link_quality/2.55), ((double)lq_neighbor->neighbor_link_quality/2.55))); msg_data += sizeof(struct olsr_lq_neighbor4); hello_len -= sizeof(struct olsr_lq_neighbor4); } return (0); }
0
xterm-snapshots
82ba55b8f994ab30ff561a347b82ea340ba7075c
NOT_APPLICABLE
NOT_APPLICABLE
alloc8bitTargets(Widget w, TScreen *screen) { Atom **resultp = &(screen->selection_targets_8bit); if (*resultp == 0) { Atom *result = 0; if (!overrideTargets(w, screen->eightbit_select_types, &result)) { result = TypeXtMallocN(Atom, 5); if (result == NULL) { TRACE(("Couldn't allocate 8bit selection targets\n")); } else { int n = 0; if (XSupportsLocale()) { #ifdef X_HAVE_UTF8_STRING result[n++] = XA_UTF8_STRING(XtDisplay(w)); #endif if (screen->i18nSelections) { result[n++] = XA_TEXT(XtDisplay(w)); result[n++] = XA_COMPOUND_TEXT(XtDisplay(w)); } } result[n++] = XA_STRING; result[n] = None; } } *resultp = result; } return *resultp; }
0
linux
6ff7b060535e87c2ae14dd8548512abfdda528fb
NOT_APPLICABLE
NOT_APPLICABLE
int mdiobus_register_device(struct mdio_device *mdiodev) { int err; if (mdiodev->bus->mdio_map[mdiodev->addr]) return -EBUSY; if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) { err = mdiobus_register_gpiod(mdiodev); if (err) return err; } mdiodev->bus->mdio_map[mdiodev->addr] = mdiodev; return 0; }
0
Chrome
12c876ae82355de6285bf0879023f1d1f1822ecf
NOT_APPLICABLE
NOT_APPLICABLE
void MediaStreamManager::DoNativeLogCallbackUnregistration( int renderer_host_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); log_callbacks_.erase(renderer_host_id); }
0
Chrome
c6f0d22d508a551a40fc8bd7418941b77435aac3
NOT_APPLICABLE
NOT_APPLICABLE
void OmniboxViewViews::OnFocus() { views::Textfield::OnFocus(); model()->ResetDisplayTexts(); model()->OnSetFocus(false); if (saved_selection_for_focus_change_.IsValid()) { SelectRange(saved_selection_for_focus_change_); saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); } GetRenderText()->SetElideBehavior(gfx::NO_ELIDE); if (location_bar_view_ && model()->is_keyword_hint()) location_bar_view_->Layout(); #if BUILDFLAG(ENABLE_DESKTOP_IN_PRODUCT_HELP) if (location_bar_view_ && controller()->GetLocationBarModel()->ShouldDisplayURL()) { feature_engagement::NewTabTrackerFactory::GetInstance() ->GetForProfile(location_bar_view_->profile()) ->OnOmniboxFocused(); } #endif if (location_bar_view_) location_bar_view_->OnOmniboxFocused(); }
0
ImageMagick
b0c5222ce31e8f941fa02ff9c7a040fb2db30dbc
NOT_APPLICABLE
NOT_APPLICABLE
static OPJ_SIZE_T JP2ReadHandler(void *buffer,OPJ_SIZE_T length,void *context) { Image *image; ssize_t count; image=(Image *) context; count=ReadBlob(image,(ssize_t) length,(unsigned char *) buffer); if (count == 0) return((OPJ_SIZE_T) -1); return((OPJ_SIZE_T) count); }
0
linux
fbe0e839d1e22d88810f3ee3e2f1479be4c0aa4a
NOT_APPLICABLE
NOT_APPLICABLE
static int lock_pi_update_atomic(u32 __user *uaddr, u32 uval, u32 newval) { u32 uninitialized_var(curval); if (unlikely(should_fail_futex(true))) return -EFAULT; if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))) return -EFAULT; /* If user space value changed, let the caller retry */ return curval != uval ? -EAGAIN : 0; }
0
savannah
3fcd042d26d70856e826a42b5f93dc4854d80bf0
NOT_APPLICABLE
NOT_APPLICABLE
pch_swap (void) { char **tp_line; /* the text of the hunk */ size_t *tp_len; /* length of each line */ char *tp_char; /* +, -, and ! */ lin i; lin n; bool blankline = false; char *s; i = p_first; p_first = p_newfirst; p_newfirst = i; /* make a scratch copy */ tp_line = p_line; tp_len = p_len; tp_char = p_Char; p_line = 0; /* force set_hunkmax to allocate again */ p_len = 0; p_Char = 0; set_hunkmax(); if (!p_line || !p_len || !p_Char) { free (p_line); p_line = tp_line; free (p_len); p_len = tp_len; free (p_Char); p_Char = tp_char; return false; /* not enough memory to swap hunk! */ } /* now turn the new into the old */ i = p_ptrn_lines + 1; if (tp_char[i] == '\n') { /* account for possible blank line */ blankline = true; i++; } if (p_efake >= 0) { /* fix non-freeable ptr range */ if (p_efake <= i) n = p_end - i + 1; else n = -i; p_efake += n; p_bfake += n; } for (n=0; i <= p_end; i++,n++) { p_line[n] = tp_line[i]; p_Char[n] = tp_char[i]; if (p_Char[n] == '+') p_Char[n] = '-'; p_len[n] = tp_len[i]; } if (blankline) { i = p_ptrn_lines + 1; p_line[n] = tp_line[i]; p_Char[n] = tp_char[i]; p_len[n] = tp_len[i]; n++; } assert(p_Char[0] == '='); p_Char[0] = '*'; for (s=p_line[0]; *s; s++) if (*s == '-') *s = '*'; /* now turn the old into the new */ assert(tp_char[0] == '*'); tp_char[0] = '='; for (s=tp_line[0]; *s; s++) if (*s == '*') *s = '-'; for (i=0; n <= p_end; i++,n++) { p_line[n] = tp_line[i]; p_Char[n] = tp_char[i]; if (p_Char[n] == '-') p_Char[n] = '+'; p_len[n] = tp_len[i]; } assert(i == p_ptrn_lines + 1); i = p_ptrn_lines; p_ptrn_lines = p_repl_lines; p_repl_lines = i; p_Char[p_end + 1] = '^'; free (tp_line); free (tp_len); free (tp_char); return true; }
0
das_watchdog
bd20bb02e75e2c0483832b52f2577253febfb690
NOT_APPLICABLE
NOT_APPLICABLE
static ui64 get_pid_start_time(pid_t pid){ glibtop_proc_time buf={0}; glibtop_get_proc_time(&buf,pid); return buf.start_time; }
0
php-src
777c39f4042327eac4b63c7ee87dc1c7a09a3115
NOT_APPLICABLE
NOT_APPLICABLE
int zend_shared_alloc_startup(size_t requested_size) { zend_shared_segment **tmp_shared_segments; size_t shared_segments_array_size; zend_smm_shared_globals tmp_shared_globals, *p_tmp_shared_globals; char *error_in = NULL; const zend_shared_memory_handler_entry *he; int res = ALLOC_FAILURE; /* shared_free must be valid before we call zend_shared_alloc() * - make it temporarily point to a local variable */ smm_shared_globals = &tmp_shared_globals; ZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */ zend_shared_alloc_create_lock(); if (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) { char *model = ZCG(accel_directives).memory_model; /* "cgi" is really "shm"... */ if (strncmp(ZCG(accel_directives).memory_model, "cgi", sizeof("cgi")) == 0) { model = "shm"; } for (he = handler_table; he->name; he++) { if (strcmp(model, he->name) == 0) { res = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in); if (res) { /* this model works! */ } break; } } } if (res == FAILED_REATTACHED) { smm_shared_globals = NULL; return res; } if (!g_shared_alloc_handler) { /* try memory handlers in order */ for (he = handler_table; he->name; he++) { res = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in); if (res) { /* this model works! */ break; } } } if (!g_shared_alloc_handler) { no_memory_bailout(requested_size, error_in); return ALLOC_FAILURE; } if (res == SUCCESSFULLY_REATTACHED) { return res; } shared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)(); /* move shared_segments and shared_free to shared memory */ ZCG(locked) = 1; /* no need to perform a real lock at this point */ p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals)); if (!p_tmp_shared_globals) { zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!"); return ALLOC_FAILURE;; } tmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *)); if (!tmp_shared_segments) { zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!"); return ALLOC_FAILURE;; } copy_shared_segments(tmp_shared_segments, ZSMMG(shared_segments)[0], ZSMMG(shared_segments_count), S_H(segment_type_size)()); *p_tmp_shared_globals = tmp_shared_globals; smm_shared_globals = p_tmp_shared_globals; free(ZSMMG(shared_segments)); ZSMMG(shared_segments) = tmp_shared_segments; ZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count)); if (!ZSMMG(shared_memory_state).positions) { zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!"); return ALLOC_FAILURE;; } ZCG(locked) = 0; return res; }
0
linux
dad5ab0db8deac535d03e3fe3d8f2892173fa6a4
NOT_APPLICABLE
NOT_APPLICABLE
static void acpi_unregister_gsi_ioapic(u32 gsi) { #ifdef CONFIG_X86_IO_APIC int irq; mutex_lock(&acpi_ioapic_lock); irq = mp_map_gsi_to_irq(gsi, 0, NULL); if (irq > 0) mp_unmap_irq(irq); mutex_unlock(&acpi_ioapic_lock); #endif }
0
exim
d4bc023436e4cce7c23c5f8bb5199e178b4cc743
NOT_APPLICABLE
NOT_APPLICABLE
tlsa_lookup(const host_item * host, dns_answer * dnsa, BOOL dane_required) { uschar buffer[300]; const uschar * fullname = buffer; int rc; BOOL sec; /* TLSA lookup string */ (void)sprintf(CS buffer, "_%d._tcp.%.256s", host->port, host->name); rc = dns_lookup_timerwrap(dnsa, buffer, T_TLSA, &fullname); sec = dns_is_secure(dnsa); DEBUG(D_transport) debug_printf("TLSA lookup ret %s %sDNSSEC\n", dns_rc_names[rc], sec ? "" : "not "); switch (rc) { case DNS_AGAIN: return DEFER; /* just defer this TLS'd conn */ case DNS_SUCCEED: if (sec) { DEBUG(D_transport) { dns_scan dnss; for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)) if (rr->type == T_TLSA && rr->size > 3) { uint16_t payload_length = rr->size - 3; uschar s[MAX_TLSA_EXPANDED_SIZE], * sp = s, * p = US rr->data; sp += sprintf(CS sp, "%d ", *p++); /* usage */ sp += sprintf(CS sp, "%d ", *p++); /* selector */ sp += sprintf(CS sp, "%d ", *p++); /* matchtype */ while (payload_length-- > 0 && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4)) sp += sprintf(CS sp, "%02x", *p++); debug_printf(" %s\n", s); } } return OK; } log_write(0, LOG_MAIN, "DANE error: TLSA lookup for %s not DNSSEC", host->name); /*FALLTRHOUGH*/ case DNS_NODATA: /* no TLSA RR for this lookup */ case DNS_NOMATCH: /* no records at all for this lookup */ return dane_required ? FAIL : FAIL_FORCED; default: case DNS_FAIL: return dane_required ? FAIL : DEFER; } }
0
Chrome
03c2e97746a2c471ae136b0c669f8d0c033fe168
NOT_APPLICABLE
NOT_APPLICABLE
std::unique_ptr<HistogramBase> BooleanHistogram::PersistentCreate( const std::string& name, const BucketRanges* ranges, HistogramBase::AtomicCount* counts, HistogramBase::AtomicCount* logged_counts, HistogramSamples::Metadata* meta, HistogramSamples::Metadata* logged_meta) { return WrapUnique(new BooleanHistogram( name, ranges, counts, logged_counts, meta, logged_meta)); }
0
redis
5ccb6f7a791bf3490357b00a898885759d98bab0
CVE-2018-11218
CWE-119
void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) { assert(len <= UINT_MAX); int index = 1; lua_newtable(L); while(len--) { lua_pushnumber(L,index++); mp_decode_to_lua_type(L,c); if (c->err) return; lua_settable(L,-3); } }
1
minetest
3693b6871eba268ecc79b3f52d00d3cefe761131
NOT_APPLICABLE
NOT_APPLICABLE
void Server::handleCommand_Damage(NetworkPacket* pkt) { u16 damage; *pkt >> damage; session_t peer_id = pkt->getPeerId(); RemotePlayer *player = m_env->getPlayer(peer_id); if (player == NULL) { errorstream << "Server::ProcessData(): Canceling: No player for peer_id=" << peer_id << " disconnecting peer!" << std::endl; DisconnectPeer(peer_id); return; } PlayerSAO *playersao = player->getPlayerSAO(); if (playersao == NULL) { errorstream << "Server::ProcessData(): Canceling: No player object for peer_id=" << peer_id << " disconnecting peer!" << std::endl; DisconnectPeer(peer_id); return; } if (!playersao->isImmortal()) { if (playersao->isDead()) { verbosestream << "Server::ProcessData(): Info: " "Ignoring damage as player " << player->getName() << " is already dead." << std::endl; return; } actionstream << player->getName() << " damaged by " << (int)damage << " hp at " << PP(playersao->getBasePosition() / BS) << std::endl; PlayerHPChangeReason reason(PlayerHPChangeReason::FALL); playersao->setHP((s32)playersao->getHP() - (s32)damage, reason); SendPlayerHPOrDie(playersao, reason); } }
0
tip
7bdb157cdebbf95a1cd94ed2e01b338714075d00
NOT_APPLICABLE
NOT_APPLICABLE
del_event_from_groups(struct perf_event *event, struct perf_event_context *ctx) { struct perf_event_groups *groups; groups = get_event_groups(event, ctx); perf_event_groups_delete(groups, event); }
0
wesnoth
af61f9fdd15cd439da9e2fe5fa39d174c923eaae
NOT_APPLICABLE
NOT_APPLICABLE
std::string normalize_path(const std::string &p1) { if (p1.empty()) return p1; std::string p2; #ifdef _WIN32 if (p1.size() >= 2 && p1[1] == ':') // Windows relative paths with explicit drive name are not handled. p2 = p1; else #endif if (!is_path_sep(p1[0])) p2 = get_cwd() + "/" + p1; else p2 = p1; #ifdef _WIN32 std::string drive; if (p2.size() >= 2 && p2[1] == ':') { drive = p2.substr(0, 2); p2.erase(0, 2); } #endif std::vector<std::string> components(1); for (int i = 0, i_end = p2.size(); i <= i_end; ++i) { std::string &last = components[components.size() - 1]; char c = p2.c_str()[i]; if (is_path_sep(c) || c == 0) { if (last == ".") last.clear(); else if (last == "..") { if (components.size() >= 2) { components.pop_back(); components[components.size() - 1].clear(); } else last.clear(); } else if (!last.empty()) components.push_back(std::string()); } else last += c; } std::ostringstream p4; components.pop_back(); #ifdef _WIN32 p4 << drive; #endif BOOST_FOREACH(const std::string &s, components) { p4 << '/' << s; } DBG_FS << "Normalizing '" << p2 << "' to '" << p4.str() << "'\n"; return p4.str(); }
0
tor
09ea89764a4d3a907808ed7d4fe42abfe64bd486
NOT_APPLICABLE
NOT_APPLICABLE
rend_service_load_all_keys(const smartlist_t *service_list) { /* Use service_list for unit tests */ const smartlist_t *s_list = rend_get_service_list(service_list); if (BUG(!s_list)) { return -1; } SMARTLIST_FOREACH_BEGIN(s_list, rend_service_t *, s) { if (s->private_key) continue; log_info(LD_REND, "Loading hidden-service keys from %s", rend_service_escaped_dir(s)); if (rend_service_load_keys(s) < 0) return -1; } SMARTLIST_FOREACH_END(s); return 0; }
0
openssl
fb9fa6b51defd48157eeb207f52181f735d96148
NOT_APPLICABLE
NOT_APPLICABLE
int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context, RAW_EXTENSION *exts, X509 *x, size_t chainidx) { RAW_EXTENSION *currext = &exts[idx]; int (*parser)(SSL *s, PACKET *pkt, unsigned int context, X509 *x, size_t chainidx) = NULL; /* Skip if the extension is not present */ if (!currext->present) return 1; /* Skip if we've already parsed this extension */ if (currext->parsed) return 1; currext->parsed = 1; if (idx < OSSL_NELEM(ext_defs)) { /* We are handling a built-in extension */ const EXTENSION_DEFINITION *extdef = &ext_defs[idx]; /* Check if extension is defined for our protocol. If not, skip */ if (!extension_is_relevant(s, extdef->context, context)) return 1; parser = s->server ? extdef->parse_ctos : extdef->parse_stoc; if (parser != NULL) return parser(s, &currext->data, context, x, chainidx); /* * If the parser is NULL we fall through to the custom extension * processing */ } /* Parse custom extensions */ return custom_ext_parse(s, context, currext->type, PACKET_data(&currext->data), PACKET_remaining(&currext->data), x, chainidx); }
0
gnupg
9010d1576e278a4274ad3f4aa15776c28f6ba965
CVE-2018-0495
CWE-200
_gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey, gcry_mpi_t r, gcry_mpi_t s, int flags, int hashalgo) { gpg_err_code_t rc = 0; int extraloops = 0; gcry_mpi_t k, dr, sum, k_1, x; mpi_point_struct I; gcry_mpi_t hash; const void *abuf; unsigned int abits, qbits; mpi_ec_t ctx; if (DBG_CIPHER) log_mpidump ("ecdsa sign hash ", input ); /* Convert the INPUT into an MPI if needed. */ rc = _gcry_dsa_normalize_hash (input, &hash, qbits); if (rc) return rc; if (rc) return rc; k = NULL; dr = mpi_alloc (0); sum = mpi_alloc (0); { do { mpi_free (k); k = NULL; if ((flags & PUBKEY_FLAG_RFC6979) && hashalgo) { /* Use Pornin's method for deterministic DSA. If this flag is set, it is expected that HASH is an opaque MPI with the to be signed hash. That hash is also used as h1 from 3.2.a. */ if (!mpi_is_opaque (input)) { rc = GPG_ERR_CONFLICT; goto leave; } abuf = mpi_get_opaque (input, &abits); rc = _gcry_dsa_gen_rfc6979_k (&k, skey->E.n, skey->d, abuf, (abits+7)/8, hashalgo, extraloops); if (rc) goto leave; extraloops++; } else k = _gcry_dsa_gen_k (skey->E.n, GCRY_STRONG_RANDOM); _gcry_mpi_ec_mul_point (&I, k, &skey->E.G, ctx); if (_gcry_mpi_ec_get_affine (x, NULL, &I, ctx)) { if (DBG_CIPHER) log_debug ("ecc sign: Failed to get affine coordinates\n"); rc = GPG_ERR_BAD_SIGNATURE; goto leave; } mpi_mod (r, x, skey->E.n); /* r = x mod n */ } while (!mpi_cmp_ui (r, 0)); mpi_mulm (dr, skey->d, r, skey->E.n); /* dr = d*r mod n */ mpi_addm (sum, hash, dr, skey->E.n); /* sum = hash + (d*r) mod n */ mpi_invm (k_1, k, skey->E.n); /* k_1 = k^(-1) mod n */ mpi_mulm (s, k_1, sum, skey->E.n); /* s = k^(-1)*(hash+(d*r)) mod n */ } while (!mpi_cmp_ui (s, 0)); if (DBG_CIPHER) }
1
libexpat
ba0f9c3b40c264b8dd392e02a7a060a8fa54f032
NOT_APPLICABLE
NOT_APPLICABLE
errorProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { return errorCode; }
0
gnutls
1ffb827e45721ef56982d0ffd5c5de52376c428e
NOT_APPLICABLE
NOT_APPLICABLE
gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session) { return session->security_parameters.kx_algorithm; }
0
libspiro
35233450c922787dad42321e359e5229ff470a1e
NOT_APPLICABLE
NOT_APPLICABLE
int main(int argc, char **argv) { double st, en; int ret; st = get_time(); #ifdef DO_CALL_TEST0 ret=test_curve(0); /* this comes with unit-test. */ #endif #ifdef DO_CALL_TEST1 ret=test_curve(1); /* do a test using "{"..."}". */ #endif #ifdef DO_CALL_TEST2 ret=test_curve(2); /* this does many iterations. */ #endif #ifdef DO_CALL_TEST3 if ( (ret=test_curve(3)==0) ) /* This curve will not converge */ ret = -1 /* error found! ret=error value */; else ret = 0; /* expected failure to converge */ #endif #ifdef DO_CALL_TEST4 ret=test_curve(4); /* test a cyclic calculation. */ #endif #ifdef DO_CALL_TEST5 ret=test_curve(5); /* verify curve data with []. */ #endif #ifdef DO_CALL_TEST6 ret=test_curve(6); /* verify curve data with ah. */ #endif #ifdef DO_CALL_TEST7 ret=test_curve(7); /* loop stops with ah curves. */ #endif #ifdef DO_CALL_TEST8 ret=test_curve(8); /* this open curve ends in ah */ #endif #ifdef DO_CALL_TEST9 ret=test_curve(9); /* path4[] as a closed curve. */ #endif #ifdef DO_CALL_TEST10 /* TODO: see why can start using c, o, but not [. */ /* TODO: see why can start using c, o, but not a. */ ret=test_curve(10); /* start loop with ah curves. */ ret = 0; /* ignore result for now until improved. */ #endif #ifdef DO_CALL_TEST11 /* TODO: see why can start using c, o, but not [. */ /* TODO: see why can start using c, o, but not a. */ ret=test_curve(11); /* start open curve using ah. */ ret = 0; /* ignore result for now until improved. */ #endif #ifdef DO_CALL_TEST12 /* TODO: knot counts not matched for taggedspiro, */ /* therefore use !defined(DO_CALL_TEST12) for now */ ret=test_curve(12); /* do path7[] with a z ending */ #endif #ifdef DO_CALL_TEST13 ret=test_curve(13); /* start open curve using {h. */ #endif #ifdef DO_CALL_TEST14 ret=test_curve(14); /* go very big! go very tiny! */ #endif #ifdef DO_CALL_TEST15 ret=test_curve(15); /* go very big! go very tiny! */ #endif #ifdef DO_CALL_TEST16 ret=test_curve(16); /* testing arc output path4[] */ #endif #ifdef DO_CALL_TEST17 ret=test_curve(17); /* do arc closed curve outut. */ #endif #ifdef DO_CALL_TEST18 ret=test_curve(18); /* do iterative as arc output */ #endif #ifdef DO_CALL_TEST19 ret=test_curve(19); /* do lengthy output with arc */ #endif #ifdef DO_CALL_TEST20 /* test spiroreverse and verify path[] directions */ if ( (ret=test_curve(20))==0 ) if ( (ret=test_curve(21))==0 ) if ( (ret=test_curve(22))==0 ) if ( (ret=test_curve(23))==0 ) ret=test_curve(24); #endif #ifdef DO_CALL_TESTM ret=test_multi_curves(); #endif en = get_time(); printf("time %g\n", (en - st)); return ret; }
0
linux
cf01fb9985e8deb25ccf0ea54d916b8871ae0e62
NOT_APPLICABLE
NOT_APPLICABLE
static struct sp_node *sp_alloc(unsigned long start, unsigned long end, struct mempolicy *pol) { struct sp_node *n; struct mempolicy *newpol; n = kmem_cache_alloc(sn_cache, GFP_KERNEL); if (!n) return NULL; newpol = mpol_dup(pol); if (IS_ERR(newpol)) { kmem_cache_free(sn_cache, n); return NULL; } newpol->flags |= MPOL_F_SHARED; sp_node_init(n, start, end, newpol); return n; }
0
ImageMagick
97566cf2806c0a5a86e884c96831a0c3b1ec6c20
NOT_APPLICABLE
NOT_APPLICABLE
ModuleExport size_t RegisterIPLImage(void) { MagickInfo *entry; entry=SetMagickInfo("IPL"); entry->decoder=(DecodeImageHandler *) ReadIPLImage; entry->encoder=(EncodeImageHandler *) WriteIPLImage; entry->magick=(IsImageFormatHandler *) IsIPL; entry->adjoin=MagickTrue; entry->description=ConstantString("IPL Image Sequence"); entry->module=ConstantString("IPL"); entry->endian_support=MagickTrue; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }
0
Chrome
9004be20a4cfde70456579489258c3aca4ed45a4
NOT_APPLICABLE
NOT_APPLICABLE
std::string SessionStore::WriteBatch::DeleteLocalTabWithoutUpdatingTracker( int tab_node_id) { std::string storage_key = EncodeStorageKey(session_tracker_->GetLocalSessionTag(), tab_node_id); batch_->DeleteData(storage_key); return storage_key; }
0
linux
a5b2c5b2ad5853591a6cac6134cd0f599a720865
NOT_APPLICABLE
NOT_APPLICABLE
static int apparmor_path_rmdir(struct path *dir, struct dentry *dentry) { return common_perm_rm(OP_RMDIR, dir, dentry, AA_MAY_DELETE); }
0
php-src
57b997ebf99e0eb9a073e0dafd2ab100bd4a112d
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(xml_set_object) { xml_parser *parser; zval *pind, *mythis; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro/", &pind, &mythis) == FAILURE) { return; } if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) { RETURN_FALSE; } /* please leave this commented - or ask thies@thieso.net before doing it (again) */ if (!Z_ISUNDEF(parser->object)) { zval_ptr_dtor(&parser->object); } /* please leave this commented - or ask thies@thieso.net before doing it (again) */ /* #ifdef ZEND_ENGINE_2 zval_add_ref(&parser->object); #endif */ ZVAL_COPY(&parser->object, mythis); RETVAL_TRUE; }
0
vim
adce965162dd89bf29ee0e5baf53652e7515762c
NOT_APPLICABLE
NOT_APPLICABLE
get_tag_details(taggy_T *tag, dict_T *retdict) { list_T *pos; fmark_T *fmark; dict_add_string(retdict, "tagname", tag->tagname); dict_add_number(retdict, "matchnr", tag->cur_match + 1); dict_add_number(retdict, "bufnr", tag->cur_fnum); if (tag->user_data) dict_add_string(retdict, "user_data", tag->user_data); if ((pos = list_alloc_id(aid_tagstack_from)) == NULL) return; dict_add_list(retdict, "from", pos); fmark = &tag->fmark; list_append_number(pos, (varnumber_T)(fmark->fnum != -1 ? fmark->fnum : 0)); list_append_number(pos, (varnumber_T)fmark->mark.lnum); list_append_number(pos, (varnumber_T)(fmark->mark.col == MAXCOL ? MAXCOL : fmark->mark.col + 1)); list_append_number(pos, (varnumber_T)fmark->mark.coladd); }
0
FFmpeg
e1182fac1afba92a4975917823a5f644bee7e6e8
NOT_APPLICABLE
NOT_APPLICABLE
void ff_clean_mpeg4_qscales(MpegEncContext *s) { int i; int8_t *const qscale_table = s->current_picture.qscale_table; ff_clean_h263_qscales(s); if (s->pict_type == AV_PICTURE_TYPE_B) { int odd = 0; /* ok, come on, this isn't funny anymore, there's more code for * handling this MPEG-4 mess than for the actual adaptive quantization */ for (i = 0; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; odd += qscale_table[mb_xy] & 1; } if (2 * odd > s->mb_num) odd = 1; else odd = 0; for (i = 0; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; if ((qscale_table[mb_xy] & 1) != odd) qscale_table[mb_xy]++; if (qscale_table[mb_xy] > 31) qscale_table[mb_xy] = 31; } for (i = 1; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; if (qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i - 1]] && (s->mb_type[mb_xy] & CANDIDATE_MB_TYPE_DIRECT)) { s->mb_type[mb_xy] |= CANDIDATE_MB_TYPE_BIDIR; } } } }
0
perl5
43b2f4ef399e2fd7240b4eeb0658686ad95f8e62
NOT_APPLICABLE
NOT_APPLICABLE
Perl_re_compile(pTHX_ SV * const pattern, U32 rx_flags) { SV *pat = pattern; /* defeat constness! */ PERL_ARGS_ASSERT_RE_COMPILE; return Perl_re_op_compile(aTHX_ &pat, 1, NULL, #ifdef PERL_IN_XSUB_RE &my_reg_engine, #else &PL_core_reg_engine, #endif NULL, NULL, rx_flags, 0); }
0
linux-2.6
f5fb09fa3392ad43fbcfc2f4580752f383ab5996
NOT_APPLICABLE
NOT_APPLICABLE
static int minix_writepage(struct page *page, struct writeback_control *wbc) { return block_write_full_page(page, minix_get_block, wbc); }
0
savannah
422214868061370aeeb0ac9cd0f021a5c350a57d
NOT_APPLICABLE
NOT_APPLICABLE
_gnutls_compressed2ciphertext (gnutls_session_t session, opaque * cipher_data, int cipher_size, gnutls_datum_t compressed, content_type_t _type, int random_pad, record_parameters_st * params) { uint8_t MAC[MAX_HASH_SIZE]; uint16_t c_length; uint8_t pad; int length, ret; uint8_t type = _type; opaque preamble[PREAMBLE_SIZE]; int preamble_size; int hash_size = _gnutls_hash_get_algo_len (params->mac_algorithm); int blocksize = gnutls_cipher_get_block_size (params->cipher_algorithm); cipher_type_t block_algo = _gnutls_cipher_is_block (params->cipher_algorithm); opaque *data_ptr; int ver = gnutls_protocol_get_version (session); /* Initialize MAC */ c_length = _gnutls_conv_uint16 (compressed.size); if (params->mac_algorithm != GNUTLS_MAC_NULL) { /* actually when the algorithm in not the NULL one */ digest_hd_st td; ret = mac_init (&td, params->mac_algorithm, params->write.mac_secret.data, params->write.mac_secret.size, ver); if (ret < 0) { gnutls_assert (); return ret; } preamble_size = make_preamble (UINT64DATA (params->write.sequence_number), type, c_length, ver, preamble); mac_hash (&td, preamble, preamble_size, ver); mac_hash (&td, compressed.data, compressed.size, ver); mac_deinit (&td, MAC, ver); } /* Calculate the encrypted length (padding etc.) */ length = calc_enc_length (session, compressed.size, hash_size, &pad, random_pad, block_algo, blocksize); if (length < 0) { gnutls_assert (); return length; } /* copy the encrypted data to cipher_data. */ if (cipher_size < length) { gnutls_assert (); return GNUTLS_E_MEMORY_ERROR; } data_ptr = cipher_data; if (block_algo == CIPHER_BLOCK && _gnutls_version_has_explicit_iv (session->security_parameters.version)) { /* copy the random IV. */ ret = _gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize); if (ret < 0) { gnutls_assert (); return ret; } data_ptr += blocksize; } memcpy (data_ptr, compressed.data, compressed.size); data_ptr += compressed.size; if (hash_size > 0) { memcpy (data_ptr, MAC, hash_size); data_ptr += hash_size; } if (block_algo == CIPHER_BLOCK && pad > 0) { memset (data_ptr, pad - 1, pad); } /* Actual encryption (inplace). */ ret = _gnutls_cipher_encrypt (&params->write.cipher_state, cipher_data, length); if (ret < 0) { gnutls_assert (); return ret; } return length; }
0
linux
bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a
NOT_APPLICABLE
NOT_APPLICABLE
xfs_attr3_leaf_toosmall( struct xfs_da_state *state, int *action) { struct xfs_attr_leafblock *leaf; struct xfs_da_state_blk *blk; struct xfs_attr3_icleaf_hdr ichdr; struct xfs_buf *bp; xfs_dablk_t blkno; int bytes; int forward; int error; int retval; int i; trace_xfs_attr_leaf_toosmall(state->args); /* * Check for the degenerate case of the block being over 50% full. * If so, it's not worth even looking to see if we might be able * to coalesce with a sibling. */ blk = &state->path.blk[ state->path.active-1 ]; leaf = blk->bp->b_addr; xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); bytes = xfs_attr3_leaf_hdr_size(leaf) + ichdr.count * sizeof(xfs_attr_leaf_entry_t) + ichdr.usedbytes; if (bytes > (state->args->geo->blksize >> 1)) { *action = 0; /* blk over 50%, don't try to join */ return 0; } /* * Check for the degenerate case of the block being empty. * If the block is empty, we'll simply delete it, no need to * coalesce it with a sibling block. We choose (arbitrarily) * to merge with the forward block unless it is NULL. */ if (ichdr.count == 0) { /* * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ forward = (ichdr.forw != 0); memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da3_path_shift(state, &state->altpath, forward, 0, &retval); if (error) return error; if (retval) { *action = 0; } else { *action = 2; } return 0; } /* * Examine each sibling block to see if we can coalesce with * at least 25% free space to spare. We need to figure out * whether to merge with the forward or the backward block. * We prefer coalescing with the lower numbered sibling so as * to shrink an attribute list over time. */ /* start with smaller blk num */ forward = ichdr.forw < ichdr.back; for (i = 0; i < 2; forward = !forward, i++) { struct xfs_attr3_icleaf_hdr ichdr2; if (forward) blkno = ichdr.forw; else blkno = ichdr.back; if (blkno == 0) continue; error = xfs_attr3_leaf_read(state->args->trans, state->args->dp, blkno, -1, &bp); if (error) return error; xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, bp->b_addr); bytes = state->args->geo->blksize - (state->args->geo->blksize >> 2) - ichdr.usedbytes - ichdr2.usedbytes - ((ichdr.count + ichdr2.count) * sizeof(xfs_attr_leaf_entry_t)) - xfs_attr3_leaf_hdr_size(leaf); xfs_trans_brelse(state->args->trans, bp); if (bytes >= 0) break; /* fits with at least 25% to spare */ } if (i >= 2) { *action = 0; return 0; } /* * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) { error = xfs_da3_path_shift(state, &state->altpath, forward, 0, &retval); } else { error = xfs_da3_path_shift(state, &state->path, forward, 0, &retval); } if (error) return error; if (retval) { *action = 0; } else { *action = 1; } return 0; }
0
ceph
4c11203122d729c832a645c9e3f5092db4963840
NOT_APPLICABLE
NOT_APPLICABLE
void ProtocolV1::read_event() { ldout(cct, 20) << __func__ << dendl; switch (state) { case START_CONNECT: CONTINUATION_RUN(CONTINUATION(send_client_banner)); break; case START_ACCEPT: CONTINUATION_RUN(CONTINUATION(send_server_banner)); break; case OPENED: CONTINUATION_RUN(CONTINUATION(wait_message)); break; case THROTTLE_MESSAGE: CONTINUATION_RUN(CONTINUATION(throttle_message)); break; case THROTTLE_BYTES: CONTINUATION_RUN(CONTINUATION(throttle_bytes)); break; case THROTTLE_DISPATCH_QUEUE: CONTINUATION_RUN(CONTINUATION(throttle_dispatch_queue)); break; default: break; } }
0
mindrot
85bdcd7c92fe7ff133bbc4e10a65c91810f88755
NOT_APPLICABLE
NOT_APPLICABLE
session_subsystem_req(Session *s) { struct stat st; u_int len; int success = 0; char *prog, *cmd; u_int i; s->subsys = packet_get_string(&len); packet_check_eom(); debug2("subsystem request for %.100s by user %s", s->subsys, s->pw->pw_name); for (i = 0; i < options.num_subsystems; i++) { if (strcmp(s->subsys, options.subsystem_name[i]) == 0) { prog = options.subsystem_command[i]; cmd = options.subsystem_args[i]; if (strcmp(INTERNAL_SFTP_NAME, prog) == 0) { s->is_subsystem = SUBSYSTEM_INT_SFTP; debug("subsystem: %s", prog); } else { if (stat(prog, &st) < 0) debug("subsystem: cannot stat %s: %s", prog, strerror(errno)); s->is_subsystem = SUBSYSTEM_EXT; debug("subsystem: exec() %s", cmd); } success = do_exec(s, cmd) == 0; break; } } if (!success) logit("subsystem request for %.100s by user %s failed, " "subsystem not found", s->subsys, s->pw->pw_name); return success; }
0
gpac
faa75edde3dfeba1e2cf6ffa48e45a50f1042096
NOT_APPLICABLE
NOT_APPLICABLE
static GF_Node *lsr_read_text(GF_LASeRCodec *lsr, u32 same_type) { u32 flag; GF_FieldInfo info; GF_Node *elt = gf_node_new(lsr->sg, TAG_SVG_text); if (same_type) { if (lsr->prev_text) { lsr_restore_base(lsr, (SVG_Element *)elt, (SVG_Element *)lsr->prev_text, (same_type==2) ? 1 : 0, 0); } else { GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[LASeR] sametext coded in bitstream but no text defined !\n")); } lsr_read_id(lsr, elt); if (same_type==2) lsr_read_fill(lsr, elt); lsr_read_coord_list(lsr, elt, TAG_SVG_ATT_text_x, "x"); lsr_read_coord_list(lsr, elt, TAG_SVG_ATT_text_y, "y"); } else { lsr_read_id(lsr, elt); lsr_read_rare_full(lsr, elt); lsr_read_fill(lsr, elt); lsr_read_stroke(lsr, elt); GF_LSR_READ_INT(lsr, flag, 1, "editable"); if (flag) { lsr->last_error = gf_node_get_attribute_by_tag(elt, TAG_SVG_ATT_editable, 1, 0, &info); *(SVG_Boolean*)info.far_ptr = flag; } lsr_read_float_list(lsr, elt, TAG_SVG_ATT_text_rotate, NULL, "rotate"); lsr_read_coord_list(lsr, elt, TAG_SVG_ATT_text_x, "x"); lsr_read_coord_list(lsr, elt, TAG_SVG_ATT_text_y, "y"); lsr_read_any_attribute(lsr, elt, 1); lsr->prev_text = (SVG_Element*)elt; } lsr_read_group_content(lsr, elt, same_type); return elt; }
0
php
c351b47ce85a3a147cfa801fa9f0149ab4160834
NOT_APPLICABLE
NOT_APPLICABLE
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC) { pcre *re = NULL; pcre_extra *extra; int coptions = 0; int soptions = 0; const char *error; int erroffset; char delimiter; char start_delimiter; char end_delimiter; char *p, *pp; char *pattern; int do_study = 0; int poptions = 0; int count = 0; unsigned const char *tables = NULL; #if HAVE_SETLOCALE char *locale; #endif pcre_cache_entry *pce; pcre_cache_entry new_entry; char *tmp = NULL; #if HAVE_SETLOCALE # if defined(PHP_WIN32) && defined(ZTS) _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); # endif locale = setlocale(LC_CTYPE, NULL); #endif /* Try to lookup the cached regex entry, and if successful, just pass back the compiled pattern, otherwise go on and compile it. */ if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) { /* * We use a quick pcre_fullinfo() check to see whether cache is corrupted, and if it * is, we flush it and compile the pattern from scratch. */ if (pcre_fullinfo(pce->re, NULL, PCRE_INFO_CAPTURECOUNT, &count) == PCRE_ERROR_BADMAGIC) { zend_hash_clean(&PCRE_G(pcre_cache)); } else { #if HAVE_SETLOCALE if (!strcmp(pce->locale, locale)) { #endif return pce; #if HAVE_SETLOCALE } #endif } } p = regex; /* Parse through the leading whitespace, and display a warning if we get to the end without encountering a delimiter. */ while (isspace((int)*(unsigned char *)p)) p++; if (*p == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, p < regex + regex_len ? "Null byte in regex" : "Empty regular expression"); return NULL; } /* Get the delimiter and display a warning if it is alphanumeric or a backslash. */ delimiter = *p++; if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') { php_error_docref(NULL TSRMLS_CC,E_WARNING, "Delimiter must not be alphanumeric or backslash"); return NULL; } start_delimiter = delimiter; if ((pp = strchr("([{< )]}> )]}>", delimiter)))
0
Singular
5f28fbf066626fa9c4a8f0e6408c0bb362fb386c
NOT_APPLICABLE
NOT_APPLICABLE
void sdb(Voice * currentVoice, const char * currLine, int len) { int bp=0; if ((len>1) && ((currentVoice->pi->trace_flag & 1) || (bp=sdb_checkline(currentVoice->pi->trace_flag))) ) { loop { char gdb[80]; char *p=(char *)currLine+len-1; while ((*p<=' ') && (p!=currLine)) { p--; len--; } if (p==currLine) return; currentVoice->pi->trace_flag&= ~1; // delete flag for "all lines" Print("(%s,%d) >>",currentVoice->filename,yylineno); fwrite(currLine,1,len,stdout); Print("<<\nbreakpoint %d (press ? for list of commands)\n",bp); p=fe_fgets_stdin(">>",gdb,80); while (*p==' ') p++; if (*p >' ') { sdb_lastcmd=*p; } Print("command:%c\n",sdb_lastcmd); switch(sdb_lastcmd) { case '?': case 'h': { PrintS( "b - print backtrace of calling stack\n" "B <proc> [<line>] - define breakpoint\n" "c - continue\n" "d - delete current breakpoint\n" "D - show all breakpoints\n" "e - edit the current procedure (current call will be aborted)\n" "h,? - display this help screen\n" "n - execute current line, break at next line\n" "p <var> - display type and value of the variable <var>\n" "q <flags> - quit debugger, set debugger flags(0,1,2)\n" " 0: stop debug, 1:continue, 2: throw an error, return to toplevel\n" "Q - quit Singular\n"); int i; for(i=0;i<7;i++) { if (sdb_lines[i] != -1) Print("breakpoint %d at line %d in %s\n", i,sdb_lines[i],sdb_files[i]); } break; } case 'd': { Print("delete break point %d\n",bp); currentVoice->pi->trace_flag &= (~Sy_bit(bp)); if (bp!=0) { sdb_lines[bp-1]=-1; } break; } case 'D': sdb_show_bp(); break; #if 0 case 'l': { extern void listall(int showproc); listall(FALSE); break; } #endif case 'n': currentVoice->pi->trace_flag|= 1; return; case 'e': { sdb_edit(currentVoice->pi); sdb_flags=2; return; } case 'p': { p=sdb_find_arg(p); EXTERN_VAR int myynest; Print("variable `%s`at level %d",p,myynest); idhdl h=ggetid(p); if (h==NULL) PrintS(" not found\n"); else { sleftv tmp; memset(&tmp,0,sizeof(tmp)); tmp.rtyp=IDHDL; tmp.data=h; Print("(type %s):\n",Tok2Cmdname(tmp.Typ())); tmp.Print(); } break; } case 'b': VoiceBackTrack(); break; case 'B': { p=sdb_find_arg(p); Print("procedure `%s` ",p); sdb_set_breakpoint(p); break; } case 'q': { p=sdb_find_arg(p); if (*p!='\0') { sdb_flags=atoi(p); Print("new sdb_flags:%d\n",sdb_flags); } return; } case 'Q': m2_end(999); case 'c': default: return; } } } }
0
linux
96b340406724d87e4621284ebac5e059d67b2194
NOT_APPLICABLE
NOT_APPLICABLE
fst_issue_cmd(struct fst_port_info *port, unsigned short cmd) { struct fst_card_info *card; unsigned short mbval; unsigned long flags; int safety; card = port->card; spin_lock_irqsave(&card->card_lock, flags); mbval = FST_RDW(card, portMailbox[port->index][0]); safety = 0; /* Wait for any previous command to complete */ while (mbval > NAK) { spin_unlock_irqrestore(&card->card_lock, flags); schedule_timeout_uninterruptible(1); spin_lock_irqsave(&card->card_lock, flags); if (++safety > 2000) { pr_err("Mailbox safety timeout\n"); break; } mbval = FST_RDW(card, portMailbox[port->index][0]); } if (safety > 0) { dbg(DBG_CMD, "Mailbox clear after %d jiffies\n", safety); } if (mbval == NAK) { dbg(DBG_CMD, "issue_cmd: previous command was NAK'd\n"); } FST_WRW(card, portMailbox[port->index][0], cmd); if (cmd == ABORTTX || cmd == STARTPORT) { port->txpos = 0; port->txipos = 0; port->start = 0; } spin_unlock_irqrestore(&card->card_lock, flags); }
0
Chrome
1948aefa8901dca0ccb993753fca00b15d2a6e25
NOT_APPLICABLE
NOT_APPLICABLE
bool HTMLAnchorElement::draggable() const { const AtomicString& value = getAttribute(draggableAttr); if (equalIgnoringCase(value, "true")) return true; if (equalIgnoringCase(value, "false")) return false; return hasAttribute(hrefAttr); }
0
linux-2.6
1e0c14f49d6b393179f423abbac47f85618d3d46
NOT_APPLICABLE
NOT_APPLICABLE
static int udpv6_destroy_sock(struct sock *sk) { lock_sock(sk); udp_v6_flush_pending_frames(sk); release_sock(sk); inet6_destroy_sock(sk); return 0; }
0
launchpad
29014da83e5fc358d6bff0f574e9ed45e61a35ac
NOT_APPLICABLE
NOT_APPLICABLE
OxideQQuickWebView::messageHandlers() { return QQmlListProperty<OxideQQuickScriptMessageHandler>( this, nullptr, OxideQQuickWebViewPrivate::messageHandler_append, OxideQQuickWebViewPrivate::messageHandler_count, OxideQQuickWebViewPrivate::messageHandler_at, OxideQQuickWebViewPrivate::messageHandler_clear); }
0
linux
355627f518978b5167256d27492fe0b343aaf2f2
NOT_APPLICABLE
NOT_APPLICABLE
static struct return_instance *find_next_ret_chain(struct return_instance *ri) { bool chained; do { chained = ri->chained; ri = ri->next; /* can't be NULL if chained */ } while (chained); return ri; }
0
ioq3
f61fe5f6a0419ef4a88d46a128052f2e8352e85d
NOT_APPLICABLE
NOT_APPLICABLE
static void S_AL_SaveLoopPos(src_t *dest, ALuint alSource) { int error; S_AL_ClearError(qfalse); qalGetSourcef(alSource, AL_SEC_OFFSET, &dest->lastTimePos); if((error = qalGetError()) != AL_NO_ERROR) { // Old OpenAL implementations don't support AL_SEC_OFFSET if(error != AL_INVALID_ENUM) { Com_Printf(S_COLOR_YELLOW "WARNING: Could not get time offset for alSource %d: %s\n", alSource, S_AL_ErrorMsg(error)); } dest->lastTimePos = -1; } else dest->lastSampleTime = Sys_Milliseconds(); }
0
libass
f4f48950788b91c6a30029cc28a240b834713ea7
NOT_APPLICABLE
NOT_APPLICABLE
wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width) { int i; GlyphInfo *cur, *s1, *e1, *s2, *s3; int last_space; int break_type; int exit; double pen_shift_x; double pen_shift_y; int cur_line; int run_offset; TextInfo *text_info = &render_priv->text_info; last_space = -1; text_info->n_lines = 1; break_type = 0; s1 = text_info->glyphs; // current line start for (i = 0; i < text_info->length; ++i) { int break_at = -1; double s_offset, len; cur = text_info->glyphs + i; s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x); len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset; if (cur->symbol == '\n') { break_type = 2; break_at = i; ass_msg(render_priv->library, MSGL_DBG2, "forced line break at %d", break_at); } else if (cur->symbol == ' ') { last_space = i; } else if (len >= max_text_width && (render_priv->state.wrap_style != 2)) { break_type = 1; break_at = last_space; if (break_at >= 0) ass_msg(render_priv->library, MSGL_DBG2, "line break at %d", break_at); } if (break_at != -1) { // need to use one more line // marking break_at+1 as start of a new line int lead = break_at + 1; // the first symbol of the new line if (text_info->n_lines >= text_info->max_lines) { // Raise maximum number of lines text_info->max_lines *= 2; text_info->lines = realloc(text_info->lines, sizeof(LineInfo) * text_info->max_lines); } if (lead < text_info->length) { text_info->glyphs[lead].linebreak = break_type; last_space = -1; s1 = text_info->glyphs + lead; text_info->n_lines++; } } } #define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y)) exit = 0; while (!exit && render_priv->state.wrap_style != 1) { exit = 1; s3 = text_info->glyphs; s1 = s2 = 0; for (i = 0; i <= text_info->length; ++i) { cur = text_info->glyphs + i; if ((i == text_info->length) || cur->linebreak) { s1 = s2; s2 = s3; s3 = cur; if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft' double l1, l2, l1_new, l2_new; GlyphInfo *w = s2; do { --w; } while ((w > s1) && (w->symbol == ' ')); while ((w > s1) && (w->symbol != ' ')) { --w; } e1 = w; while ((e1 > s1) && (e1->symbol == ' ')) { --e1; } if (w->symbol == ' ') ++w; l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) - (s1->bbox.xMin + s1->pos.x)); l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) - (s2->bbox.xMin + s2->pos.x)); l1_new = d6_to_double( (e1->bbox.xMax + e1->pos.x) - (s1->bbox.xMin + s1->pos.x)); l2_new = d6_to_double( ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) - (w->bbox.xMin + w->pos.x)); if (DIFF(l1_new, l2_new) < DIFF(l1, l2)) { if (w->linebreak || w == text_info->glyphs) text_info->n_lines--; if (w != text_info->glyphs) w->linebreak = 1; s2->linebreak = 0; exit = 0; } } } if (i == text_info->length) break; } } assert(text_info->n_lines >= 1); #undef DIFF measure_text(render_priv); trim_whitespace(render_priv); cur_line = 1; run_offset = 0; i = 0; cur = text_info->glyphs + i; while (i < text_info->length && cur->skip) cur = text_info->glyphs + ++i; pen_shift_x = d6_to_double(-cur->pos.x); pen_shift_y = 0.; for (i = 0; i < text_info->length; ++i) { cur = text_info->glyphs + i; if (cur->linebreak) { while (i < text_info->length && cur->skip && cur->symbol != '\n') cur = text_info->glyphs + ++i; double height = text_info->lines[cur_line - 1].desc + text_info->lines[cur_line].asc; text_info->lines[cur_line - 1].len = i - text_info->lines[cur_line - 1].offset; text_info->lines[cur_line].offset = i; cur_line++; run_offset++; pen_shift_x = d6_to_double(-cur->pos.x); pen_shift_y += height + render_priv->settings.line_spacing; } cur->pos.x += double_to_d6(pen_shift_x); cur->pos.y += double_to_d6(pen_shift_y); } text_info->lines[cur_line - 1].len = text_info->length - text_info->lines[cur_line - 1].offset; #if 0 // print line info for (i = 0; i < text_info->n_lines; i++) { printf("line %d offset %d length %d\n", i, text_info->lines[i].offset, text_info->lines[i].len); } #endif }
0
libgxps
b458226e162fe1ffe7acb4230c114a52ada5131b
NOT_APPLICABLE
NOT_APPLICABLE
gxps_archive_get_resources (GXPSArchive *archive) { g_return_val_if_fail (GXPS_IS_ARCHIVE (archive), NULL); if (archive->resources == NULL) archive->resources = g_object_new (GXPS_TYPE_RESOURCES, "archive", archive, NULL); return archive->resources; }
0
tinyexr
a685e3332f61cd4e59324bf3f669d36973d64270
NOT_APPLICABLE
NOT_APPLICABLE
static void cpy4(float *dst_val, const float *src_val) { unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val); const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val); dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; }
0
Chrome
25f9415f43d607d3d01f542f067e3cc471983e6b
NOT_APPLICABLE
NOT_APPLICABLE
void HTMLTextAreaElement::setNonDirtyValue(const String& value) { setValueCommon(value); m_isDirty = false; setNeedsValidityCheck(); }
0
gerbv
319a8af890e4d0a5c38e6d08f510da8eefc42537
NOT_APPLICABLE
NOT_APPLICABLE
analyze_window_size_restore(GtkWidget *win) { GVariant *var; const gint32 *xy; gsize num; if (!screen.settings) return; var = g_settings_get_value (screen.settings, "analyze-window-size"); xy = g_variant_get_fixed_array (var, &num, sizeof (*xy)); if (num == 2) gtk_window_set_default_size (GTK_WINDOW (win), xy[0], xy[1]); g_variant_unref (var); var = g_settings_get_value (screen.settings, "analyze-window-position"); xy = g_variant_get_fixed_array (var, &num, sizeof (*xy)); if (num == 2) gtk_window_move (GTK_WINDOW (win), xy[0], xy[1]); g_variant_unref (var); }
0
linux
594cc251fdd0d231d342d88b2fdff4bc42fb0690
NOT_APPLICABLE
NOT_APPLICABLE
static void reloc_cache_reset(struct reloc_cache *cache) { void *vaddr; if (cache->rq) reloc_gpu_flush(cache); if (!cache->vaddr) return; vaddr = unmask_page(cache->vaddr); if (cache->vaddr & KMAP) { if (cache->vaddr & CLFLUSH_AFTER) mb(); kunmap_atomic(vaddr); i915_gem_obj_finish_shmem_access((struct drm_i915_gem_object *)cache->node.mm); } else { wmb(); io_mapping_unmap_atomic((void __iomem *)vaddr); if (cache->node.allocated) { struct i915_ggtt *ggtt = cache_to_ggtt(cache); ggtt->vm.clear_range(&ggtt->vm, cache->node.start, cache->node.size); drm_mm_remove_node(&cache->node); } else { i915_vma_unpin((struct i915_vma *)cache->node.mm); } } cache->vaddr = 0; cache->page = -1; }
0
linux
e9da0b56fe27206b49f39805f7dcda8a89379062
NOT_APPLICABLE
NOT_APPLICABLE
static int wait_phy_eeprom_ready(struct usbnet *dev, int phy) { int i; for (i = 0; i < SR_SHARE_TIMEOUT; i++) { u8 tmp = 0; int ret; udelay(1); ret = sr_read_reg(dev, SR_EPCR, &tmp); if (ret < 0) return ret; /* ready */ if (!(tmp & EPCR_ERRE)) return 0; } netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom"); return -EIO; }
0
ImageMagick
53c1dcd34bed85181b901bfce1a2322f85a59472
NOT_APPLICABLE
NOT_APPLICABLE
static MagickBooleanType CorrectPSDOpacity(LayerInfo* layer_info, ExceptionInfo *exception) { MagickBooleanType status; ssize_t y; if (layer_info->opacity == OpaqueOpacity) return(MagickTrue); layer_info->image->matte=MagickTrue; status=MagickTrue; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ magick_threads(layer_info->image,layer_info->image,layer_info->image->rows,1) #endif for (y=0; y < (ssize_t) layer_info->image->rows; y++) { register PixelPacket *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetAuthenticPixels(layer_info->image,0,y,layer_info->image->columns,1, exception); if (q == (PixelPacket *)NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) layer_info->image->columns; x++) { q->opacity=(Quantum) (QuantumRange-(Quantum) (QuantumScale*( (QuantumRange-q->opacity)*(QuantumRange-layer_info->opacity)))); q++; } if (SyncAuthenticPixels(layer_info->image,exception) == MagickFalse) status=MagickFalse; } return(status); }
0
Chrome
c3957448cfc6e299165196a33cd954b790875fdb
CVE-2016-5170
CWE-416
bool Document::SetFocusedElement(Element* new_focused_element, const FocusParams& params) { DCHECK(!lifecycle_.InDetach()); clear_focused_element_timer_.Stop(); if (new_focused_element && (new_focused_element->GetDocument() != this)) return true; if (NodeChildRemovalTracker::IsBeingRemoved(new_focused_element)) return true; if (focused_element_ == new_focused_element) return true; bool focus_change_blocked = false; Element* old_focused_element = focused_element_; focused_element_ = nullptr; UpdateDistributionForFlatTreeTraversal(); Node* ancestor = (old_focused_element && old_focused_element->isConnected() && new_focused_element) ? FlatTreeTraversal::CommonAncestor(*old_focused_element, *new_focused_element) : nullptr; if (old_focused_element) { old_focused_element->SetFocused(false, params.type); old_focused_element->SetHasFocusWithinUpToAncestor(false, ancestor); if (GetPage() && (GetPage()->GetFocusController().IsFocused())) { old_focused_element->DispatchBlurEvent(new_focused_element, params.type, params.source_capabilities); if (focused_element_) { focus_change_blocked = true; new_focused_element = nullptr; } old_focused_element->DispatchFocusOutEvent(event_type_names::kFocusout, new_focused_element, params.source_capabilities); old_focused_element->DispatchFocusOutEvent(event_type_names::kDOMFocusOut, new_focused_element, params.source_capabilities); if (focused_element_) { focus_change_blocked = true; new_focused_element = nullptr; } } } if (new_focused_element) UpdateStyleAndLayoutTreeForNode(new_focused_element); if (new_focused_element && new_focused_element->IsFocusable()) { if (IsRootEditableElement(*new_focused_element) && !AcceptsEditingFocus(*new_focused_element)) { focus_change_blocked = true; goto SetFocusedElementDone; } focused_element_ = new_focused_element; SetSequentialFocusNavigationStartingPoint(focused_element_.Get()); if (params.type != kWebFocusTypeNone) last_focus_type_ = params.type; focused_element_->SetFocused(true, params.type); focused_element_->SetHasFocusWithinUpToAncestor(true, ancestor); if (focused_element_ != new_focused_element) { focus_change_blocked = true; goto SetFocusedElementDone; } CancelFocusAppearanceUpdate(); EnsurePaintLocationDataValidForNode(focused_element_); if (focused_element_ != new_focused_element) { focus_change_blocked = true; goto SetFocusedElementDone; } focused_element_->UpdateFocusAppearanceWithOptions( params.selection_behavior, params.options); if (GetPage() && (GetPage()->GetFocusController().IsFocused())) { focused_element_->DispatchFocusEvent(old_focused_element, params.type, params.source_capabilities); if (focused_element_ != new_focused_element) { focus_change_blocked = true; goto SetFocusedElementDone; } focused_element_->DispatchFocusInEvent(event_type_names::kFocusin, old_focused_element, params.type, params.source_capabilities); if (focused_element_ != new_focused_element) { focus_change_blocked = true; goto SetFocusedElementDone; } focused_element_->DispatchFocusInEvent(event_type_names::kDOMFocusIn, old_focused_element, params.type, params.source_capabilities); if (focused_element_ != new_focused_element) { focus_change_blocked = true; goto SetFocusedElementDone; } } } if (!focus_change_blocked && focused_element_) { if (AXObjectCache* cache = ExistingAXObjectCache()) { cache->HandleFocusedUIElementChanged(old_focused_element, new_focused_element); } } if (!focus_change_blocked && GetPage()) { GetPage()->GetChromeClient().FocusedNodeChanged(old_focused_element, focused_element_.Get()); } SetFocusedElementDone: UpdateStyleAndLayoutTree(); if (LocalFrame* frame = GetFrame()) frame->Selection().DidChangeFocus(); return !focus_change_blocked; }
1
aspell
80fa26c74279fced8d778351cff19d1d8f44fe4e
NOT_APPLICABLE
NOT_APPLICABLE
PosibErr<void> ListDump::clear() { out.printf("clear-%s\n", name); return no_err; }
0
OpenSC
c246f6f69a749d4f68626b40795a4f69168008f4
NOT_APPLICABLE
NOT_APPLICABLE
coolkey_get_attribute_data(const u8 *attr, u8 object_record_type, size_t buf_len, sc_cardctl_coolkey_attribute_t *attr_out) { /* handle the V0 objects first */ if (object_record_type == COOLKEY_V0_OBJECT) { return coolkey_v0_get_attribute_data(attr, buf_len, attr_out); } /* don't crash if we encounter some new or corrupted coolkey device */ if (object_record_type != COOLKEY_V1_OBJECT) { return SC_ERROR_NO_CARD_SUPPORT; } return coolkey_v1_get_attribute_data(attr, buf_len, attr_out); }
0
linux
415e3d3e90ce9e18727e8843ae343eda5a58fad6
NOT_APPLICABLE
NOT_APPLICABLE
struct sock *unix_get_socket(struct file *filp) { struct sock *u_sock = NULL; struct inode *inode = file_inode(filp); /* Socket ? */ if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) { struct socket *sock = SOCKET_I(inode); struct sock *s = sock->sk; /* PF_UNIX ? */ if (s && sock->ops && sock->ops->family == PF_UNIX) u_sock = s; } return u_sock; }
0
linux
853bc26a7ea39e354b9f8889ae7ad1492ffa28d2
NOT_APPLICABLE
NOT_APPLICABLE
static ssize_t o2nm_node_ipv4_address_show(struct config_item *item, char *page) { return sprintf(page, "%pI4\n", &to_o2nm_node(item)->nd_ipv4_address); }
0
file
4a284c89d6ef11aca34da65da7d673050a5ea320
CVE-2014-3538
CWE-399
string_modifier_check(struct magic_set *ms, struct magic *m) { if ((ms->flags & MAGIC_CHECK) == 0) return 0; if (m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0) { file_magwarn(ms, "'/BHhLl' modifiers are only allowed for pascal strings\n"); return -1; } switch (m->type) { case FILE_BESTRING16: case FILE_LESTRING16: if (m->str_flags != 0) { file_magwarn(ms, "no modifiers allowed for 16-bit strings\n"); return -1; } break; case FILE_STRING: case FILE_PSTRING: if ((m->str_flags & REGEX_OFFSET_START) != 0) { file_magwarn(ms, "'/%c' only allowed on regex and search\n", CHAR_REGEX_OFFSET_START); return -1; } break; case FILE_SEARCH: if (m->str_range == 0) { file_magwarn(ms, "missing range; defaulting to %d\n", STRING_DEFAULT_RANGE); m->str_range = STRING_DEFAULT_RANGE; return -1; } break; case FILE_REGEX: if ((m->str_flags & STRING_COMPACT_WHITESPACE) != 0) { file_magwarn(ms, "'/%c' not allowed on regex\n", CHAR_COMPACT_WHITESPACE); return -1; } if ((m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) != 0) { file_magwarn(ms, "'/%c' not allowed on regex\n", CHAR_COMPACT_OPTIONAL_WHITESPACE); return -1; } break; default: file_magwarn(ms, "coding error: m->type=%d\n", m->type); return -1; } return 0; }
1
lxde
56f66684592abf257c4004e6e1fff041c64a12ce
NOT_APPLICABLE
NOT_APPLICABLE
const char* menu_cache_app_get_exec( MenuCacheApp* app ) { return app->exec; }
0
openssl
1421e0c584ae9120ca1b88098f13d6d2e90b83a3
NOT_APPLICABLE
NOT_APPLICABLE
int ssl3_send_newsession_ticket(SSL *s) { if (s->state == SSL3_ST_SW_SESSION_TICKET_A) { unsigned char *p, *senc, *macstart; const unsigned char *const_p; int len, slen_full, slen; SSL_SESSION *sess; unsigned int hlen; EVP_CIPHER_CTX ctx; HMAC_CTX hctx; SSL_CTX *tctx = s->initial_ctx; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char key_name[16]; /* get session encoding length */ slen_full = i2d_SSL_SESSION(s->session, NULL); /* Some length values are 16 bits, so forget it if session is * too long */ if (slen_full > 0xFF00) return -1; senc = OPENSSL_malloc(slen_full); if (!senc) return -1; p = senc; i2d_SSL_SESSION(s->session, &p); /* create a fresh copy (not shared with other threads) to clean up */ const_p = senc; sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); if (sess == NULL) { OPENSSL_free(senc); return -1; } sess->session_id_length = 0; /* ID is irrelevant for the ticket */ slen = i2d_SSL_SESSION(sess, NULL); if (slen > slen_full) /* shouldn't ever happen */ { OPENSSL_free(senc); return -1; } p = senc; i2d_SSL_SESSION(sess, &p); SSL_SESSION_free(sess); /*- * Grow buffer if need be: the length calculation is as * follows handshake_header_length + * 4 (ticket lifetime hint) + 2 (ticket length) + * 16 (key name) + max_iv_len (iv length) + * session_length + max_enc_block_size (max encrypted session * length) + max_md_size (HMAC). */ if (!BUF_MEM_grow(s->init_buf, SSL_HM_HEADER_LENGTH(s) + 22 + EVP_MAX_IV_LENGTH + EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) return -1; p = ssl_handshake_start(s); EVP_CIPHER_CTX_init(&ctx); HMAC_CTX_init(&hctx); /* Initialize HMAC and cipher contexts. If callback present * it does all the work otherwise use generated values * from parent ctx. */ if (tctx->tlsext_ticket_key_cb) { if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, &hctx, 1) < 0) { OPENSSL_free(senc); return -1; } } else { RAND_pseudo_bytes(iv, 16); EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, tctx->tlsext_tick_aes_key, iv); HMAC_Init_ex(&hctx, tctx->tlsext_tick_hmac_key, 16, tlsext_tick_md(), NULL); memcpy(key_name, tctx->tlsext_tick_key_name, 16); } /* Ticket lifetime hint (advisory only): * We leave this unspecified for resumed session (for simplicity), * and guess that tickets for new sessions will live as long * as their sessions. */ l2n(s->hit ? 0 : s->session->timeout, p); /* Skip ticket length for now */ p += 2; /* Output key name */ macstart = p; memcpy(p, key_name, 16); p += 16; /* output IV */ memcpy(p, iv, EVP_CIPHER_CTX_iv_length(&ctx)); p += EVP_CIPHER_CTX_iv_length(&ctx); /* Encrypt session data */ EVP_EncryptUpdate(&ctx, p, &len, senc, slen); p += len; EVP_EncryptFinal(&ctx, p, &len); p += len; EVP_CIPHER_CTX_cleanup(&ctx); HMAC_Update(&hctx, macstart, p - macstart); HMAC_Final(&hctx, p, &hlen); HMAC_CTX_cleanup(&hctx); p += hlen; /* Now write out lengths: p points to end of data written */ /* Total length */ len = p - ssl_handshake_start(s); ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, len); /* Skip ticket lifetime hint */ p = ssl_handshake_start(s) + 4; s2n(len - 6, p); s->state=SSL3_ST_SW_SESSION_TICKET_B; OPENSSL_free(senc); } /* SSL3_ST_SW_SESSION_TICKET_B */ return ssl_do_write(s); }
0
Chrome
d616695bd68610e75b90d734d72d42534bf01b82
NOT_APPLICABLE
NOT_APPLICABLE
bool IDNSpoofChecker::SimilarToTopDomains(base::StringPiece16 hostname) { size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0); icu::UnicodeString host(FALSE, hostname.data(), hostname_length); if (lgc_letters_n_ascii_.span(host, 0, USET_SPAN_CONTAINED) == host.length()) diacritic_remover_->transliterate(host); extra_confusable_mapper_->transliterate(host); UErrorCode status = U_ZERO_ERROR; icu::UnicodeString skeleton; int32_t u04cf_pos; if ((u04cf_pos = host.indexOf(0x4CF)) != -1) { icu::UnicodeString host_alt(host); size_t length = host_alt.length(); char16_t* buffer = host_alt.getBuffer(-1); for (char16_t* uc = buffer + u04cf_pos ; uc < buffer + length; ++uc) { if (*uc == 0x4CF) *uc = 0x6C; // Lowercase L } host_alt.releaseBuffer(length); uspoof_getSkeletonUnicodeString(checker_, 0, host_alt, skeleton, &status); if (U_SUCCESS(status) && LookupMatchInTopDomains(skeleton)) return true; } uspoof_getSkeletonUnicodeString(checker_, 0, host, skeleton, &status); return U_SUCCESS(status) && LookupMatchInTopDomains(skeleton); }
0
libarchive
e79ef306afe332faf22e9b442a2c6b59cb175573
NOT_APPLICABLE
NOT_APPLICABLE
ppmd_alloc(void *p, size_t size) { (void)p; return malloc(size); }
0
lynx-snapshots
280a61b300a1614f6037efc0902ff7ecf17146e9
NOT_APPLICABLE
NOT_APPLICABLE
void HTML_put_string(HTStructured * me, const char *s) { HTChunk *target = NULL; #ifdef USE_PRETTYSRC char *translated_string = NULL; #endif if (s == NULL || (LYMapsOnly && me->sp[0].tag_number != HTML_OBJECT)) return; #ifdef USE_PRETTYSRC if (psrc_convert_string) { StrAllocCopy(translated_string, s); TRANSLATE_AND_UNESCAPE_ENTITIES(&translated_string, TRUE, FALSE); s = (const char *) translated_string; } #endif switch (me->sp[0].tag_number) { case HTML_COMMENT: break; /* Do Nothing */ case HTML_TITLE: target = &me->title; break; case HTML_STYLE: target = &me->style_block; break; case HTML_SCRIPT: target = &me->script; break; case HTML_PRE: /* Formatted text */ case HTML_LISTING: /* Literal text */ case HTML_XMP: case HTML_PLAINTEXT: /* * We guarantee that the style is up-to-date in begin_litteral */ HText_appendText(me->text, s); break; case HTML_OBJECT: target = &me->object; break; case HTML_TEXTAREA: target = &me->textarea; break; case HTML_SELECT: case HTML_OPTION: target = &me->option; break; case HTML_MATH: target = &me->math; break; default: /* Free format text? */ if (!me->sp->style->freeFormat) { /* * If we are within a preformatted text style not caught by the * cases above (HTML_PRE or similar may not be the last element * pushed on the style stack). - kw */ #ifdef USE_PRETTYSRC if (psrc_view) { /* * We do this so that a raw '\r' in the string will not be * interpreted as an internal request to break a line - passing * '\r' to HText_appendText is treated by it as a request to * insert a blank line - VH */ for (; *s; ++s) HTML_put_character(me, *s); } else #endif HText_appendText(me->text, s); break; } else { const char *p = s; char c; if (me->style_change) { for (; *p && ((*p == '\n') || (*p == '\r') || (*p == ' ') || (*p == '\t')); p++) ; /* Ignore leaders */ if (!*p) break; UPDATE_STYLE; } for (; *p; p++) { if (*p == 13 && p[1] != 10) { /* * Treat any '\r' which is not followed by '\n' as '\n', to * account for macintosh lineend in ALT attributes etc. - * kw */ c = '\n'; } else { c = *p; } if (me->style_change) { if ((c == '\n') || (c == ' ') || (c == '\t')) continue; /* Ignore it */ UPDATE_STYLE; } if (c == '\n') { if (!FIX_JAPANESE_SPACES) { if (me->in_word) { if (HText_getLastChar(me->text) != ' ') HText_appendCharacter(me->text, ' '); me->in_word = NO; } } } else if (c == ' ' || c == '\t') { if (HText_getLastChar(me->text) != ' ') HText_appendCharacter(me->text, ' '); } else if (c == '\r') { /* ignore */ } else { HText_appendCharacter(me->text, c); me->in_word = YES; } /* set the Last Character */ if (c == '\n' || c == '\t') { /* set it to a generic separator */ HText_setLastChar(me->text, ' '); } else if (c == '\r' && HText_getLastChar(me->text) == ' ') { /* * \r's are ignored. In order to keep collapsing spaces * correctly, we must default back to the previous * separator, if there was one. So we set LastChar to a * generic separator. */ HText_setLastChar(me->text, ' '); } else { HText_setLastChar(me->text, c); } } /* for */ } } /* end switch */ if (target != NULL) { if (target->data == s) { CTRACE((tfp, "BUG: appending chunk to itself: `%.*s'\n", target->size, target->data)); } else { HTChunkPuts(target, s); } } #ifdef USE_PRETTYSRC if (psrc_convert_string) { psrc_convert_string = FALSE; FREE(translated_string); } #endif }
0
httpd
e427c41257957b57036d5a549b260b6185d1dd73
NOT_APPLICABLE
NOT_APPLICABLE
AP_DECLARE(int) ap_should_client_block(request_rec *r) { /* First check if we have already read the request body */ if (r->read_length || (!r->read_chunked && (r->remaining <= 0))) { return 0; } return 1; }
0
squirrel
23a0620658714b996d20da3d4dd1a0dcf9b0bd98
NOT_APPLICABLE
NOT_APPLICABLE
bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr &val,bool bstatic) { SQObjectPtr temp; bool belongs_to_static_table = sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE || bstatic; if(_locked && !belongs_to_static_table) return false; //the class already has an instance so cannot be modified if(_members->Get(key,temp) && _isfield(temp)) //overrides the default value { _defaultvalues[_member_idx(temp)].val = val; return true; } if (_members->CountUsed() >= MEMBER_MAX_COUNT) { return false; } if(belongs_to_static_table) { SQInteger mmidx; if((sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE) && (mmidx = ss->GetMetaMethodIdxByName(key)) != -1) { _metamethods[mmidx] = val; } else { SQObjectPtr theval = val; if(_base && sq_type(val) == OT_CLOSURE) { theval = _closure(val)->Clone(); _closure(theval)->_base = _base; __ObjAddRef(_base); //ref for the closure } if(sq_type(temp) == OT_NULL) { bool isconstructor; SQVM::IsEqual(ss->_constructoridx, key, isconstructor); if(isconstructor) { _constructoridx = (SQInteger)_methods.size(); } SQClassMember m; m.val = theval; _members->NewSlot(key,SQObjectPtr(_make_method_idx(_methods.size()))); _methods.push_back(m); } else { _methods[_member_idx(temp)].val = theval; } } return true; } SQClassMember m; m.val = val; _members->NewSlot(key,SQObjectPtr(_make_field_idx(_defaultvalues.size()))); _defaultvalues.push_back(m); return true; }
0
Chrome
c5c6320f80159dc41dffc3cfbf0298925c7dcf1b
NOT_APPLICABLE
NOT_APPLICABLE
ExtensionFunction::ResponseAction BluetoothSocketListenFunction::Run() { DCHECK_CURRENTLY_ON(work_thread_id()); device::BluetoothAdapterFactory::GetAdapter( base::Bind(&BluetoothSocketListenFunction::OnGetAdapter, this)); return did_respond() ? AlreadyResponded() : RespondLater(); }
0
FreeRDP
9f77fc3dd2394373e1be753952b00dafa1a9b7da
NOT_APPLICABLE
NOT_APPLICABLE
BOOL msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, wStream* out) { MSUSB_PIPE_DESCRIPTOR** MsPipes; MSUSB_PIPE_DESCRIPTOR* MsPipe; UINT32 pnum = 0; if (!MsInterface) return FALSE; if (!Stream_EnsureRemainingCapacity(out, 16 + MsInterface->NumberOfPipes * 20)) return FALSE; /* Length */ Stream_Write_UINT16(out, MsInterface->Length); /* InterfaceNumber */ Stream_Write_UINT8(out, MsInterface->InterfaceNumber); /* AlternateSetting */ Stream_Write_UINT8(out, MsInterface->AlternateSetting); /* bInterfaceClass */ Stream_Write_UINT8(out, MsInterface->bInterfaceClass); /* bInterfaceSubClass */ Stream_Write_UINT8(out, MsInterface->bInterfaceSubClass); /* bInterfaceProtocol */ Stream_Write_UINT8(out, MsInterface->bInterfaceProtocol); /* Padding */ Stream_Write_UINT8(out, 0); /* InterfaceHandle */ Stream_Write_UINT32(out, MsInterface->InterfaceHandle); /* NumberOfPipes */ Stream_Write_UINT32(out, MsInterface->NumberOfPipes); /* Pipes */ MsPipes = MsInterface->MsPipes; for (pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++) { MsPipe = MsPipes[pnum]; /* MaximumPacketSize */ Stream_Write_UINT16(out, MsPipe->MaximumPacketSize); /* EndpointAddress */ Stream_Write_UINT8(out, MsPipe->bEndpointAddress); /* Interval */ Stream_Write_UINT8(out, MsPipe->bInterval); /* PipeType */ Stream_Write_UINT32(out, MsPipe->PipeType); /* PipeHandle */ Stream_Write_UINT32(out, MsPipe->PipeHandle); /* MaximumTransferSize */ Stream_Write_UINT32(out, MsPipe->MaximumTransferSize); /* PipeFlags */ Stream_Write_UINT32(out, MsPipe->PipeFlags); } return TRUE; }
0
linux
d52fc5dde171f030170a6cb78034d166b13c9445
NOT_APPLICABLE
NOT_APPLICABLE
static int cap_safe_nice(struct task_struct *p) { int is_subset; rcu_read_lock(); is_subset = cap_issubset(__task_cred(p)->cap_permitted, current_cred()->cap_permitted); rcu_read_unlock(); if (!is_subset && !capable(CAP_SYS_NICE)) return -EPERM; return 0; }
0
Chrome
d304b5ec1b16766ea2cb552a27dc14df848d6a0e
NOT_APPLICABLE
NOT_APPLICABLE
FFmpegVideoDecodeEngine::FFmpegVideoDecodeEngine() : codec_context_(NULL), event_handler_(NULL), frame_rate_numerator_(0), frame_rate_denominator_(0), pending_input_buffers_(0), pending_output_buffers_(0), output_eos_reached_(false), flush_pending_(false) { }
0
qemu
4154c7e03fa55b4cf52509a83d50d6c09d743b77
NOT_APPLICABLE
NOT_APPLICABLE
e1000e_intrmgr_fire_all_timers(E1000ECore *core) { int i; uint32_t val = e1000e_intmgr_collect_delayed_causes(core); trace_e1000e_irq_adding_delayed_causes(val, core->mac[ICR]); core->mac[ICR] |= val; if (core->itr.running) { timer_del(core->itr.timer); e1000e_intrmgr_on_throttling_timer(&core->itr); } for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) { if (core->eitr[i].running) { timer_del(core->eitr[i].timer); e1000e_intrmgr_on_msix_throttling_timer(&core->eitr[i]); } } }
0
gpac
ce01bd15f711d4575b7424b54b3a395ec64c1784
NOT_APPLICABLE
NOT_APPLICABLE
} void DumpMovieInfo(GF_ISOFile *file) { GF_InitialObjectDescriptor *iod; u32 i, brand, min, timescale, count, tag_len; const u8 *tag; u64 create, modif; char szDur[50]; DumpMetaItem(file, 1, 0, "Root Meta"); if (!gf_isom_has_movie(file)) { if (gf_isom_has_segment(file, &brand, &min)) { count = gf_isom_segment_get_fragment_count(file); fprintf(stderr, "File is a segment - %d movie fragments - Brand %s (version %d):\n", count, gf_4cc_to_str(brand), min); for (i=0; i<count; i++) { u32 j, traf_count = gf_isom_segment_get_track_fragment_count(file, i+1); for (j=0; j<traf_count; j++) { u32 ID; u64 tfdt; ID = gf_isom_segment_get_track_fragment_decode_time(file, i+1, j+1, &tfdt); fprintf(stderr, "\tFragment #%d Track ID %d - TFDT "LLU"\n", i+1, ID, tfdt); } } } else { fprintf(stderr, "File has no movie (moov) - static data container\n"); } return; } timescale = gf_isom_get_timescale(file); i=gf_isom_get_track_count(file); fprintf(stderr, "* Movie Info *\n\tTimescale %d - %d track%s\n", timescale, i, i>1 ? "s" : ""); fprintf(stderr, "\tComputed Duration %s", format_duration(gf_isom_get_duration(file), timescale, szDur)); fprintf(stderr, " - Indicated Duration %s\n", format_duration(gf_isom_get_original_duration(file), timescale, szDur)); #ifndef GPAC_DISABLE_ISOM_FRAGMENTS if (gf_isom_is_fragmented(file)) { fprintf(stderr, "\tFragmented File: yes - duration %s\n%d fragments - %d SegmentIndexes\n", format_duration(gf_isom_get_fragmented_duration(file), timescale, szDur), gf_isom_get_fragments_count(file, 0) , gf_isom_get_fragments_count(file, 1) ); } else { fprintf(stderr, "\tFragmented File: no\n"); } #endif if (gf_isom_moov_first(file)) fprintf(stderr, "\tFile suitable for progressive download (moov before mdat)\n"); if (gf_isom_get_brand_info(file, &brand, &min, &count) == GF_OK) { fprintf(stderr, "\tFile Brand %s - version %d\n\t\tCompatible brands:", gf_4cc_to_str(brand), min); for (i=0; i<count;i++) { if (gf_isom_get_alternate_brand(file, i+1, &brand)==GF_OK) fprintf(stderr, " %s", gf_4cc_to_str(brand) ); } fprintf(stderr, "\n"); } gf_isom_get_creation_time(file, &create, &modif); fprintf(stderr, "\tCreated: %s", format_date(create, szDur)); fprintf(stderr, "\tModified: %s", format_date(modif, szDur)); fprintf(stderr, "\n"); DumpMetaItem(file, 0, 0, "Moov Meta"); iod = (GF_InitialObjectDescriptor *) gf_isom_get_root_od(file); if (iod) { u32 desc_size = gf_odf_desc_size((GF_Descriptor *)iod); if (iod->tag == GF_ODF_IOD_TAG) { fprintf(stderr, "File has root IOD (%d bytes)\n", desc_size); fprintf(stderr, "Scene PL 0x%02x - Graphics PL 0x%02x - OD PL 0x%02x\n", iod->scene_profileAndLevel, iod->graphics_profileAndLevel, iod->OD_profileAndLevel); fprintf(stderr, "Visual PL: %s (0x%02x)\n", gf_m4v_get_profile_name(iod->visual_profileAndLevel), iod->visual_profileAndLevel); fprintf(stderr, "Audio PL: %s (0x%02x)\n", gf_m4a_get_profile_name(iod->audio_profileAndLevel), iod->audio_profileAndLevel); //fprintf(stderr, "inline profiles included %s\n", iod->inlineProfileFlag ? "yes" : "no"); } else { fprintf(stderr, "File has root OD (%d bytes)\n", desc_size); } if (!gf_list_count(iod->ESDescriptors)) fprintf(stderr, "No streams included in root OD\n"); gf_odf_desc_del((GF_Descriptor *) iod); } else { fprintf(stderr, "File has no MPEG4 IOD/OD\n"); } if (gf_isom_is_JPEG2000(file)) fprintf(stderr, "File is JPEG 2000\n"); count = gf_isom_get_copyright_count(file); if (count) { const char *lang, *note; fprintf(stderr, "\nCopyrights:\n"); for (i=0; i<count; i++) { gf_isom_get_copyright(file, i+1, &lang, &note); fprintf(stderr, "\t(%s) %s\n", lang, note); } } count = gf_isom_get_chapter_count(file, 0); if (count) { const char *name; u64 time; fprintf(stderr, "\nChapters:\n"); for (i=0; i<count; i++) { gf_isom_get_chapter(file, 0, i+1, &time, &name); fprintf(stderr, "\tChapter #%d - %s - \"%s\"\n", i+1, format_duration(time, 1000, szDur), name); } } if (gf_isom_apple_get_tag(file, 0, &tag, &tag_len) == GF_OK) { fprintf(stderr, "\niTunes Info:\n"); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_NAME, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tName: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ARTIST, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tArtist: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ALBUM, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tAlbum: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMMENT, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tComment: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMPOSER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tComposer: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_WRITER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tWriter: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ALBUM_ARTIST, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tAlbum Artist: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GENRE, &tag, &tag_len)==GF_OK) { if (tag[0]) { fprintf(stderr, "\tGenre: %s\n", tag); } else { fprintf(stderr, "\tGenre: %s\n", gf_id3_get_genre(((u8*)tag)[1])); } } if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMPILATION, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tCompilation: %s\n", tag[0] ? "Yes" : "No"); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GAPLESS, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tGapless album: %s\n", tag[0] ? "Yes" : "No"); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_CREATED, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tCreated: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_DISK, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tDisk: %d / %d\n", tag[3], tag[5]); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TOOL, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tEncoder Software: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ENCODER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tEncoded by: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TEMPO, &tag, &tag_len)==GF_OK) { if (tag[0]) { fprintf(stderr, "\tTempo (BPM): %s\n", tag); } else { fprintf(stderr, "\tTempo (BPM): %d\n", tag[1]); } } if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACKNUMBER, &tag, &tag_len)==GF_OK) { if (tag[0]) { fprintf(stderr, "\tTrackNumber: %s\n", tag); } else { fprintf(stderr, "\tTrackNumber: %d / %d\n", (0xff00 & (tag[2]<<8)) | (0xff & tag[3]), (0xff00 & (tag[4]<<8)) | (0xff & tag[5])); } } if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACK, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tTrack: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GROUP, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tGroup: %s\n", tag); if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COVER_ART, &tag, &tag_len)==GF_OK) { if (tag_len>>31) fprintf(stderr, "\tCover Art: PNG File\n"); else fprintf(stderr, "\tCover Art: JPEG File\n"); } } print_udta(file, 0); fprintf(stderr, "\n"); for (i=0; i<gf_isom_get_track_count(file); i++) { DumpTrackInfo(file, i+1, 0, GF_TRUE);
0
virglrenderer
0a5dff15912207b83018485f83e067474e818bab
NOT_APPLICABLE
NOT_APPLICABLE
static int vrend_decode_set_polygon_stipple(struct vrend_decode_ctx *ctx, int length) { struct pipe_poly_stipple ps; int i; if (length != VIRGL_POLYGON_STIPPLE_SIZE) return EINVAL; for (i = 0; i < 32; i++) ps.stipple[i] = get_buf_entry(ctx, VIRGL_POLYGON_STIPPLE_P0 + i); vrend_set_polygon_stipple(ctx->grctx, &ps); return 0; }
0
fbthrift
01686e15ec77ccb4d49a77d5bce3a01601e54d64
NOT_APPLICABLE
NOT_APPLICABLE
uint32_t readListBegin(TType& elemType, uint32_t& size, bool& sizeUnknown) { T_VIRTUAL_CALL(); return readListBegin_virt(elemType, size, sizeUnknown); }
0
tmate-ssh-server
1c020d1f5ca462f5b150b46a027aaa1bbe3c9596
NOT_APPLICABLE
NOT_APPLICABLE
void close_fds_except(int *fd_to_preserve, int num_fds) { int fd, i, preserve; for (fd = 0; fd < 1024; fd++) { preserve = 0; for (i = 0; i < num_fds; i++) if (fd_to_preserve[i] == fd) preserve = 1; if (!preserve) close(fd); } }
0
virglrenderer
0a5dff15912207b83018485f83e067474e818bab
NOT_APPLICABLE
NOT_APPLICABLE
static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, uint16_t length) { struct pipe_vertex_element *ve = NULL; int num_elements; int i; int ret; if (length < 1) return EINVAL; if ((length - 1) % 4) return EINVAL; num_elements = (length - 1) / 4; if (num_elements) { ve = calloc(num_elements, sizeof(struct pipe_vertex_element)); if (!ve) return ENOMEM; for (i = 0; i < num_elements; i++) { ve[i].src_offset = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_OFFSET(i)); ve[i].instance_divisor = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_INSTANCE_DIVISOR(i)); ve[i].vertex_buffer_index = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(i)); if (ve[i].vertex_buffer_index >= PIPE_MAX_ATTRIBS) return EINVAL; ve[i].src_format = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(i)); } } ret = vrend_create_vertex_elements_state(ctx->grctx, handle, num_elements, ve); FREE(ve); return ret; }
0
linux
f63c2c2032c2e3caad9add3b82cc6e91c376fd26
NOT_APPLICABLE
NOT_APPLICABLE
static int xennet_set_features(struct net_device *dev, netdev_features_t features) { if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) { netdev_info(dev, "Reducing MTU because no SG offload"); dev->mtu = ETH_DATA_LEN; } return 0; }
0
ceph
bafdfec8f974f1a3f7d404bcfd0a4cfad784937d
NOT_APPLICABLE
NOT_APPLICABLE
CtPtr ProtocolV1::replace(const AsyncConnectionRef& existing, ceph_msg_connect_reply &reply, bufferlist &authorizer_reply) { ldout(cct, 10) << __func__ << " accept replacing " << existing << dendl; connection->inject_delay(); if (existing->policy.lossy) { // disconnect from the Connection ldout(cct, 1) << __func__ << " replacing on lossy channel, failing existing" << dendl; existing->protocol->stop(); existing->dispatch_queue->queue_reset(existing.get()); } else { ceph_assert(can_write == WriteStatus::NOWRITE); existing->write_lock.lock(); ProtocolV1 *exproto = dynamic_cast<ProtocolV1 *>(existing->protocol.get()); // reset the in_seq if this is a hard reset from peer, // otherwise we respect our original connection's value if (is_reset_from_peer) { exproto->is_reset_from_peer = true; } connection->center->delete_file_event(connection->cs.fd(), EVENT_READABLE | EVENT_WRITABLE); if (existing->delay_state) { existing->delay_state->flush(); ceph_assert(!connection->delay_state); } exproto->reset_recv_state(); exproto->connect_msg.features = connect_msg.features; auto temp_cs = std::move(connection->cs); EventCenter *new_center = connection->center; Worker *new_worker = connection->worker; // avoid _stop shutdown replacing socket // queue a reset on the new connection, which we're dumping for the old stop(); connection->dispatch_queue->queue_reset(connection); ldout(messenger->cct, 1) << __func__ << " stop myself to swap existing" << dendl; exproto->can_write = WriteStatus::REPLACING; exproto->replacing = true; exproto->write_in_progress = false; existing->state_offset = 0; // avoid previous thread modify event exproto->state = NONE; existing->state = AsyncConnection::STATE_NONE; // Discard existing prefetch buffer in `recv_buf` existing->recv_start = existing->recv_end = 0; // there shouldn't exist any buffer ceph_assert(connection->recv_start == connection->recv_end); auto deactivate_existing = std::bind( [existing, new_worker, new_center, exproto, reply, authorizer_reply](ConnectedSocket &cs) mutable { // we need to delete time event in original thread { std::lock_guard<std::mutex> l(existing->lock); existing->write_lock.lock(); exproto->requeue_sent(); existing->outgoing_bl.clear(); existing->open_write = false; existing->write_lock.unlock(); if (exproto->state == NONE) { existing->shutdown_socket(); existing->cs = std::move(cs); existing->worker->references--; new_worker->references++; existing->logger = new_worker->get_perf_counter(); existing->worker = new_worker; existing->center = new_center; if (existing->delay_state) existing->delay_state->set_center(new_center); } else if (exproto->state == CLOSED) { auto back_to_close = std::bind([](ConnectedSocket &cs) mutable { cs.close(); }, std::move(cs)); new_center->submit_to(new_center->get_id(), std::move(back_to_close), true); return; } else { ceph_abort(); } } // Before changing existing->center, it may already exists some // events in existing->center's queue. Then if we mark down // `existing`, it will execute in another thread and clean up // connection. Previous event will result in segment fault auto transfer_existing = [existing, exproto, reply, authorizer_reply]() mutable { std::lock_guard<std::mutex> l(existing->lock); if (exproto->state == CLOSED) return; ceph_assert(exproto->state == NONE); // we have called shutdown_socket above ceph_assert(existing->last_tick_id == 0); // restart timer since we are going to re-build connection existing->last_connect_started = ceph::coarse_mono_clock::now(); existing->last_tick_id = existing->center->create_time_event( existing->connect_timeout_us, existing->tick_handler); existing->state = AsyncConnection::STATE_CONNECTION_ESTABLISHED; exproto->state = ACCEPTING; existing->center->create_file_event( existing->cs.fd(), EVENT_READABLE, existing->read_handler); reply.global_seq = exproto->peer_global_seq; exproto->run_continuation(exproto->send_connect_message_reply( CEPH_MSGR_TAG_RETRY_GLOBAL, reply, authorizer_reply)); }; if (existing->center->in_thread()) transfer_existing(); else existing->center->submit_to(existing->center->get_id(), std::move(transfer_existing), true); }, std::move(temp_cs)); existing->center->submit_to(existing->center->get_id(), std::move(deactivate_existing), true); existing->write_lock.unlock(); existing->lock.unlock(); return nullptr; } existing->lock.unlock(); return open(reply, authorizer_reply); }
0
libmspack
0b0ef9344255ff5acfac6b7af09198ac9c9756c8
NOT_APPLICABLE
NOT_APPLICABLE
static int lzh_read_input(struct kwajd_stream *lzh) { int read; if (lzh->input_end) { lzh->input_end += 8; lzh->inbuf[0] = 0; read = 1; } else { read = lzh->sys->read(lzh->input, &lzh->inbuf[0], KWAJ_INPUT_SIZE); if (read < 0) return MSPACK_ERR_READ; if (read == 0) { lzh->input_end = 8; lzh->inbuf[0] = 0; read = 1; } } /* update i_ptr and i_end */ lzh->i_ptr = &lzh->inbuf[0]; lzh->i_end = &lzh->inbuf[read]; return MSPACK_ERR_OK; }
0
linux
fb73974172ffaaf57a7c42f35424d9aece1a5af6
NOT_APPLICABLE
NOT_APPLICABLE
static int selinux_task_kill(struct task_struct *p, struct kernel_siginfo *info, int sig, const struct cred *cred) { u32 secid; u32 perm; if (!sig) perm = PROCESS__SIGNULL; /* null signal; existence test */ else perm = signal_to_av(sig); if (!cred) secid = current_sid(); else secid = cred_sid(cred); return avc_has_perm(&selinux_state, secid, task_sid(p), SECCLASS_PROCESS, perm, NULL); }
0
openssl
4924b37ee01f71ae19c94a8934b80eeb2f677932
NOT_APPLICABLE
NOT_APPLICABLE
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) { BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp; int ret = 0; bn_check_top(a); bn_check_top(p); BN_CTX_start(ctx); if ((b = BN_CTX_get(ctx)) == NULL) goto err; if ((c = BN_CTX_get(ctx)) == NULL) goto err; if ((u = BN_CTX_get(ctx)) == NULL) goto err; if ((v = BN_CTX_get(ctx)) == NULL) goto err; if (!BN_GF2m_mod(u, a, p)) goto err; if (BN_is_zero(u)) goto err; if (!BN_copy(v, p)) goto err; # if 0 if (!BN_one(b)) goto err; while (1) { while (!BN_is_odd(u)) { if (BN_is_zero(u)) goto err; if (!BN_rshift1(u, u)) goto err; if (BN_is_odd(b)) { if (!BN_GF2m_add(b, b, p)) goto err; } if (!BN_rshift1(b, b)) goto err; } if (BN_abs_is_word(u, 1)) break; if (BN_num_bits(u) < BN_num_bits(v)) { tmp = u; u = v; v = tmp; tmp = b; b = c; c = tmp; } if (!BN_GF2m_add(u, u, v)) goto err; if (!BN_GF2m_add(b, b, c)) goto err; } # else { int i; int ubits = BN_num_bits(u); int vbits = BN_num_bits(v); /* v is copy of p */ int top = p->top; BN_ULONG *udp, *bdp, *vdp, *cdp; bn_wexpand(u, top); udp = u->d; for (i = u->top; i < top; i++) udp[i] = 0; u->top = top; bn_wexpand(b, top); bdp = b->d; bdp[0] = 1; for (i = 1; i < top; i++) bdp[i] = 0; b->top = top; bn_wexpand(c, top); cdp = c->d; for (i = 0; i < top; i++) cdp[i] = 0; c->top = top; vdp = v->d; /* It pays off to "cache" *->d pointers, * because it allows optimizer to be more * aggressive. But we don't have to "cache" * p->d, because *p is declared 'const'... */ while (1) { while (ubits && !(udp[0] & 1)) { BN_ULONG u0, u1, b0, b1, mask; u0 = udp[0]; b0 = bdp[0]; mask = (BN_ULONG)0 - (b0 & 1); b0 ^= p->d[0] & mask; for (i = 0; i < top - 1; i++) { u1 = udp[i + 1]; udp[i] = ((u0 >> 1) | (u1 << (BN_BITS2 - 1))) & BN_MASK2; u0 = u1; b1 = bdp[i + 1] ^ (p->d[i + 1] & mask); bdp[i] = ((b0 >> 1) | (b1 << (BN_BITS2 - 1))) & BN_MASK2; b0 = b1; } udp[i] = u0 >> 1; bdp[i] = b0 >> 1; ubits--; } if (ubits <= BN_BITS2) { if (udp[0] == 0) /* poly was reducible */ goto err; if (udp[0] == 1) break; } if (ubits < vbits) { i = ubits; ubits = vbits; vbits = i; tmp = u; u = v; v = tmp; tmp = b; b = c; c = tmp; udp = vdp; vdp = v->d; bdp = cdp; cdp = c->d; } for (i = 0; i < top; i++) { udp[i] ^= vdp[i]; bdp[i] ^= cdp[i]; } if (ubits == vbits) { BN_ULONG ul; int utop = (ubits - 1) / BN_BITS2; while ((ul = udp[utop]) == 0 && utop) utop--; ubits = utop * BN_BITS2 + BN_num_bits_word(ul); } } bn_correct_top(b); } # endif if (!BN_copy(r, b)) goto err; bn_check_top(r); ret = 1; err: # ifdef BN_DEBUG /* BN_CTX_end would complain about the * expanded form */ bn_correct_top(c); bn_correct_top(u); bn_correct_top(v); # endif BN_CTX_end(ctx); return ret; }
0
mongo-c-driver
0d9a4d98bfdf4acd2c0138d4aaeb4e2e0934bd84
NOT_APPLICABLE
NOT_APPLICABLE
test_bson_build_child (void) { bson_t b; bson_t child; bson_t *b2; bson_t *child2; bson_init (&b); BSON_ASSERT (bson_append_document_begin (&b, "foo", -1, &child)); BSON_ASSERT (bson_append_utf8 (&child, "bar", -1, "baz", -1)); BSON_ASSERT (bson_append_document_end (&b, &child)); b2 = bson_new (); child2 = bson_new (); BSON_ASSERT (bson_append_utf8 (child2, "bar", -1, "baz", -1)); BSON_ASSERT (bson_append_document (b2, "foo", -1, child2)); bson_destroy (child2); BSON_ASSERT (b.len == b2->len); BSON_ASSERT_BSON_EQUAL (&b, b2); bson_destroy (&b); bson_destroy (b2); }
0
curl
6efd2fa529a189bf41736a610f6184cd8ad94b4d
NOT_APPLICABLE
NOT_APPLICABLE
int Curl_mbedtls_init(void) { return Curl_polarsslthreadlock_thread_setup(); }
0
linux
50220dead1650609206efe91f0cc116132d59b3f
NOT_APPLICABLE
NOT_APPLICABLE
static void hid_output_field(const struct hid_device *hid, struct hid_field *field, __u8 *data) { unsigned count = field->report_count; unsigned offset = field->report_offset; unsigned size = field->report_size; unsigned n; for (n = 0; n < count; n++) { if (field->logical_minimum < 0) /* signed values */ implement(hid, data, offset + n * size, size, s32ton(field->value[n], size)); else /* unsigned values */ implement(hid, data, offset + n * size, size, field->value[n]); } }
0
php-src
f6aef68089221c5ea047d4a74224ee3deead99a6?w=1
NOT_APPLICABLE
NOT_APPLICABLE
static ZIPARCHIVE_METHOD(deleteName) { struct zip *intern; zval *this = getThis(); int name_len; char *name; struct zip_stat sb; if (!this) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } if (name_len < 1) { RETURN_FALSE; } PHP_ZIP_STAT_PATH(intern, name, name_len, 0, sb); if (zip_delete(intern, sb.index)) { RETURN_FALSE; } RETURN_TRUE; }
0
qemu
103b40f51e4012b3b0ad20f615562a1806d7f49a
CVE-2011-3346
CWE-119
static void scsi_write_complete(void * opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t len; uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->bs, &r->acct); } if (ret) { if (scsi_handle_rw_error(r, -ret, SCSI_REQ_STATUS_RETRY_WRITE)) { return; } } n = r->iov.iov_len / 512; r->sector += n; r->sector_count -= n; if (r->sector_count == 0) { scsi_req_complete(&r->req, GOOD); } else { len = r->sector_count * 512; if (len > SCSI_DMA_BUF_SIZE) { len = SCSI_DMA_BUF_SIZE; } r->iov.iov_len = len; DPRINTF("Write complete tag=0x%x more=%d\n", r->req.tag, len); scsi_req_data(&r->req, len); } }
1
linux
4b2b64d5a6ebc84214755ebccd599baef7c1b798
NOT_APPLICABLE
NOT_APPLICABLE
static int setup_initrd(struct boot_params *params, unsigned long initrd_load_addr, unsigned long initrd_len) { params->hdr.ramdisk_image = initrd_load_addr & 0xffffffffUL; params->hdr.ramdisk_size = initrd_len & 0xffffffffUL; params->ext_ramdisk_image = initrd_load_addr >> 32; params->ext_ramdisk_size = initrd_len >> 32; return 0; }
0
qemu
f153b563f8cf121aebf5a2fff5f0110faf58ccb3
NOT_APPLICABLE
NOT_APPLICABLE
static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only) { /* should be the case, see cirrus_bitblt_start */ assert(s->cirrus_blt_width > 0); assert(s->cirrus_blt_height > 0); if (s->cirrus_blt_width > CIRRUS_BLTBUFSIZE) { return true; } if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch, s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) { return true; } if (dst_only) { return false; } if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch, s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) { return true; } return false; }
0
Chrome
0c14577c9905bd8161159ec7eaac810c594508d0
NOT_APPLICABLE
NOT_APPLICABLE
void OmniboxViewWin::StartDragIfNecessary(const CPoint& point) { if (initiated_drag_ || !IsDrag(click_point_[kLeft], point)) return; ui::OSExchangeData data; DWORD supported_modes = DROPEFFECT_COPY; CHARRANGE sel; GetSelection(sel); { ScopedFreeze freeze(this, GetTextObjectModel()); DefWindowProc(WM_LBUTTONUP, 0, MAKELPARAM(click_point_[kLeft].x, click_point_[kLeft].y)); SetSelectionRange(sel); } const string16 start_text(GetText()); string16 text_to_write(GetSelectedText()); GURL url; bool write_url; const bool is_all_selected = IsSelectAllForRange(sel); model()->AdjustTextForCopy(std::min(sel.cpMin, sel.cpMax), is_all_selected, &text_to_write, &url, &write_url); if (write_url) { string16 title; SkBitmap favicon; if (is_all_selected) model_->GetDataForURLExport(&url, &title, &favicon); drag_utils::SetURLAndDragImage(url, title, favicon, &data); supported_modes |= DROPEFFECT_LINK; content::RecordAction(UserMetricsAction("Omnibox_DragURL")); } else { supported_modes |= DROPEFFECT_MOVE; content::RecordAction(UserMetricsAction("Omnibox_DragString")); } data.SetString(text_to_write); scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); DWORD dropped_mode; AutoReset<bool> auto_reset_in_drag(&in_drag_, true); if (DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source, supported_modes, &dropped_mode) == DRAGDROP_S_DROP) { if ((dropped_mode == DROPEFFECT_MOVE) && (start_text == GetText())) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); SetSelectionRange(sel); ReplaceSel(L"", true); OnAfterPossibleChange(); } possible_drag_ = false; } else { CPoint cursor_location; GetCursorPos(&cursor_location); CRect client_rect; GetClientRect(&client_rect); CPoint client_origin_on_screen(client_rect.left, client_rect.top); ClientToScreen(&client_origin_on_screen); client_rect.MoveToXY(client_origin_on_screen.x, client_origin_on_screen.y); possible_drag_ = (client_rect.PtInRect(cursor_location) && ((GetKeyState(VK_LBUTTON) != 0) || (GetKeyState(VK_MBUTTON) != 0) || (GetKeyState(VK_RBUTTON) != 0))); } initiated_drag_ = true; tracking_click_[kLeft] = false; }
0
jdk17u
f8eb9abe034f7c6bea4da05a9ea42017b3f80730
NOT_APPLICABLE
NOT_APPLICABLE
InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) { const int size = InstanceKlass::size(parser.vtable_size(), parser.itable_size(), nonstatic_oop_map_size(parser.total_oop_map_count()), parser.is_interface()); const Symbol* const class_name = parser.class_name(); assert(class_name != NULL, "invariant"); ClassLoaderData* loader_data = parser.loader_data(); assert(loader_data != NULL, "invariant"); InstanceKlass* ik; // Allocation if (REF_NONE == parser.reference_type()) { if (class_name == vmSymbols::java_lang_Class()) { // mirror ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser); } else if (is_class_loader(class_name, parser)) { // class loader ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser); } else { // normal ik = new (loader_data, size, THREAD) InstanceKlass(parser, InstanceKlass::_kind_other); } } else { // reference ik = new (loader_data, size, THREAD) InstanceRefKlass(parser); } // Check for pending exception before adding to the loader data and incrementing // class count. Can get OOM here. if (HAS_PENDING_EXCEPTION) { return NULL; } return ik; }
0
linux
68faa679b8be1a74e6663c21c3a9d25d32f1c079
NOT_APPLICABLE
NOT_APPLICABLE
void chrdev_show(struct seq_file *f, off_t offset) { struct char_device_struct *cd; mutex_lock(&chrdevs_lock); for (cd = chrdevs[major_to_index(offset)]; cd; cd = cd->next) { if (cd->major == offset) seq_printf(f, "%3d %s\n", cd->major, cd->name); } mutex_unlock(&chrdevs_lock); }
0
Bento4
03d1222ab9c2ce779cdf01bdb96cdd69cbdcfeda
NOT_APPLICABLE
NOT_APPLICABLE
AP4_MpegSystemSampleEntry::AP4_MpegSystemSampleEntry( AP4_UI32 type, AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) : AP4_SampleEntry(type, size, stream, atom_factory) { }
0