idx
int64 | func
string | target
int64 |
|---|---|---|
300,780
|
static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg)
{
struct sock *sk = &tsk->sk;
u32 self = tipc_own_addr(sock_net(sk));
u32 peer_port = tsk_peer_port(tsk);
u32 orig_node, peer_node;
if (unlikely(!tipc_sk_connected(sk)))
return false;
if (unlikely(msg_origport(msg) != peer_port))
return false;
orig_node = msg_orignode(msg);
peer_node = tsk_peer_node(tsk);
if (likely(orig_node == peer_node))
return true;
if (!orig_node && peer_node == self)
return true;
if (!peer_node && orig_node == self)
return true;
return false;
}
| 0
|
446,090
|
static int atusb_read_subreg(struct atusb *lp,
unsigned int addr, unsigned int mask,
unsigned int shift)
{
int rc;
rc = atusb_read_reg(lp, addr);
rc = (rc & mask) >> shift;
return rc;
}
| 0
|
508,311
|
find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
const char *name, uint length,
const char *item_name, const char *db_name,
const char *table_name, Item **ref,
bool check_privileges, bool allow_rowid,
uint *cached_field_index_ptr,
bool register_tree_change, TABLE_LIST **actual_table)
{
Field *fld;
DBUG_ENTER("find_field_in_table_ref");
DBUG_ASSERT(table_list->alias);
DBUG_ASSERT(name);
DBUG_ASSERT(item_name);
DBUG_PRINT("enter",
("table: '%s' field name: '%s' item name: '%s' ref %p",
table_list->alias, name, item_name, ref));
/*
Check that the table and database that qualify the current field name
are the same as the table reference we are going to search for the field.
Exclude from the test below nested joins because the columns in a
nested join generally originate from different tables. Nested joins
also have no table name, except when a nested join is a merge view
or an information schema table.
We include explicitly table references with a 'field_translation' table,
because if there are views over natural joins we don't want to search
inside the view, but we want to search directly in the view columns
which are represented as a 'field_translation'.
TODO: Ensure that table_name, db_name and tables->db always points to
something !
*/
if (/* Exclude nested joins. */
(!table_list->nested_join ||
/* Include merge views and information schema tables. */
table_list->field_translation) &&
/*
Test if the field qualifiers match the table reference we plan
to search.
*/
table_name && table_name[0] &&
(my_strcasecmp(table_alias_charset, table_list->alias, table_name) ||
(db_name && db_name[0] && (!table_list->db || !table_list->db[0])) ||
(db_name && db_name[0] && table_list->db && table_list->db[0] &&
(table_list->schema_table ?
my_strcasecmp(system_charset_info, db_name, table_list->db) :
strcmp(db_name, table_list->db)))))
DBUG_RETURN(0);
*actual_table= NULL;
if (table_list->field_translation)
{
/* 'table_list' is a view or an information schema table. */
if ((fld= find_field_in_view(thd, table_list, name, length, item_name, ref,
register_tree_change)))
*actual_table= table_list;
}
else if (!table_list->nested_join)
{
/* 'table_list' is a stored table. */
DBUG_ASSERT(table_list->table);
if ((fld= find_field_in_table(thd, table_list->table, name, length,
allow_rowid,
cached_field_index_ptr)))
*actual_table= table_list;
}
else
{
/*
'table_list' is a NATURAL/USING join, or an operand of such join that
is a nested join itself.
If the field name we search for is qualified, then search for the field
in the table references used by NATURAL/USING the join.
*/
if (table_name && table_name[0])
{
List_iterator<TABLE_LIST> it(table_list->nested_join->join_list);
TABLE_LIST *table;
while ((table= it++))
{
if ((fld= find_field_in_table_ref(thd, table, name, length, item_name,
db_name, table_name, ref,
check_privileges, allow_rowid,
cached_field_index_ptr,
register_tree_change, actual_table)))
DBUG_RETURN(fld);
}
DBUG_RETURN(0);
}
/*
Non-qualified field, search directly in the result columns of the
natural join. The condition of the outer IF is true for the top-most
natural join, thus if the field is not qualified, we will search
directly the top-most NATURAL/USING join.
*/
fld= find_field_in_natural_join(thd, table_list, name, length, ref,
register_tree_change, actual_table);
}
if (fld)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Check if there are sufficient access rights to the found field. */
if (check_privileges &&
!table_list->is_derived() &&
check_column_grant_in_table_ref(thd, *actual_table, name, length))
fld= WRONG_GRANT;
else
#endif
if (thd->mark_used_columns != MARK_COLUMNS_NONE)
{
/*
Get rw_set correct for this field so that the handler
knows that this field is involved in the query and gets
retrieved/updated
*/
Field *field_to_set= NULL;
if (fld == view_ref_found)
{
if (!ref)
DBUG_RETURN(fld);
Item *it= (*ref)->real_item();
if (it->type() == Item::FIELD_ITEM)
field_to_set= ((Item_field*)it)->field;
else
{
if (thd->mark_used_columns == MARK_COLUMNS_READ)
it->walk(&Item::register_field_in_read_map, 0, 0);
else
it->walk(&Item::register_field_in_write_map, 0, 0);
}
}
else
field_to_set= fld;
if (field_to_set)
{
TABLE *table= field_to_set->table;
if (thd->mark_used_columns == MARK_COLUMNS_READ)
field_to_set->register_field_in_read_map();
else
bitmap_set_bit(table->write_set, field_to_set->field_index);
}
}
}
DBUG_RETURN(fld);
}
| 0
|
207,753
|
static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t bytes,
struct iov_iter *i)
{
struct pipe_inode_info *pipe = i->pipe;
struct pipe_buffer *buf;
unsigned int p_tail = pipe->tail;
unsigned int p_mask = pipe->ring_size - 1;
unsigned int i_head = i->head;
size_t off;
if (unlikely(bytes > i->count))
bytes = i->count;
if (unlikely(!bytes))
return 0;
if (!sanity(i))
return 0;
off = i->iov_offset;
buf = &pipe->bufs[i_head & p_mask];
if (off) {
if (offset == off && buf->page == page) {
/* merge with the last one */
buf->len += bytes;
i->iov_offset += bytes;
goto out;
}
i_head++;
buf = &pipe->bufs[i_head & p_mask];
}
if (pipe_full(i_head, p_tail, pipe->max_usage))
return 0;
buf->ops = &page_cache_pipe_buf_ops;
get_page(page);
buf->page = page;
buf->offset = offset;
buf->len = bytes;
pipe->head = i_head + 1;
i->iov_offset = offset + bytes;
i->head = i_head;
out:
i->count -= bytes;
return bytes;
}
| 1
|
273,906
|
static void handle_PASV(ctrl_t *ctrl, char *arg)
{
struct sockaddr_in data;
socklen_t len = sizeof(data);
char *msg, *p, buf[200];
int port;
if (do_PASV(ctrl, arg, (struct sockaddr *)&data, &len))
return;
/* Convert server IP address and port to comma separated list */
msg = strdup(ctrl->serveraddr);
if (!msg) {
send_msg(ctrl->sd, "426 Internal server error.\r\n");
exit(1);
}
p = msg;
while ((p = strchr(p, '.')))
*p++ = ',';
port = ntohs(data.sin_port);
snprintf(buf, sizeof(buf), "227 Entering Passive Mode (%s,%d,%d)\r\n",
msg, port / 256, port % 256);
send_msg(ctrl->sd, buf);
free(msg);
}
| 0
|
225,846
|
GF_Err emsg_box_size(GF_Box *s)
{
GF_EventMessageBox *ptr = (GF_EventMessageBox*) s;
ptr->size += 4;
if (ptr->version) {
ptr->size += 20;
} else {
ptr->size += 16;
}
ptr->size+=2; //1 NULL-terminated strings
if (ptr->scheme_id_uri) ptr->size += strlen(ptr->scheme_id_uri);
if (ptr->value) ptr->size += strlen(ptr->value);
if (ptr->message_data)
ptr->size += ptr->message_data_size;
return GF_OK;
| 0
|
473,965
|
utf16le_code_to_mbclen(OnigCodePoint code,
OnigEncoding enc ARG_UNUSED)
{
return (code > 0xffff ? 4 : 2);
}
| 0
|
513,268
|
join_read_system(JOIN_TAB *tab)
{
TABLE *table= tab->table;
int error;
if (table->status & STATUS_GARBAGE) // If first read
{
if ((error= table->file->ha_read_first_row(table->record[0],
table->s->primary_key)))
{
if (error != HA_ERR_END_OF_FILE)
return report_error(table, error);
mark_as_null_row(tab->table);
empty_record(table); // Make empty record
return -1;
}
store_record(table,record[1]);
}
else if (!table->status) // Only happens with left join
restore_record(table,record[1]); // restore old record
table->null_row=0;
return table->status ? -1 : 0;
}
| 0
|
338,096
|
bool WasmBinaryBuilder::maybeVisitSIMDReplace(Expression*& out, uint32_t code) {
SIMDReplace* curr;
switch (code) {
case BinaryConsts::I8x16ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecI8x16;
curr->index = getLaneIndex(16);
break;
case BinaryConsts::I16x8ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecI16x8;
curr->index = getLaneIndex(8);
break;
case BinaryConsts::I32x4ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecI32x4;
curr->index = getLaneIndex(4);
break;
case BinaryConsts::I64x2ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecI64x2;
curr->index = getLaneIndex(2);
break;
case BinaryConsts::F32x4ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecF32x4;
curr->index = getLaneIndex(4);
break;
case BinaryConsts::F64x2ReplaceLane:
curr = allocator.alloc<SIMDReplace>();
curr->op = ReplaceLaneVecF64x2;
curr->index = getLaneIndex(2);
break;
default:
return false;
}
curr->value = popNonVoidExpression();
curr->vec = popNonVoidExpression();
curr->finalize();
out = curr;
return true;
}
| 0
|
207,069
|
static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t nbytes)
{
char drc_name[MAX_DRC_NAME_LEN];
char *end;
int rc;
if (nbytes >= MAX_DRC_NAME_LEN)
return 0;
memcpy(drc_name, buf, nbytes);
end = strchr(drc_name, '\n');
if (!end)
end = &drc_name[nbytes];
*end = '\0';
rc = dlpar_add_slot(drc_name);
if (rc)
return rc;
return nbytes;
}
| 1
|
373,542
|
ipf_reassembled_list_remove(struct reassembled_pkt *rp)
/* OVS_REQUIRES(ipf_lock) */
{
ovs_list_remove(&rp->rp_list_node);
}
| 0
|
415,178
|
cmd_writekey (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
char *keyid;
int force = has_option (line, "--force");
unsigned char *keydata;
size_t keydatalen;
if ( IS_LOCKED (ctrl) )
return gpg_error (GPG_ERR_LOCKED);
line = skip_options (line);
if (!*line)
return set_error (GPG_ERR_ASS_PARAMETER, "no keyid given");
keyid = line;
while (*line && !spacep (line))
line++;
*line = 0;
if ((rc = open_card (ctrl, NULL)))
return rc;
if (!ctrl->app_ctx)
return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
keyid = xtrystrdup (keyid);
if (!keyid)
return out_of_core ();
/* Now get the actual keydata. */
assuan_begin_confidential (ctx);
rc = assuan_inquire (ctx, "KEYDATA", &keydata, &keydatalen, MAXLEN_KEYDATA);
assuan_end_confidential (ctx);
if (rc)
{
xfree (keyid);
return rc;
}
/* Write the key to the card. */
rc = app_writekey (ctrl->app_ctx, ctrl, keyid, force? 1:0,
pin_cb, ctx, keydata, keydatalen);
xfree (keyid);
xfree (keydata);
TEST_CARD_REMOVAL (ctrl, rc);
return rc;
}
| 0
|
377,477
|
ut64 r_coresym_cache_element_pa2va(RCoreSymCacheElement *element, ut64 pa) {
size_t i;
for (i = 0; i < element->hdr->n_segments; i++) {
RCoreSymCacheElementSegment *seg = &element->segments[i];
if (seg->size == 0) {
continue;
}
if (seg->paddr < pa && pa < seg->paddr + seg->size) {
return pa - seg->paddr + seg->vaddr;
}
}
return pa;
}
| 0
|
250,688
|
DROGON_TEST(HttpFile)
{
SUBSECTION(Save)
{
HttpFileImpl file;
file.setFileName("test_file_name");
file.setFile("test", 4);
auto out = file.save("./test_uploads_dir");
CHECK(out == 0);
CHECK(filesystem::exists("./test_uploads_dir/test_file_name"));
filesystem::remove_all("./test_uploads_dir");
}
SUBSECTION(SavePathRelativeTraversal)
{
auto uploadPath = filesystem::current_path() / "test_uploads_dir";
HttpFileImpl file;
file.setFileName("../test_malicious_file_name");
file.setFile("test", 4);
auto out = file.save(uploadPath.string());
CHECK(out == -1);
CHECK(!filesystem::exists(uploadPath / "../test_malicious_file_name"));
filesystem::remove_all(uploadPath);
filesystem::remove(uploadPath / "../test_malicious_file_name");
}
SUBSECTION(SavePathAbsoluteTraversal)
{
HttpFileImpl file;
file.setFileName("/tmp/test_malicious_file_name");
file.setFile("test", 4);
auto out = file.save("./test_uploads_dir");
CHECK(out == -1);
CHECK(!filesystem::exists("/tmp/test_malicious_file_name"));
filesystem::remove_all("test_uploads_dir");
filesystem::remove_all("/tmp/test_malicious_file_name");
}
}
| 0
|
437,375
|
divide_look_behind_alternatives(Node* node)
{
Node *head, *np, *insert_node;
AnchorNode* an = ANCHOR_(node);
int anc_type = an->type;
head = NODE_ANCHOR_BODY(an);
np = NODE_CAR(head);
swap_node(node, head);
NODE_CAR(node) = head;
NODE_BODY(head) = np;
np = node;
while (IS_NOT_NULL(np = NODE_CDR(np))) {
insert_node = onig_node_new_anchor(anc_type, an->ascii_mode);
CHECK_NULL_RETURN_MEMERR(insert_node);
NODE_BODY(insert_node) = NODE_CAR(np);
NODE_CAR(np) = insert_node;
}
if (anc_type == ANCHOR_LOOK_BEHIND_NOT) {
np = node;
do {
NODE_SET_TYPE(np, NODE_LIST); /* alt -> list */
} while (IS_NOT_NULL(np = NODE_CDR(np)));
}
return 0;
}
| 0
|
226,073
|
GF_Err trgr_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem)
{
GF_TrackGroupBox *ptr = (GF_TrackGroupBox *)s;
BOX_FIELD_LIST_ASSIGN(groups)
return gf_list_add(ptr->groups, a);
| 0
|
293,534
|
PJ_DEF(void) pj_cis_del_range( pj_cis_t *cis, int cstart, int cend)
{
while (cstart != cend) {
PJ_CIS_CLR(cis, cstart);
cstart++;
}
}
| 0
|
374,035
|
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadaddr, Sdb *sdb) {
#if 0
SYMBOLS HEADER
0 MAGIC 02ff01ff
4 VERSION 1 (little endian)
8 ffffffff
16 002b0000 01000000 { 0x2b00, 0x0000 }
24 UUID 16 bytes
40 2621 d85b 2100 2000 0000 0000 0000 0000
56 ffff ffff ffff ff7f 0c00 0000 0900 0000
72 0400 0000 6800 0000 2f76 6172 2f66 6f6c .... 4, 104 /// 104 length string
184
0x000000b8 5f5f 5445 5854 0000 0000 0000 0000 0000 0000 0000 0000 0000 0080 0000 0000 0000 __TEXT..........................
0x000000d8 5f5f 4441 5441 0000 0000 0000 0000 0000 0080 0000 0000 0000 0040 0000 0000 0000 __DATA...................@......
0x000000f8 5f5f 4c4c 564d 0000 0000 0000 0000 0000 00c0 0000 0000 0000 0000 0100 0000 0000 __LLVM..........................
0x00000118 5f5f 4c49 4e4b 4544 4954 0000 0000 0000 00c0 0100 0000 0000 00c0 0000 0000 0000 __LINKEDIT......................
#endif
// 0 - magic check, version ...
SymbolsHeader sh = parseHeader (buf);
if (!sh.valid) {
eprintf ("Invalid headers\n");
return false;
}
SymbolsMetadata sm = parseMetadata (buf, 0x40);
char * file_name = NULL;
if (sm.namelen) {
file_name = calloc (sm.namelen + 1, 1);
if (!file_name) {
return false;
}
if (r_buf_read_at (buf, 0x50, (ut8*)file_name, sm.namelen) != sm.namelen) {
return false;
}
}
RCoreSymCacheElement *element = parseDragons (bf, buf, sm.addr + sm.size, sm.bits, file_name);
if (element) {
*bin_obj = element;
return true;
}
free (file_name);
return false;
}
| 0
|
230,460
|
na_input(void)
{
uint8_t is_llchange;
uint8_t is_router;
uint8_t is_solicited;
uint8_t is_override;
uip_lladdr_t lladdr_aligned;
LOG_INFO("Received NA from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO_(" with target address ");
LOG_INFO_6ADDR((uip_ipaddr_t *) (&UIP_ND6_NA_BUF->tgtipaddr));
LOG_INFO_("\n");
UIP_STAT(++uip_stat.nd6.recv);
/*
* booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20
* but it works. Be careful though, do not use tests such as is_router == 1
*/
is_llchange = 0;
is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
is_solicited =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED));
is_override =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE));
#if UIP_CONF_IPV6_CHECKS
if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) ||
(UIP_ICMP_BUF->icode != 0) ||
(uip_is_addr_mcast(&UIP_ND6_NA_BUF->tgtipaddr)) ||
(is_solicited && uip_is_addr_mcast(&UIP_IP_BUF->destipaddr))) {
LOG_ERR("NA received is bad\n");
goto discard;
}
#endif /*UIP_CONF_IPV6_CHECKS */
/* Options processing: we handle TLLAO, and must ignore others */
nd6_opt_offset = UIP_ND6_NA_LEN;
nd6_opt_llao = NULL;
while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) {
#if UIP_CONF_IPV6_CHECKS
if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) {
LOG_ERR("NA received is bad\n");
goto discard;
}
#endif /*UIP_CONF_IPV6_CHECKS */
switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) {
case UIP_ND6_OPT_TLLAO:
nd6_opt_llao = (uint8_t *)ND6_OPT_HDR_BUF(nd6_opt_offset);
break;
default:
LOG_WARN("ND option not supported in NA\n");
break;
}
nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3);
}
addr = uip_ds6_addr_lookup(&UIP_ND6_NA_BUF->tgtipaddr);
/* Message processing, including TLLAO if any */
if(addr != NULL) {
#if UIP_ND6_DEF_MAXDADNS > 0
if(addr->state == ADDR_TENTATIVE) {
uip_ds6_dad_failed(addr);
}
#endif /*UIP_ND6_DEF_MAXDADNS > 0 */
LOG_ERR("NA received is bad\n");
goto discard;
} else {
const uip_lladdr_t *lladdr;
nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr);
if(nbr == NULL) {
goto discard;
}
lladdr = uip_ds6_nbr_get_ll(nbr);
if(lladdr == NULL) {
goto discard;
}
if(nd6_opt_llao != NULL) {
is_llchange =
memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], lladdr,
UIP_LLADDR_LEN) == 0 ? 0 : 1;
}
if(nbr->state == NBR_INCOMPLETE) {
if(nd6_opt_llao == NULL || !extract_lladdr_from_llao_aligned(&lladdr_aligned)) {
goto discard;
}
if(uip_ds6_nbr_update_ll(&nbr,
(const uip_lladdr_t *)&lladdr_aligned) < 0) {
/* failed to update the lladdr */
goto discard;
}
/* Note: No need to refresh the state of the nbr here.
* It has already been refreshed upon receiving the unicast IPv6 ND packet.
* See: uip_ds6_nbr_refresh_reachable_state()
*/
if(!is_solicited) {
nbr->state = NBR_STALE;
}
nbr->isrouter = is_router;
} else { /* NBR is not INCOMPLETE */
if(!is_override && is_llchange) {
if(nbr->state == NBR_REACHABLE) {
nbr->state = NBR_STALE;
}
goto discard;
} else {
/**
* If this is an cache override, or same lladdr, or no llao -
* do updates of nbr states.
*/
if(is_override || !is_llchange || nd6_opt_llao == NULL) {
if(nd6_opt_llao != NULL && is_llchange) {
if(!extract_lladdr_from_llao_aligned(&lladdr_aligned) ||
uip_ds6_nbr_update_ll(&nbr,
(const uip_lladdr_t *)&lladdr_aligned)
< 0) {
/* failed to update the lladdr */
goto discard;
}
}
/* Note: No need to refresh the state of the nbr here.
* It has already been refreshed upon receiving the unicast IPv6 ND packet.
* See: uip_ds6_nbr_refresh_reachable_state()
*/
}
}
if(nbr->isrouter && !is_router) {
defrt = uip_ds6_defrt_lookup(&UIP_IP_BUF->srcipaddr);
if(defrt != NULL) {
uip_ds6_defrt_rm(defrt);
}
}
nbr->isrouter = is_router;
}
}
#if UIP_CONF_IPV6_QUEUE_PKT
/* The nbr is now reachable, check if we had buffered a pkt for it */
/*if(nbr->queue_buf_len != 0) {
uip_len = nbr->queue_buf_len;
memcpy(UIP_IP_BUF, nbr->queue_buf, uip_len);
nbr->queue_buf_len = 0;
return;
}*/
if(uip_packetqueue_buflen(&nbr->packethandle) != 0) {
uip_len = uip_packetqueue_buflen(&nbr->packethandle);
memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len);
uip_packetqueue_free(&nbr->packethandle);
return;
}
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
discard:
uipbuf_clear();
return;
}
| 0
|
317,228
|
static int selinux_mount(const char *dev_name,
const struct path *path,
const char *type,
unsigned long flags,
void *data)
{
const struct cred *cred = current_cred();
if (flags & MS_REMOUNT)
return superblock_has_perm(cred, path->dentry->d_sb,
FILESYSTEM__REMOUNT, NULL);
else
return path_has_perm(cred, path, FILE__MOUNTON);
}
| 0
|
462,405
|
static rsRetVal addInstance(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
instanceConf_t *inst;
DEFiRet;
CHKiRet(createInstance(&inst));
if(pNewVal == NULL || *pNewVal == '\0') {
errmsg.LogError(0, NO_ERRCODE, "imptcp: port number must be specified, listener ignored");
}
if((pNewVal == NULL) || (pNewVal == '\0')) {
inst->pszBindPort = NULL;
} else {
CHKmalloc(inst->pszBindPort = ustrdup(pNewVal));
}
if((cs.lstnIP == NULL) || (cs.lstnIP[0] == '\0')) {
inst->pszBindAddr = NULL;
} else {
CHKmalloc(inst->pszBindAddr = ustrdup(cs.lstnIP));
}
if((cs.pszBindRuleset == NULL) || (cs.pszBindRuleset[0] == '\0')) {
inst->pszBindRuleset = NULL;
} else {
CHKmalloc(inst->pszBindRuleset = ustrdup(cs.pszBindRuleset));
}
if((cs.pszInputName == NULL) || (cs.pszInputName[0] == '\0')) {
inst->pszInputName = NULL;
} else {
CHKmalloc(inst->pszInputName = ustrdup(cs.pszInputName));
}
inst->pBindRuleset = NULL;
inst->bSuppOctetFram = cs.bSuppOctetFram;
inst->bKeepAlive = cs.bKeepAlive;
inst->iKeepAliveIntvl = cs.iKeepAliveTime;
inst->iKeepAliveProbes = cs.iKeepAliveProbes;
inst->iKeepAliveTime = cs.iKeepAliveTime;
inst->bEmitMsgOnClose = cs.bEmitMsgOnClose;
inst->iAddtlFrameDelim = cs.iAddtlFrameDelim;
finalize_it:
free(pNewVal);
RETiRet;
}
| 0
|
484,058
|
START_TEST(SecureChannel_sendSymmetricMessage_invalidParameters) {
// initialize dummy message
UA_ReadRequest dummyMessage;
UA_ReadRequest_init(&dummyMessage);
UA_DataType dummyType = UA_TYPES[UA_TYPES_READREQUEST];
UA_StatusCode retval = UA_SecureChannel_sendSymmetricMessage(NULL, 42, UA_MESSAGETYPE_MSG,
&dummyMessage, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_HEL, &dummyMessage, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_ACK, &dummyMessage, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_ERR, &dummyMessage, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_OPN, &dummyMessage, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_MSG, NULL, &dummyType);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
retval = UA_SecureChannel_sendSymmetricMessage(&testChannel, 42,
UA_MESSAGETYPE_MSG, &dummyMessage, NULL);
ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure");
} END_TEST
| 0
|
359,275
|
DEFUN (clear_bgp_external_in_prefix_filter,
clear_bgp_external_in_prefix_filter_cmd,
"clear bgp external in prefix-filter",
CLEAR_STR
BGP_STR
"Clear all external peers\n"
"Soft reconfig inbound update\n"
"Push out prefix-list ORF and do inbound soft reconfig\n")
{
return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
}
| 0
|
343,149
|
static void esp_free_tcp_sk(struct rcu_head *head)
{
struct esp_tcp_sk *esk = container_of(head, struct esp_tcp_sk, rcu);
sock_put(esk->sk);
kfree(esk);
}
| 0
|
409,416
|
report_term_error(char *error_msg, char_u *term)
{
struct builtin_term *termp;
int i;
mch_errmsg("\r\n");
if (error_msg != NULL)
{
mch_errmsg(error_msg);
mch_errmsg("\r\n");
}
mch_errmsg("'");
mch_errmsg((char *)term);
mch_errmsg(_("' not known. Available builtin terminals are:"));
mch_errmsg("\r\n");
for (termp = &(builtin_termcaps[0]); termp->bt_string != NULL; ++termp)
{
if (termp->bt_entry == (int)KS_NAME
&& STRCMP(termp->bt_string, "gui") != 0)
{
#ifdef HAVE_TGETENT
mch_errmsg(" builtin_");
#else
mch_errmsg(" ");
#endif
mch_errmsg(termp->bt_string);
mch_errmsg("\r\n");
}
}
// Output extra 'cmdheight' line breaks to avoid that the following error
// message overwrites the last terminal name.
for (i = 1; i < p_ch; ++i)
mch_errmsg("\r\n");
}
| 0
|
195,385
|
flatpak_dir_ensure_bundle_remote (FlatpakDir *self,
GFile *file,
GBytes *extra_gpg_data,
FlatpakDecomposed **out_ref,
char **out_checksum,
char **out_metadata,
gboolean *out_created_remote,
GCancellable *cancellable,
GError **error)
{
g_autoptr(FlatpakDecomposed) ref = NULL;
gboolean created_remote = FALSE;
g_autoptr(GBytes) deploy_data = NULL;
g_autoptr(GVariant) metadata = NULL;
g_autofree char *origin = NULL;
g_autofree char *fp_metadata = NULL;
g_autofree char *basename = NULL;
g_autoptr(GBytes) included_gpg_data = NULL;
GBytes *gpg_data = NULL;
g_autofree char *to_checksum = NULL;
g_autofree char *remote = NULL;
g_autofree char *collection_id = NULL;
if (!flatpak_dir_ensure_repo (self, cancellable, error))
return NULL;
metadata = flatpak_bundle_load (file, &to_checksum,
&ref,
&origin,
NULL, &fp_metadata, NULL,
&included_gpg_data,
&collection_id,
error);
if (metadata == NULL)
return NULL;
gpg_data = extra_gpg_data ? extra_gpg_data : included_gpg_data;
deploy_data = flatpak_dir_get_deploy_data (self, ref, FLATPAK_DEPLOY_VERSION_ANY, cancellable, NULL);
if (deploy_data != NULL)
{
remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data));
/* We need to import any gpg keys because otherwise the pull will fail */
if (gpg_data != NULL)
{
g_autoptr(GKeyFile) new_config = NULL;
new_config = ostree_repo_copy_config (flatpak_dir_get_repo (self));
if (!flatpak_dir_modify_remote (self, remote, new_config,
gpg_data, cancellable, error))
return NULL;
}
}
else
{
g_autofree char *id = flatpak_decomposed_dup_id (ref);
/* Add a remote for later updates */
basename = g_file_get_basename (file);
remote = flatpak_dir_create_origin_remote (self,
origin,
id,
basename,
flatpak_decomposed_get_ref (ref),
gpg_data,
collection_id,
&created_remote,
cancellable,
error);
if (remote == NULL)
return NULL;
}
if (out_created_remote)
*out_created_remote = created_remote;
if (out_ref)
*out_ref = g_steal_pointer (&ref);
if (out_checksum)
*out_checksum = g_steal_pointer (&to_checksum);
if (out_metadata)
*out_metadata = g_steal_pointer (&fp_metadata);
return g_steal_pointer (&remote);
}
| 1
|
90,821
|
std::string host() const { return host_; }
| 0
|
508,344
|
Locked_tables_list::unlock_locked_table(THD *thd, MDL_ticket *mdl_ticket)
{
/*
Ensure we are in locked table mode.
As this function is only called on error condition it's better
to check this condition here than in the caller.
*/
if (thd->locked_tables_mode != LTM_LOCK_TABLES)
return;
if (mdl_ticket)
{
/*
Under LOCK TABLES we may have several instances of table open
and locked and therefore have to remove several metadata lock
requests associated with them.
*/
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
}
if (thd->lock->table_count == 0)
unlock_locked_tables(thd);
}
| 0
|
328,869
|
R_API char *r_bin_java_resolve(RBinJavaObj *BIN_OBJ, int idx, ut8 space_bn_name_type) {
// TODO XXX FIXME add a size parameter to the str when it is passed in
RBinJavaCPTypeObj *item = NULL, *item2 = NULL;
char *class_str = NULL,
*name_str = NULL,
*desc_str = NULL,
*string_str = NULL,
*empty = "",
*cp_name = NULL,
*str = NULL;
if (BIN_OBJ && BIN_OBJ->cp_count < 1) {
// r_bin_java_new_bin(BIN_OBJ);
return NULL;
}
item = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);
if (item) {
cp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;
IFDBG eprintf ("java_resolve Resolved: (%d) %s\n", idx, cp_name);
} else {
str = malloc (512);
if (str) {
snprintf (str, 512, "(%d) INVALID CP_OBJ", idx);
}
return str;
}
if (strcmp (cp_name, "Class") == 0) {
item2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);
// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);
class_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);
if (!class_str) {
class_str = empty;
}
name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);
if (!name_str) {
name_str = empty;
}
desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);
if (!desc_str) {
desc_str = empty;
}
str = r_str_newf ("%s%s%s", name_str,
space_bn_name_type ? " " : "", desc_str);
if (class_str != empty) {
free (class_str);
}
if (name_str != empty) {
free (name_str);
}
if (desc_str != empty) {
free (desc_str);
}
} else if (!strcmp (cp_name, "MethodRef") ||
!strcmp (cp_name, "FieldRef") ||
!strcmp (cp_name, "InterfaceMethodRef")) {
/*
* The MethodRef, FieldRef, and InterfaceMethodRef structures
*/
class_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);
if (!class_str) {
class_str = empty;
}
name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);
if (!name_str) {
name_str = empty;
}
desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);
if (!desc_str) {
desc_str = empty;
}
str = r_str_newf ("%s/%s%s%s", class_str, name_str,
space_bn_name_type ? " " : "", desc_str);
if (class_str != empty) {
free (class_str);
}
if (name_str != empty) {
free (name_str);
}
if (desc_str != empty) {
free (desc_str);
}
} else if (!strcmp (cp_name, "String")) {
string_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);
str = NULL;
IFDBG eprintf ("java_resolve String got: (%d) %s\n", item->info.cp_string.string_idx, string_str);
if (!string_str) {
string_str = empty;
}
str = r_str_newf ("\"%s\"", string_str);
IFDBG eprintf ("java_resolve String return: %s\n", str);
if (string_str != empty) {
free (string_str);
}
} else if (!strcmp (cp_name, "Utf8")) {
char *tmp_str = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);
ut32 tmp_str_len = tmp_str ? strlen (tmp_str) + 4 : 0;
if (tmp_str) {
str = malloc (tmp_str_len + 4);
snprintf (str, tmp_str_len + 4, "\"%s\"", tmp_str);
}
free (tmp_str);
} else if (!strcmp (cp_name, "Long")) {
str = r_str_newf ("0x%"PFMT64x, r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0));
} else if (!strcmp (cp_name, "Double")) {
str = r_str_newf ("%f", r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0));
} else if (!strcmp (cp_name, "Integer")) {
str = r_str_newf ("0x%08x", R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0));
} else if (!strcmp (cp_name, "Float")) {
str = r_str_newf ("%f", R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0));
} else if (!strcmp (cp_name, "NameAndType")) {
name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);
if (!name_str) {
name_str = empty;
}
desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);
if (!desc_str) {
desc_str = empty;
}
str = r_str_newf ("%s%s%s", name_str, space_bn_name_type ? " " : "", desc_str);
if (name_str != empty) {
free (name_str);
}
if (desc_str != empty) {
free (desc_str);
}
} else {
str = strdup ("(null)");
}
return str;
}
| 0
|
338,058
|
bool WasmBinaryBuilder::maybeVisitSIMDTernary(Expression*& out, uint32_t code) {
SIMDTernary* curr;
switch (code) {
case BinaryConsts::V128Bitselect:
curr = allocator.alloc<SIMDTernary>();
curr->op = Bitselect;
break;
case BinaryConsts::I8x16Laneselect:
curr = allocator.alloc<SIMDTernary>();
curr->op = LaneselectI8x16;
break;
case BinaryConsts::I16x8Laneselect:
curr = allocator.alloc<SIMDTernary>();
curr->op = LaneselectI16x8;
break;
case BinaryConsts::I32x4Laneselect:
curr = allocator.alloc<SIMDTernary>();
curr->op = LaneselectI32x4;
break;
case BinaryConsts::I64x2Laneselect:
curr = allocator.alloc<SIMDTernary>();
curr->op = LaneselectI64x2;
break;
case BinaryConsts::F32x4RelaxedFma:
curr = allocator.alloc<SIMDTernary>();
curr->op = RelaxedFmaVecF32x4;
break;
case BinaryConsts::F32x4RelaxedFms:
curr = allocator.alloc<SIMDTernary>();
curr->op = RelaxedFmsVecF32x4;
break;
case BinaryConsts::F64x2RelaxedFma:
curr = allocator.alloc<SIMDTernary>();
curr->op = RelaxedFmaVecF64x2;
break;
case BinaryConsts::F64x2RelaxedFms:
curr = allocator.alloc<SIMDTernary>();
curr->op = RelaxedFmsVecF64x2;
break;
default:
return false;
}
curr->c = popNonVoidExpression();
curr->b = popNonVoidExpression();
curr->a = popNonVoidExpression();
curr->finalize();
out = curr;
return true;
}
| 0
|
319,418
|
ModuleExport size_t RegisterCINImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("CIN");
entry->decoder=(DecodeImageHandler *) ReadCINImage;
entry->encoder=(EncodeImageHandler *) WriteCINImage;
entry->magick=(IsImageFormatHandler *) IsCIN;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Cineon Image File");
entry->magick_module=ConstantString("CIN");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 0
|
477,354
|
R_API RBinJavaAttrInfo *r_bin_java_stack_map_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {
ut32 i = 0;
ut64 offset = 0;
RBinJavaStackMapFrame *stack_frame = NULL, *new_stack_frame = NULL;
if (sz < 10) {
return NULL;
}
RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);
offset += 6;
IFDBG eprintf("r_bin_java_stack_map_table_attr_new: New stack map allocated.\n");
if (!attr) {
return NULL;
}
attr->info.stack_map_table_attr.stack_map_frame_entries = r_list_newf (r_bin_java_stack_frame_free);
// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);
// Current spec does not call for variable sizes.
attr->info.stack_map_table_attr.number_of_entries = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
IFDBG eprintf("r_bin_java_stack_map_table_attr_new: Processing stack map, summary is:\n");
IFDBG r_bin_java_print_stack_map_table_attr_summary(attr);
for (i = 0; i < attr->info.stack_map_table_attr.number_of_entries; i++) {
// read next stack frame
IFDBG eprintf("Reading StackMap Entry #%d @ 0x%08"PFMT64x "\n", i, buf_offset + offset);
if (stack_frame == NULL && R_BIN_JAVA_GLOBAL_BIN && R_BIN_JAVA_GLOBAL_BIN->current_code_attr) {
IFDBG eprintf("Setting an implicit frame at #%d @ 0x%08"PFMT64x "\n", i, buf_offset + offset);
stack_frame = R_BIN_JAVA_GLOBAL_BIN->current_code_attr->info.code_attr.implicit_frame;
}
IFDBG eprintf("Reading StackMap Entry #%d @ 0x%08"PFMT64x ", current stack_frame: %p\n", i, buf_offset + offset, stack_frame);
if (offset >= sz) {
r_bin_java_stack_map_table_attr_free (attr);
return NULL;
}
new_stack_frame = r_bin_java_stack_map_frame_new (buffer + offset, sz - offset, stack_frame, buf_offset + offset);
if (new_stack_frame) {
offset += new_stack_frame->size;
// append stack frame to the list
r_list_append (attr->info.stack_map_table_attr.stack_map_frame_entries, (void *) new_stack_frame);
stack_frame = new_stack_frame;
} else {
eprintf ("r_bin_java_stack_map_table_attr_new: Unable to parse the stack frame for the stack map table.\n");
r_bin_java_stack_map_table_attr_free (attr);
attr = NULL;
break;
}
}
if (attr) {
attr->size = offset;
}
return attr;
}
| 0
|
393,486
|
static SQInteger base_assert(HSQUIRRELVM v)
{
if(SQVM::IsFalse(stack_get(v,2))){
SQInteger top = sq_gettop(v);
if (top>2 && SQ_SUCCEEDED(sq_tostring(v,3))) {
const SQChar *str = 0;
if (SQ_SUCCEEDED(sq_getstring(v,-1,&str))) {
return sq_throwerror(v, str);
}
}
return sq_throwerror(v, _SC("assertion failed"));
}
return 0;
}
| 0
|
197,666
|
njs_object_iterate_reverse(njs_vm_t *vm, njs_iterator_args_t *args,
njs_iterator_handler_t handler)
{
double idx;
int64_t i, from, to, length;
njs_int_t ret;
njs_array_t *array, *keys;
njs_value_t *entry, *value, prop, character, string_obj;
const u_char *p, *end, *pos;
njs_string_prop_t string_prop;
njs_object_value_t *object;
value = args->value;
from = args->from;
to = args->to;
if (njs_is_array(value)) {
array = njs_array(value);
from += 1;
while (from-- > to) {
if (njs_slow_path(!array->object.fast_array)) {
goto process_object;
}
if (njs_fast_path(from < array->length
&& njs_is_valid(&array->start[from])))
{
ret = handler(vm, args, &array->start[from], from);
} else {
entry = njs_value_arg(&njs_value_invalid);
ret = njs_value_property_i64(vm, value, from, &prop);
if (njs_slow_path(ret != NJS_DECLINED)) {
if (ret == NJS_ERROR) {
return NJS_ERROR;
}
entry = ∝
}
ret = handler(vm, args, entry, from);
}
if (njs_slow_path(ret != NJS_OK)) {
if (ret == NJS_DONE) {
return NJS_DONE;
}
return NJS_ERROR;
}
}
return NJS_OK;
}
if (njs_is_string(value) || njs_is_object_string(value)) {
if (njs_is_string(value)) {
object = njs_object_value_alloc(vm, NJS_OBJ_TYPE_STRING, 0, value);
if (njs_slow_path(object == NULL)) {
return NJS_ERROR;
}
njs_set_object_value(&string_obj, object);
args->value = &string_obj;
}
else {
value = njs_object_value(value);
}
length = njs_string_prop(&string_prop, value);
end = string_prop.start + string_prop.size;
if ((size_t) length == string_prop.size) {
/* Byte or ASCII string. */
p = string_prop.start + from;
i = from + 1;
while (i-- > to) {
/* This cannot fail. */
(void) njs_string_new(vm, &character, p, 1, 1);
ret = handler(vm, args, &character, i);
if (njs_slow_path(ret != NJS_OK)) {
if (ret == NJS_DONE) {
return NJS_DONE;
}
return NJS_ERROR;
}
p--;
}
} else {
/* UTF-8 string. */
p = njs_string_offset(string_prop.start, end, from);
p = njs_utf8_next(p, end);
i = from + 1;
while (i-- > to) {
pos = njs_utf8_prev(p);
/* This cannot fail. */
(void) njs_string_new(vm, &character, pos, p - pos , 1);
ret = handler(vm, args, &character, i);
if (njs_slow_path(ret != NJS_OK)) {
if (ret == NJS_DONE) {
return NJS_DONE;
}
return NJS_ERROR;
}
p = pos;
}
}
return NJS_OK;
}
if (!njs_is_object(value)) {
return NJS_OK;
}
process_object:
if (!njs_fast_object(from - to)) {
keys = njs_array_indices(vm, value);
if (njs_slow_path(keys == NULL)) {
return NJS_ERROR;
}
i = keys->length;
while (i > 0) {
idx = njs_string_to_index(&keys->start[--i]);
if (idx < to || idx > from) {
continue;
}
ret = njs_iterator_object_handler(vm, handler, args,
&keys->start[i], idx);
if (njs_slow_path(ret != NJS_OK)) {
njs_array_destroy(vm, keys);
return ret;
}
}
njs_array_destroy(vm, keys);
return NJS_OK;
}
i = from + 1;
while (i-- > to) {
ret = njs_iterator_object_handler(vm, handler, args, NULL, i);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
}
return NJS_OK;
}
| 1
|
213,370
|
g_socket_client_connected_callback (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
ConnectionAttempt *attempt = user_data;
GSocketClientAsyncConnectData *data = attempt->data;
GSList *l;
GError *error = NULL;
GProxy *proxy;
const gchar *protocol;
/* data is NULL once the task is completed */
if (data && g_task_return_error_if_cancelled (data->task))
{
g_object_unref (data->task);
connection_attempt_unref (attempt);
return;
}
if (attempt->timeout_source)
{
g_source_destroy (attempt->timeout_source);
g_clear_pointer (&attempt->timeout_source, g_source_unref);
}
if (!g_socket_connection_connect_finish (G_SOCKET_CONNECTION (source),
result, &error))
{
if (!g_cancellable_is_cancelled (attempt->cancellable))
{
clarify_connect_error (error, data->connectable, attempt->address);
set_last_error (data, error);
}
else
g_clear_error (&error);
if (data)
{
connection_attempt_remove (attempt);
enumerator_next_async (data);
}
else
connection_attempt_unref (attempt);
return;
}
data->socket = g_steal_pointer (&attempt->socket);
data->connection = g_steal_pointer (&attempt->connection);
for (l = data->connection_attempts; l; l = g_slist_next (l))
{
ConnectionAttempt *attempt_entry = l->data;
g_cancellable_cancel (attempt_entry->cancellable);
attempt_entry->data = NULL;
connection_attempt_unref (attempt_entry);
}
g_slist_free (data->connection_attempts);
data->connection_attempts = NULL;
connection_attempt_unref (attempt);
g_socket_connection_set_cached_remote_address ((GSocketConnection*)data->connection, NULL);
g_socket_client_emit_event (data->client, G_SOCKET_CLIENT_CONNECTED, data->connectable, data->connection);
/* wrong, but backward compatible */
g_socket_set_blocking (data->socket, TRUE);
if (!data->proxy_addr)
{
g_socket_client_tls_handshake (data);
return;
}
protocol = g_proxy_address_get_protocol (data->proxy_addr);
/* The connection should not be anything other than TCP,
* but let's put a safety guard in case
*/
if (!G_IS_TCP_CONNECTION (data->connection))
{
g_critical ("Trying to proxy over non-TCP connection, this is "
"most likely a bug in GLib IO library.");
g_set_error_literal (&data->last_error,
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Proxying over a non-TCP connection is not supported."));
enumerator_next_async (data);
}
else if (g_hash_table_contains (data->client->priv->app_proxies, protocol))
{
/* Simply complete the connection, we don't want to do TLS handshake
* as the application proxy handling may need proxy handshake first */
g_socket_client_async_connect_complete (data);
}
else if ((proxy = g_proxy_get_default_for_protocol (protocol)))
{
g_socket_client_emit_event (data->client, G_SOCKET_CLIENT_PROXY_NEGOTIATING, data->connectable, data->connection);
g_proxy_connect_async (proxy,
data->connection,
data->proxy_addr,
g_task_get_cancellable (data->task),
g_socket_client_proxy_connect_callback,
data);
g_object_unref (proxy);
}
else
{
g_clear_error (&data->last_error);
g_set_error (&data->last_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Proxy protocol “%s” is not supported."),
protocol);
enumerator_next_async (data);
}
}
| 1
|
247,691
|
TEST_P(SslSocketTest, RevokedLeafCertificateOnlyLeafCRLValidation) {
// The test checks that revoked certificate will makes the validation fails even if we set
// only_verify_leaf_cert_crl to true.
//
// Trust chain contains:
// - Root authority certificate (i.e., ca_cert.pem)
// - Intermediate authority certificate (i.e., intermediate_ca_cert.pem)
// - Intermediate authority certificate revocation list (i.e., intermediate_ca_cert.crl)
//
// Trust chain omits (But this test will succeed):
// - Root authority certificate revocation list (i.e., ca_cert.crl)
const std::string incomplete_server_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem"
validation_context:
trusted_ca:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/intermediate_ca_cert_chain_with_crl.pem"
only_verify_leaf_cert_crl: true
)EOF";
// This should fail, since the certificate has been revoked.
const std::string revoked_client_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns3_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns3_key.pem"
)EOF";
TestUtilOptions complete_revoked_test_options(revoked_client_ctx_yaml, incomplete_server_ctx_yaml,
false, GetParam());
testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error")
.setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED));
}
| 0
|
427,209
|
static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
if (fs == NULL) /* no more levels? */
init_exp(var, VVOID, 0); /* default is global */
else {
int v = searchvar(fs, n, var); /* look up locals at current level */
if (v >= 0) { /* found? */
if (v == VLOCAL && !base)
markupval(fs, var->u.var.vidx); /* local will be used as an upval */
}
else { /* not found as local at current level; try upvalues */
int idx = searchupvalue(fs, n); /* try existing upvalues */
if (idx < 0) { /* not found? */
singlevaraux(fs->prev, n, var, 0); /* try upper levels */
if (var->k == VLOCAL || var->k == VUPVAL) /* local or upvalue? */
idx = newupvalue(fs, n, var); /* will be a new upvalue */
else /* it is a global or a constant */
return; /* don't need to do anything at this level */
}
init_exp(var, VUPVAL, idx); /* new or old upvalue */
}
}
}
| 0
|
455,342
|
bind_keyseq_to_unix_command (line)
char *line;
{
Keymap kmap, cmd_xmap;
char *kseq, *value;
int i, kstart;
kmap = rl_get_keymap ();
/* We duplicate some of the work done by rl_parse_and_bind here, but
this code only has to handle `"keyseq": ["]command["]' and can
generate an error for anything else. */
i = isolate_sequence (line, 0, 1, &kstart);
if (i < 0)
return -1;
/* Create the key sequence string to pass to rl_generic_bind */
kseq = substring (line, kstart, i);
for ( ; line[i] && line[i] != ':'; i++)
;
if (line[i] != ':')
{
builtin_error (_("%s: missing colon separator"), line);
FREE (kseq);
return -1;
}
i = isolate_sequence (line, i + 1, 0, &kstart);
if (i < 0)
{
FREE (kseq);
return -1;
}
/* Create the value string containing the command to execute. */
value = substring (line, kstart, i);
/* Save the command to execute and the key sequence in the CMD_XMAP */
cmd_xmap = get_cmd_xmap_from_keymap (kmap);
rl_generic_bind (ISMACR, kseq, value, cmd_xmap);
/* and bind the key sequence in the current keymap to a function that
understands how to execute from CMD_XMAP */
rl_bind_keyseq_in_map (kseq, bash_execute_unix_command, kmap);
free (kseq);
return 0;
}
| 0
|
459,102
|
__tcf_get_next_proto(struct tcf_chain *chain, struct tcf_proto *tp)
{
u32 prio = 0;
ASSERT_RTNL();
mutex_lock(&chain->filter_chain_lock);
if (!tp) {
tp = tcf_chain_dereference(chain->filter_chain, chain);
} else if (tcf_proto_is_deleting(tp)) {
/* 'deleting' flag is set and chain->filter_chain_lock was
* unlocked, which means next pointer could be invalid. Restart
* search.
*/
prio = tp->prio + 1;
tp = tcf_chain_dereference(chain->filter_chain, chain);
for (; tp; tp = tcf_chain_dereference(tp->next, chain))
if (!tp->deleting && tp->prio >= prio)
break;
} else {
tp = tcf_chain_dereference(tp->next, chain);
}
if (tp)
tcf_proto_get(tp);
mutex_unlock(&chain->filter_chain_lock);
return tp;
}
| 0
|
369,108
|
static int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags)
{
#if defined(CONFIG_EPOLL)
struct io_epoll *ie = &req->epoll;
int ret;
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
ret = do_epoll_ctl(ie->epfd, ie->op, ie->fd, &ie->event, force_nonblock);
if (force_nonblock && ret == -EAGAIN)
return -EAGAIN;
if (ret < 0)
req_set_fail(req);
__io_req_complete(req, issue_flags, ret, 0);
return 0;
#else
return -EOPNOTSUPP;
#endif
}
| 0
|
317,095
|
static inline u32 file_mask_to_av(int mode, int mask)
{
u32 av = 0;
if (!S_ISDIR(mode)) {
if (mask & MAY_EXEC)
av |= FILE__EXECUTE;
if (mask & MAY_READ)
av |= FILE__READ;
if (mask & MAY_APPEND)
av |= FILE__APPEND;
else if (mask & MAY_WRITE)
av |= FILE__WRITE;
} else {
if (mask & MAY_EXEC)
av |= DIR__SEARCH;
if (mask & MAY_WRITE)
av |= DIR__WRITE;
if (mask & MAY_READ)
av |= DIR__READ;
}
return av;
}
| 0
|
446,114
|
atusb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
{
struct atusb *atusb = hw->priv;
int ret;
if (on) {
ret = atusb_write_subreg(atusb, SR_AACK_DIS_ACK, 1);
if (ret < 0)
return ret;
ret = atusb_write_subreg(atusb, SR_AACK_PROM_MODE, 1);
if (ret < 0)
return ret;
} else {
ret = atusb_write_subreg(atusb, SR_AACK_PROM_MODE, 0);
if (ret < 0)
return ret;
ret = atusb_write_subreg(atusb, SR_AACK_DIS_ACK, 0);
if (ret < 0)
return ret;
}
return 0;
}
| 0
|
238,814
|
save_incsearch_state(void)
{
saved_search_match_endcol = search_match_endcol;
saved_search_match_lines = search_match_lines;
}
| 0
|
261,421
|
std::string thread_task_ctb_row::name() const {
char buf[100];
sprintf(buf,"ctb-row-%d",debug_startCtbRow);
return buf;
}
| 0
|
244,013
|
GF_Err pcmC_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_PCMConfigBox *ptr = (GF_PCMConfigBox *) s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u8(bs, ptr->format_flags);
gf_bs_write_u8(bs, ptr->PCM_sample_size);
return GF_OK;
}
| 0
|
261,765
|
void RtmpProtocol::sendChunkSize(uint32_t size) {
uint32_t len = htonl(size);
std::string set_chunk((char *) &len, 4);
sendRequest(MSG_SET_CHUNK, set_chunk);
_chunk_size_out = size;
}
| 0
|
476,102
|
void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
struct usb_composite_overwrite *covr)
{
struct usb_device_descriptor *desc = &cdev->desc;
struct usb_gadget_strings *gstr = cdev->driver->strings[0];
struct usb_string *dev_str = gstr->strings;
if (covr->idVendor)
desc->idVendor = cpu_to_le16(covr->idVendor);
if (covr->idProduct)
desc->idProduct = cpu_to_le16(covr->idProduct);
if (covr->bcdDevice)
desc->bcdDevice = cpu_to_le16(covr->bcdDevice);
if (covr->serial_number) {
desc->iSerialNumber = dev_str[USB_GADGET_SERIAL_IDX].id;
dev_str[USB_GADGET_SERIAL_IDX].s = covr->serial_number;
}
if (covr->manufacturer) {
desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
} else if (!strlen(dev_str[USB_GADGET_MANUFACTURER_IDX].s)) {
desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
cdev->def_manufacturer = composite_default_mfr(cdev->gadget);
dev_str[USB_GADGET_MANUFACTURER_IDX].s = cdev->def_manufacturer;
}
if (covr->product) {
desc->iProduct = dev_str[USB_GADGET_PRODUCT_IDX].id;
dev_str[USB_GADGET_PRODUCT_IDX].s = covr->product;
}
}
| 0
|
262,035
|
ProtoValidationTypeString(const ServiceValidationResultsType t)
{
switch (t) {
case VALIDATION_RESULTS_TYPE_NAMEPASSWORD:
return VGAUTH_USERHANDLE_TYPE_NAMEPASSWORD;
case VALIDATION_RESULTS_TYPE_SSPI:
return VGAUTH_USERHANDLE_TYPE_SSPI;
case VALIDATION_RESULTS_TYPE_SAML:
return VGAUTH_USERHANDLE_TYPE_SAML;
case VALIDATION_RESULTS_TYPE_SAML_INFO_ONLY:
return VGAUTH_USERHANDLE_TYPE_SAML_INFO_ONLY;
case VALIDATION_RESULTS_TYPE_UNKNOWN:
default:
ASSERT(0);
Warning("%s: Tried to convert a validationType of %d to a string\n",
__FUNCTION__, t);
return "<UNKNOWN>";
}
}
| 0
|
463,195
|
static int annotate_dbname_mbentry(const mbentry_t *mbentry,
char **fnamep)
{
const char *conf_fname;
if (mbentry) {
/* per-mbox database */
conf_fname = mbentry_metapath(mbentry, META_ANNOTATIONS, /*isnew*/0);
if (!conf_fname)
return IMAP_MAILBOX_BADNAME;
*fnamep = xstrdup(conf_fname);
}
else {
/* global database */
conf_fname = config_getstring(IMAPOPT_ANNOTATION_DB_PATH);
if (conf_fname)
*fnamep = xstrdup(conf_fname);
else
*fnamep = strconcat(config_dir, FNAME_GLOBALANNOTATIONS, (char *)NULL);
}
return 0;
}
| 0
|
404,721
|
int __close_range(unsigned fd, unsigned max_fd, unsigned int flags)
{
struct task_struct *me = current;
struct files_struct *cur_fds = me->files, *fds = NULL;
if (flags & ~(CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC))
return -EINVAL;
if (fd > max_fd)
return -EINVAL;
if (flags & CLOSE_RANGE_UNSHARE) {
int ret;
unsigned int max_unshare_fds = NR_OPEN_MAX;
/*
* If the caller requested all fds to be made cloexec we always
* copy all of the file descriptors since they still want to
* use them.
*/
if (!(flags & CLOSE_RANGE_CLOEXEC)) {
/*
* If the requested range is greater than the current
* maximum, we're closing everything so only copy all
* file descriptors beneath the lowest file descriptor.
*/
rcu_read_lock();
if (max_fd >= last_fd(files_fdtable(cur_fds)))
max_unshare_fds = fd;
rcu_read_unlock();
}
ret = unshare_fd(CLONE_FILES, max_unshare_fds, &fds);
if (ret)
return ret;
/*
* We used to share our file descriptor table, and have now
* created a private one, make sure we're using it below.
*/
if (fds)
swap(cur_fds, fds);
}
if (flags & CLOSE_RANGE_CLOEXEC)
__range_cloexec(cur_fds, fd, max_fd);
else
__range_close(cur_fds, fd, max_fd);
if (fds) {
/*
* We're done closing the files we were supposed to. Time to install
* the new file descriptor table and drop the old one.
*/
task_lock(me);
me->files = cur_fds;
task_unlock(me);
put_files_struct(fds);
}
return 0;
}
| 0
|
310,336
|
dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result,
const char *key)
{
tor_assert(result);
if (!cached_v2_networkstatus)
cached_v2_networkstatus = digestmap_new();
if (should_generate_v2_networkstatus())
generate_v2_networkstatus_opinion();
if (!strcmp(key,"authority")) {
if (authdir_mode_v2(get_options())) {
routerinfo_t *me = router_get_my_routerinfo();
if (me)
smartlist_add(result,
tor_memdup(me->cache_info.identity_digest, DIGEST_LEN));
}
} else if (!strcmp(key, "all")) {
if (digestmap_size(cached_v2_networkstatus)) {
digestmap_iter_t *iter;
iter = digestmap_iter_init(cached_v2_networkstatus);
while (!digestmap_iter_done(iter)) {
const char *ident;
void *val;
digestmap_iter_get(iter, &ident, &val);
smartlist_add(result, tor_memdup(ident, DIGEST_LEN));
iter = digestmap_iter_next(cached_v2_networkstatus, iter);
}
} else {
SMARTLIST_FOREACH(router_get_trusted_dir_servers(),
trusted_dir_server_t *, ds,
if (ds->type & V2_AUTHORITY)
smartlist_add(result, tor_memdup(ds->digest, DIGEST_LEN)));
}
smartlist_sort_digests(result);
if (smartlist_len(result) == 0)
log_info(LD_DIRSERV,
"Client requested 'all' network status objects; we have none.");
} else if (!strcmpstart(key, "fp/")) {
dir_split_resource_into_fingerprints(key+3, result, NULL,
DSR_HEX|DSR_SORT_UNIQ);
}
}
| 0
|
297,215
|
char * exif_dump_data(int *dump_free, int format, int components, int length, int motorola_intel, char *value_ptr TSRMLS_DC) /* {{{ */
{
char *dump;
int len;
*dump_free = 0;
if (format == TAG_FMT_STRING) {
return value_ptr ? value_ptr : "<no data>";
}
if (format == TAG_FMT_UNDEFINED) {
return "<undefined>\n";
}
if (format == TAG_FMT_IFD) {
return "";
}
if (format == TAG_FMT_SINGLE || format == TAG_FMT_DOUBLE) {
return "<not implemented>";
}
*dump_free = 1;
if (components > 1) {
len = spprintf(&dump, 0, "(%d,%d) {", components, length);
} else {
len = spprintf(&dump, 0, "{");
}
while(components > 0) {
switch(format) {
case TAG_FMT_BYTE:
case TAG_FMT_UNDEFINED:
case TAG_FMT_STRING:
case TAG_FMT_SBYTE:
dump = erealloc(dump, len + 4 + 1);
snprintf(dump + len, 4 + 1, "0x%02X", *value_ptr);
len += 4;
value_ptr++;
break;
case TAG_FMT_USHORT:
case TAG_FMT_SSHORT:
dump = erealloc(dump, len + 6 + 1);
snprintf(dump + len, 6 + 1, "0x%04X", php_ifd_get16s(value_ptr, motorola_intel));
len += 6;
value_ptr += 2;
break;
case TAG_FMT_ULONG:
case TAG_FMT_SLONG:
dump = erealloc(dump, len + 6 + 1);
snprintf(dump + len, 6 + 1, "0x%04X", php_ifd_get32s(value_ptr, motorola_intel));
len += 6;
value_ptr += 4;
break;
case TAG_FMT_URATIONAL:
case TAG_FMT_SRATIONAL:
dump = erealloc(dump, len + 13 + 1);
snprintf(dump + len, 13 + 1, "0x%04X/0x%04X", php_ifd_get32s(value_ptr, motorola_intel), php_ifd_get32s(value_ptr+4, motorola_intel));
len += 13;
value_ptr += 8;
break;
}
if (components > 0) {
dump = erealloc(dump, len + 2 + 1);
snprintf(dump + len, 2 + 1, ", ");
len += 2;
components--;
} else{
break;
}
}
dump = erealloc(dump, len + 1 + 1);
snprintf(dump + len, 1 + 1, "}");
return dump;
}
| 0
|
336,542
|
SPICE_GNUC_VISIBLE void spice_server_vm_start(SpiceServer *reds)
{
reds->vm_running = TRUE;
for (auto dev: reds->char_devices) {
dev->start();
}
reds_on_vm_start(reds);
}
| 0
|
317,231
|
static int selinux_is_sblabel_mnt(struct super_block *sb)
{
struct superblock_security_struct *sbsec = selinux_superblock(sb);
/*
* IMPORTANT: Double-check logic in this function when adding a new
* SECURITY_FS_USE_* definition!
*/
BUILD_BUG_ON(SECURITY_FS_USE_MAX != 7);
switch (sbsec->behavior) {
case SECURITY_FS_USE_XATTR:
case SECURITY_FS_USE_TRANS:
case SECURITY_FS_USE_TASK:
case SECURITY_FS_USE_NATIVE:
return 1;
case SECURITY_FS_USE_GENFS:
return selinux_is_genfs_special_handling(sb);
/* Never allow relabeling on context mounts */
case SECURITY_FS_USE_MNTPOINT:
case SECURITY_FS_USE_NONE:
default:
return 0;
}
}
| 0
|
386,587
|
DL_Dxf::~DL_Dxf() {
if (vertices!=NULL) {
delete[] vertices;
}
if (knots!=NULL) {
delete[] knots;
}
if (controlPoints!=NULL) {
delete[] controlPoints;
}
if (fitPoints!=NULL) {
delete[] fitPoints;
}
if (weights!=NULL) {
delete[] weights;
}
if (leaderVertices!=NULL) {
delete[] leaderVertices;
}
}
| 0
|
436,124
|
static void io_flush_cached_locked_reqs(struct io_ring_ctx *ctx,
struct io_comp_state *cs)
{
spin_lock_irq(&ctx->completion_lock);
list_splice_init(&ctx->locked_free_list, &cs->free_list);
ctx->locked_free_nr = 0;
spin_unlock_irq(&ctx->completion_lock);
}
| 0
|
236,202
|
GF_Err text_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u16 pSize;
GF_TextSampleEntryBox *ptr = (GF_TextSampleEntryBox*)s;
ISOM_DECREASE_SIZE(ptr, 8);
e = gf_isom_base_sample_entry_read((GF_SampleEntryBox *)ptr, bs);
if (e) return e;
ptr->textJustification = 1;
//some weird text entries are not QT text nor 3gpp, cf issue #1030
if (!ptr->size) {
return GF_OK;
}
if (ptr->size < 43) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Broken text box (%d bytes but min 43 required), skiping parsing.\n", ptr->size));
return GF_OK;
}
ISOM_DECREASE_SIZE(ptr, 43);
ptr->displayFlags = gf_bs_read_u32(bs); /*Display flags*/
ptr->textJustification = gf_bs_read_u32(bs); /*Text justification*/
gf_bs_read_data(bs, ptr->background_color, 6); /*Background color*/
gpp_read_box(bs, &ptr->default_box); /*Default text box*/
gf_bs_read_data(bs, ptr->reserved1, 8); /*Reserved*/
ptr->fontNumber = gf_bs_read_u16(bs); /*Font number*/
ptr->fontFace = gf_bs_read_u16(bs); /*Font face*/
ptr->reserved2 = gf_bs_read_u8(bs); /*Reserved*/
ptr->reserved3 = gf_bs_read_u16(bs); /*Reserved*/
gf_bs_read_data(bs, ptr->foreground_color, 6); /*Foreground color*/
/*ffmpeg compatibility with iPod streams: no pascal string*/
if (!ptr->size)
return GF_OK;
ISOM_DECREASE_SIZE(ptr, 1);
pSize = gf_bs_read_u8(bs); /*a Pascal string begins with its size: get textName size*/
if (ptr->size < pSize) {
u32 b_size = pSize;
size_t i = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] text box doesn't use a Pascal string: trying to decode anyway.\n"));
ptr->textName = (char*)gf_malloc((size_t)ptr->size + 1 + 1);
if (!ptr->textName) return GF_OUT_OF_MEM;
do {
char c = (char)b_size;
if (c == '\0') {
break;
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
ptr->textName[i] = c;
} else {
gf_free(ptr->textName);
ptr->textName = NULL;
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] text box doesn't use a Pascal string and contains non-chars. Abort.\n"));
return GF_ISOM_INVALID_FILE;
}
i++;
if (!ptr->size)
break;
ptr->size--;
b_size = gf_bs_read_u8(bs);
} while (b_size);
ptr->textName[i] = '\0'; /*Font name*/
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] text box doesn't use a Pascal string: \"%s\" detected.\n", ptr->textName));
return GF_OK;
}
if (pSize) {
ptr->textName = (char*) gf_malloc(pSize+1 * sizeof(char));
if (!ptr->textName) return GF_OUT_OF_MEM;
if (gf_bs_read_data(bs, ptr->textName, pSize) != pSize) {
gf_free(ptr->textName);
ptr->textName = NULL;
return GF_ISOM_INVALID_FILE;
}
ptr->textName[pSize] = '\0'; /*Font name*/
}
ISOM_DECREASE_SIZE(ptr, pSize);
u32 next_size = gf_bs_peek_bits(bs, 32, 0);
if (next_size > ptr->size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Broken text box detected, skiping parsing.\n"));
ptr->textJustification = 1;
return GF_OK;
}
return gf_isom_box_array_read(s, bs);
}
| 0
|
474,072
|
st_numcmp(st_data_t x, st_data_t y)
{
return x != y;
}
| 0
|
250,694
|
int HttpFileImpl::save(const std::string &path) const
{
assert(!path.empty());
if (fileName_.empty())
return -1;
filesystem::path fsUploadDir(utils::toNativePath(path));
if (!fsUploadDir.is_absolute() && (!fsUploadDir.has_parent_path() ||
(fsUploadDir.begin()->string() != "." &&
fsUploadDir.begin()->string() != "..")))
{
fsUploadDir = utils::toNativePath(
HttpAppFrameworkImpl::instance().getUploadPath()) /
fsUploadDir;
}
fsUploadDir = filesystem::weakly_canonical(fsUploadDir);
if (!filesystem::exists(fsUploadDir))
{
LOG_TRACE << "create path:" << fsUploadDir;
drogon::error_code err;
filesystem::create_directories(fsUploadDir, err);
if (err)
{
LOG_SYSERR;
return -1;
}
}
filesystem::path fsSaveToPath(filesystem::weakly_canonical(
fsUploadDir / utils::toNativePath(fileName_)));
if (!std::equal(fsUploadDir.begin(),
fsUploadDir.end(),
fsSaveToPath.begin()))
{
LOG_ERROR
<< "Attempt writing outside of upload directory detected. Path: "
<< fileName_;
return -1;
}
return saveTo(fsSaveToPath);
}
| 0
|
512,906
|
Item_func_in::eval_not_null_tables(void *opt_arg)
{
Item **arg, **arg_end;
if (Item_func_opt_neg::eval_not_null_tables(NULL))
return 1;
/* not_null_tables_cache == union(T1(e),union(T1(ei))) */
if (pred_level && negated)
return 0;
/* not_null_tables_cache = union(T1(e),intersection(T1(ei))) */
not_null_tables_cache= ~(table_map) 0;
for (arg= args + 1, arg_end= args + arg_count; arg != arg_end; arg++)
not_null_tables_cache&= (*arg)->not_null_tables();
not_null_tables_cache|= (*args)->not_null_tables();
return 0;
}
| 0
|
477,973
|
void simplestring_init(simplestring* string) {
memset(string, 0, sizeof(simplestring));
}
| 0
|
412,135
|
dnsc_nonce_cache_insert(struct slabhash *cache,
const uint8_t nonce[crypto_box_HALF_NONCEBYTES],
const uint8_t magic_query[DNSCRYPT_MAGIC_HEADER_LEN],
const uint8_t pk[crypto_box_PUBLICKEYBYTES],
uint32_t hash)
{
struct nonce_cache_key* k =
(struct nonce_cache_key*)calloc(1, sizeof(*k));
if(!k) {
free(k);
return;
}
lock_rw_init(&k->entry.lock);
memcpy(k->nonce, nonce, crypto_box_HALF_NONCEBYTES);
memcpy(k->magic_query, magic_query, DNSCRYPT_MAGIC_HEADER_LEN);
memcpy(k->client_publickey, pk, crypto_box_PUBLICKEYBYTES);
k->entry.hash = hash;
k->entry.key = k;
k->entry.data = NULL;
slabhash_insert(cache,
hash, &k->entry,
NULL,
NULL);
}
| 0
|
273,073
|
keyval_alloc(void)
{
struct keyval *kv;
kv = calloc(1, sizeof(struct keyval));
if (!kv)
{
DPRINTF(E_LOG, L_MISC, "Out of memory for keyval alloc\n");
return NULL;
}
return kv;
}
| 0
|
234,211
|
display_trace_info (struct dwarf_section *section, void *file)
{
return process_debug_info (section, file, section->abbrev_sec, false, true);
}
| 0
|
424,935
|
void iwl_pcie_apm_config(struct iwl_trans *trans)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u16 lctl;
u16 cap;
/*
* HW bug W/A for instability in PCIe bus L0S->L1 transition.
* Check if BIOS (or OS) enabled L1-ASPM on this device.
* If so (likely), disable L0S, so device moves directly L0->L1;
* costs negligible amount of power savings.
* If not (unlikely), enable L0S, so there is at least some
* power savings, even without L1.
*/
pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
if (lctl & PCI_EXP_LNKCTL_ASPM_L1)
iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
else
iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap);
trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN;
IWL_DEBUG_POWER(trans, "L1 %sabled - LTR %sabled\n",
(lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis",
trans->ltr_enabled ? "En" : "Dis");
}
| 0
|
332,384
|
op_colon(oparg_T *oap)
{
stuffcharReadbuff(':');
if (oap->is_VIsual)
stuffReadbuff((char_u *)"'<,'>");
else
{
// Make the range look nice, so it can be repeated.
if (oap->start.lnum == curwin->w_cursor.lnum)
stuffcharReadbuff('.');
else
stuffnumReadbuff((long)oap->start.lnum);
if (oap->end.lnum != oap->start.lnum)
{
stuffcharReadbuff(',');
if (oap->end.lnum == curwin->w_cursor.lnum)
stuffcharReadbuff('.');
else if (oap->end.lnum == curbuf->b_ml.ml_line_count)
stuffcharReadbuff('$');
else if (oap->start.lnum == curwin->w_cursor.lnum)
{
stuffReadbuff((char_u *)".+");
stuffnumReadbuff((long)oap->line_count - 1);
}
else
stuffnumReadbuff((long)oap->end.lnum);
}
}
if (oap->op_type != OP_COLON)
stuffReadbuff((char_u *)"!");
if (oap->op_type == OP_INDENT)
{
#ifndef FEAT_CINDENT
if (*get_equalprg() == NUL)
stuffReadbuff((char_u *)"indent");
else
#endif
stuffReadbuff(get_equalprg());
stuffReadbuff((char_u *)"\n");
}
else if (oap->op_type == OP_FORMAT)
{
if (*curbuf->b_p_fp != NUL)
stuffReadbuff(curbuf->b_p_fp);
else if (*p_fp != NUL)
stuffReadbuff(p_fp);
else
stuffReadbuff((char_u *)"fmt");
stuffReadbuff((char_u *)"\n']");
}
// do_cmdline() does the rest
}
| 0
|
509,557
|
int ha_maria::rnd_pos(uchar *buf, uchar *pos)
{
register_handler(file);
int error= maria_rrnd(file, buf, my_get_ptr(pos, ref_length));
return error;
}
| 0
|
220,815
|
constexpr int lut_size() {
static_assert(std::is_same<LutInT, int8_t>::value ||
std::is_same<LutInT, int16_t>::value,
"Only LUTs with int8 or int16 inputs are supported.");
return std::is_same<LutInT, int8_t>::value ? 256 : 513;
}
| 0
|
316,995
|
static int selinux_ib_alloc_security(void **ib_sec)
{
struct ib_security_struct *sec;
sec = kzalloc(sizeof(*sec), GFP_KERNEL);
if (!sec)
return -ENOMEM;
sec->sid = current_sid();
*ib_sec = sec;
return 0;
}
| 0
|
270,408
|
static bool ok_inflater_dynamic_block_header(ok_inflater *inflater) {
if (!ok_inflater_load_bits(inflater, 14)) {
return false;
} else {
inflater->num_literal_codes = (int)ok_inflater_read_bits(inflater, 5) + 257;
inflater->num_distance_codes = (int)ok_inflater_read_bits(inflater, 5) + 1;
inflater->num_code_length_codes = (int)ok_inflater_read_bits(inflater, 4) + 4;
for (int i = inflater->num_code_length_codes; i < OK_INFLATER_BIT_LENGTH_TABLE_LENGTH; i++) {
inflater->tree_codes[OK_INFLATER_BIT_LENGTH_TABLE[i]] = 0;
}
inflater->state = OK_INFLATER_STATE_READING_DYNAMIC_CODE_LENGTHS;
inflater->state_count = inflater->num_code_length_codes;
return true;
}
}
| 0
|
401,588
|
urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
unsigned long flags;
static int maxwarn = 10;
if (!crng_ready() && maxwarn > 0) {
maxwarn--;
if (__ratelimit(&urandom_warning))
pr_notice("%s: uninitialized urandom read (%zd bytes read)\n",
current->comm, nbytes);
spin_lock_irqsave(&primary_crng.lock, flags);
crng_init_cnt = 0;
spin_unlock_irqrestore(&primary_crng.lock, flags);
}
return urandom_read_nowarn(file, buf, nbytes, ppos);
}
| 0
|
314,760
|
cdf_read_dir(const cdf_info_t *info, const cdf_header_t *h,
const cdf_sat_t *sat, cdf_dir_t *dir)
{
size_t i, j;
size_t ss = CDF_SEC_SIZE(h), ns, nd;
char *buf;
cdf_secid_t sid = h->h_secid_first_directory;
ns = cdf_count_chain(sat, sid, ss);
if (ns == (size_t)-1)
return -1;
nd = ss / CDF_DIRECTORY_SIZE;
dir->dir_len = ns * nd;
dir->dir_tab = CAST(cdf_directory_t *,
calloc(dir->dir_len, sizeof(dir->dir_tab[0])));
if (dir->dir_tab == NULL)
return -1;
if ((buf = CAST(char *, malloc(ss))) == NULL) {
free(dir->dir_tab);
return -1;
}
for (j = i = 0; i < ns; i++, j++) {
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Read dir loop limit"));
errno = EFTYPE;
goto out;
}
if (cdf_read_sector(info, buf, 0, ss, h, sid) != (ssize_t)ss) {
DPRINTF(("Reading directory sector %d", sid));
goto out;
}
for (j = 0; j < nd; j++) {
cdf_unpack_dir(&dir->dir_tab[i * nd + j],
&buf[j * CDF_DIRECTORY_SIZE]);
}
sid = CDF_TOLE4((uint32_t)sat->sat_tab[sid]);
}
if (NEED_SWAP)
for (i = 0; i < dir->dir_len; i++)
cdf_swap_dir(&dir->dir_tab[i]);
free(buf);
return 0;
out:
free(dir->dir_tab);
free(buf);
return -1;
}
| 0
|
222,511
|
const FunctionDef* FunctionLibraryDefinition::GetAttrImpl(
const NodeDef& ndef) const {
if (ndef.op() != kGradientOp) {
// If 'ndef' calls a function and the function's def has the attr,
// returns it.
return Find(ndef.op());
}
// If ndef is SymbolicGradient[f=Foo], we use Foo's gradient or
// Foo's attributes.
const NameAttrList* forward_func_attrs;
if (!TryGetNodeAttr(ndef, kFuncAttr, &forward_func_attrs)) {
return nullptr;
}
const string& func_name = forward_func_attrs->name();
{
tf_shared_lock l(mu_);
const string& grad_name = FindGradientHelper(func_name);
// If 'func' has a user-defined gradient function, uses the grad
// function's attrs to see if noinline is specified. Otherwise,
// uses func's attrs.
if (!grad_name.empty()) {
if (const auto helper = FindHelper(grad_name)) {
return &(helper->fdef);
} else {
return nullptr;
}
}
if (const auto helper = FindHelper(func_name)) {
return &(helper->fdef);
} else {
return nullptr;
}
}
}
| 0
|
513,176
|
void plugin_opt_set_limits(struct my_option *options,
const struct st_mysql_sys_var *opt)
{
options->sub_size= 0;
switch (opt->flags & (PLUGIN_VAR_TYPEMASK |
PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL)) {
/* global system variables */
case PLUGIN_VAR_INT:
OPTION_SET_LIMITS(GET_INT, options, (sysvar_int_t*) opt);
break;
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED:
OPTION_SET_LIMITS(GET_UINT, options, (sysvar_uint_t*) opt);
break;
case PLUGIN_VAR_LONG:
OPTION_SET_LIMITS(GET_LONG, options, (sysvar_long_t*) opt);
break;
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED:
OPTION_SET_LIMITS(GET_ULONG, options, (sysvar_ulong_t*) opt);
break;
case PLUGIN_VAR_LONGLONG:
OPTION_SET_LIMITS(GET_LL, options, (sysvar_longlong_t*) opt);
break;
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED:
OPTION_SET_LIMITS(GET_ULL, options, (sysvar_ulonglong_t*) opt);
break;
case PLUGIN_VAR_ENUM:
options->var_type= GET_ENUM;
options->typelib= ((sysvar_enum_t*) opt)->typelib;
options->def_value= ((sysvar_enum_t*) opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= options->typelib->count - 1;
break;
case PLUGIN_VAR_SET:
options->var_type= GET_SET;
options->typelib= ((sysvar_set_t*) opt)->typelib;
options->def_value= ((sysvar_set_t*) opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= (1ULL << options->typelib->count) - 1;
break;
case PLUGIN_VAR_BOOL:
options->var_type= GET_BOOL;
options->def_value= ((sysvar_bool_t*) opt)->def_val;
options->typelib= &bool_typelib;
break;
case PLUGIN_VAR_STR:
options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ?
GET_STR_ALLOC : GET_STR);
options->def_value= (intptr) ((sysvar_str_t*) opt)->def_val;
break;
case PLUGIN_VAR_DOUBLE:
OPTION_SET_LIMITS_DOUBLE(options, (sysvar_double_t*) opt);
break;
/* threadlocal variables */
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt);
break;
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_UINT, options, (thdvar_uint_t*) opt);
break;
case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_LONG, options, (thdvar_long_t*) opt);
break;
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_ULONG, options, (thdvar_ulong_t*) opt);
break;
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_LL, options, (thdvar_longlong_t*) opt);
break;
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_ULL, options, (thdvar_ulonglong_t*) opt);
break;
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS_DOUBLE(options, (thdvar_double_t*) opt);
break;
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_ENUM;
options->typelib= ((thdvar_enum_t*) opt)->typelib;
options->def_value= ((thdvar_enum_t*) opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= options->typelib->count - 1;
break;
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_SET;
options->typelib= ((thdvar_set_t*) opt)->typelib;
options->def_value= ((thdvar_set_t*) opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= (1ULL << options->typelib->count) - 1;
break;
case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_BOOL;
options->def_value= ((thdvar_bool_t*) opt)->def_val;
options->typelib= &bool_typelib;
break;
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ?
GET_STR_ALLOC : GET_STR);
options->def_value= (intptr) ((thdvar_str_t*) opt)->def_val;
break;
default:
DBUG_ASSERT(0);
}
options->arg_type= REQUIRED_ARG;
if (opt->flags & PLUGIN_VAR_NOCMDARG)
options->arg_type= NO_ARG;
if (opt->flags & PLUGIN_VAR_OPCMDARG)
options->arg_type= OPT_ARG;
}
| 0
|
207,762
|
negotiate_handshake_newstyle_options (void)
{
GET_CONN;
struct nbd_new_option new_option;
size_t nr_options;
bool list_seen = false;
uint64_t version;
uint32_t option;
uint32_t optlen;
struct nbd_export_name_option_reply handshake_finish;
const char *optname;
uint64_t exportsize;
struct backend *b;
for (nr_options = MAX_NR_OPTIONS; nr_options > 0; --nr_options) {
CLEANUP_FREE char *data = NULL;
if (conn_recv_full (&new_option, sizeof new_option,
"reading option: conn->recv: %m") == -1)
return -1;
version = be64toh (new_option.version);
if (version != NBD_NEW_VERSION) {
nbdkit_error ("unknown option version %" PRIx64
", expecting %" PRIx64,
version, NBD_NEW_VERSION);
return -1;
}
/* There is a maximum option length we will accept, regardless
* of the option type.
*/
optlen = be32toh (new_option.optlen);
if (optlen > MAX_REQUEST_SIZE) {
nbdkit_error ("client option data too long (%" PRIu32 ")", optlen);
return -1;
}
data = malloc (optlen + 1); /* Allowing a trailing NUL helps some uses */
if (data == NULL) {
nbdkit_error ("malloc: %m");
return -1;
}
option = be32toh (new_option.option);
optname = name_of_nbd_opt (option);
/* If the client lacks fixed newstyle support, it should only send
* NBD_OPT_EXPORT_NAME.
*/
if (!(conn->cflags & NBD_FLAG_FIXED_NEWSTYLE) &&
option != NBD_OPT_EXPORT_NAME) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID))
return -1;
continue;
}
/* In --tls=require / FORCEDTLS mode the only options allowed
* before TLS negotiation are NBD_OPT_ABORT and NBD_OPT_STARTTLS.
*/
if (tls == 2 && !conn->using_tls &&
!(option == NBD_OPT_ABORT || option == NBD_OPT_STARTTLS)) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_TLS_REQD))
return -1;
continue;
}
switch (option) {
case NBD_OPT_EXPORT_NAME:
if (conn_recv_full (data, optlen,
"read: %s: %m", name_of_nbd_opt (option)) == -1)
return -1;
if (check_export_name (option, data, optlen, optlen) == -1)
return -1;
/* We have to finish the handshake by sending handshake_finish.
* On failure, we have to disconnect.
*/
if (finish_newstyle_options (&exportsize, data, optlen) == -1)
return -1;
memset (&handshake_finish, 0, sizeof handshake_finish);
handshake_finish.exportsize = htobe64 (exportsize);
handshake_finish.eflags = htobe16 (conn->eflags);
if (conn->send (&handshake_finish,
(conn->cflags & NBD_FLAG_NO_ZEROES)
? offsetof (struct nbd_export_name_option_reply, zeroes)
: sizeof handshake_finish, 0) == -1) {
nbdkit_error ("write: %s: %m", optname);
return -1;
}
break;
case NBD_OPT_ABORT:
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
debug ("client sent %s to abort the connection",
name_of_nbd_opt (option));
return -1;
case NBD_OPT_LIST:
if (optlen != 0) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
if (conn_recv_full (data, optlen,
"read: %s: %m", name_of_nbd_opt (option)) == -1)
return -1;
continue;
}
if (list_seen) {
debug ("newstyle negotiation: %s: export list already advertised",
name_of_nbd_opt (option));
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID) == -1)
return -1;
continue;
}
else {
/* Send back the exportname list. */
debug ("newstyle negotiation: %s: advertising exports",
name_of_nbd_opt (option));
if (send_newstyle_option_reply_exportnames (option, &nr_options) == -1)
return -1;
list_seen = true;
}
break;
case NBD_OPT_STARTTLS:
if (optlen != 0) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
if (conn_recv_full (data, optlen,
"read: %s: %m", name_of_nbd_opt (option)) == -1)
return -1;
continue;
}
if (tls == 0) { /* --tls=off (NOTLS mode). */
#ifdef HAVE_GNUTLS
#define NO_TLS_REPLY NBD_REP_ERR_POLICY
#else
#define NO_TLS_REPLY NBD_REP_ERR_UNSUP
#endif
if (send_newstyle_option_reply (option, NO_TLS_REPLY) == -1)
return -1;
}
else /* --tls=on or --tls=require */ {
/* We can't upgrade to TLS twice on the same connection. */
if (conn->using_tls) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID) == -1)
return -1;
continue;
}
/* We have to send the (unencrypted) reply before starting
* the handshake.
*/
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
/* Upgrade the connection to TLS. Also performs access control. */
if (crypto_negotiate_tls (conn->sockin, conn->sockout) == -1)
return -1;
conn->using_tls = true;
debug ("using TLS on this connection");
/* Wipe out any cached default export name. */
for_each_backend (b) {
free (conn->default_exportname[b->i]);
conn->default_exportname[b->i] = NULL;
}
}
break;
case NBD_OPT_INFO:
case NBD_OPT_GO:
if (conn_recv_full (data, optlen, "read: %s: %m", optname) == -1)
return -1;
if (optlen < 6) { /* 32 bit export length + 16 bit nr info */
debug ("newstyle negotiation: %s option length < 6", optname);
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
{
uint32_t exportnamelen;
uint16_t nrinfos;
uint16_t info;
size_t i;
/* Validate the name length and number of INFO requests. */
memcpy (&exportnamelen, &data[0], 4);
exportnamelen = be32toh (exportnamelen);
if (exportnamelen > optlen-6 /* NB optlen >= 6, see above */) {
debug ("newstyle negotiation: %s: export name too long", optname);
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
memcpy (&nrinfos, &data[exportnamelen+4], 2);
nrinfos = be16toh (nrinfos);
if (optlen != 4 + exportnamelen + 2 + 2*nrinfos) {
debug ("newstyle negotiation: %s: "
"number of information requests incorrect", optname);
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
/* As with NBD_OPT_EXPORT_NAME we print the export name and
* save it in the connection. If an earlier
* NBD_OPT_SET_META_CONTEXT used an export name, it must match
* or else we drop the support for that context.
*/
if (check_export_name (option, &data[4], exportnamelen,
optlen - 6) == -1) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
/* The spec is confusing, but it is required that we send back
* NBD_INFO_EXPORT, even if the client did not request it!
* qemu client in particular does not request this, but will
* fail if we don't send it. Note that if .open fails, but we
* succeed at .close, then we merely return an error to the
* client and let them try another NBD_OPT, rather than
* disconnecting.
*/
if (finish_newstyle_options (&exportsize,
&data[4], exportnamelen) == -1) {
if (conn->top_context) {
if (backend_finalize (conn->top_context) == -1)
return -1;
backend_close (conn->top_context);
conn->top_context = NULL;
}
if (send_newstyle_option_reply (option, NBD_REP_ERR_UNKNOWN) == -1)
return -1;
continue;
}
if (send_newstyle_option_reply_info_export (option,
NBD_REP_INFO,
NBD_INFO_EXPORT,
exportsize) == -1)
return -1;
/* For now we send NBD_INFO_NAME and NBD_INFO_DESCRIPTION if
* requested, and ignore all other info requests (including
* NBD_INFO_EXPORT if it was requested, because we replied
* already above).
*/
for (i = 0; i < nrinfos; ++i) {
memcpy (&info, &data[4 + exportnamelen + 2 + i*2], 2);
info = be16toh (info);
switch (info) {
case NBD_INFO_EXPORT: /* ignore - reply sent above */ break;
case NBD_INFO_NAME:
{
const char *name = &data[4];
size_t namelen = exportnamelen;
if (exportnamelen == 0) {
name = backend_default_export (top, read_only);
if (!name) {
debug ("newstyle negotiation: %s: "
"NBD_INFO_NAME: no name to send", optname);
break;
}
namelen = -1;
}
if (send_newstyle_option_reply_info_str (option,
NBD_REP_INFO,
NBD_INFO_NAME,
name, namelen) == -1)
return -1;
}
break;
case NBD_INFO_DESCRIPTION:
{
const char *desc = backend_export_description (conn->top_context);
if (!desc) {
debug ("newstyle negotiation: %s: "
"NBD_INFO_DESCRIPTION: no description to send",
optname);
break;
}
if (send_newstyle_option_reply_info_str (option,
NBD_REP_INFO,
NBD_INFO_DESCRIPTION,
desc, -1) == -1)
return -1;
}
break;
default:
debug ("newstyle negotiation: %s: "
"ignoring NBD_INFO_* request %u (%s)",
optname, (unsigned) info, name_of_nbd_info (info));
break;
}
}
}
/* Unlike NBD_OPT_EXPORT_NAME, NBD_OPT_GO sends back an ACK
* or ERROR packet. If this was NBD_OPT_LIST, call .close.
*/
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
if (option == NBD_OPT_INFO) {
if (backend_finalize (conn->top_context) == -1)
return -1;
backend_close (conn->top_context);
conn->top_context = NULL;
}
break;
case NBD_OPT_STRUCTURED_REPLY:
if (optlen != 0) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
if (conn_recv_full (data, optlen,
"read: %s: %m", name_of_nbd_opt (option)) == -1)
return -1;
continue;
}
debug ("newstyle negotiation: %s: client requested structured replies",
name_of_nbd_opt (option));
if (no_sr) {
/* Must fail with ERR_UNSUP for qemu 4.2 to remain happy;
* but failing with ERR_POLICY would have been nicer.
*/
if (send_newstyle_option_reply (option, NBD_REP_ERR_UNSUP) == -1)
return -1;
debug ("newstyle negotiation: %s: structured replies are disabled",
name_of_nbd_opt (option));
break;
}
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
conn->structured_replies = true;
break;
case NBD_OPT_LIST_META_CONTEXT:
case NBD_OPT_SET_META_CONTEXT:
{
uint32_t opt_index;
uint32_t exportnamelen;
uint32_t nr_queries;
uint32_t querylen;
const char *what;
if (conn_recv_full (data, optlen, "read: %s: %m", optname) == -1)
return -1;
/* Note that we support base:allocation whether or not the plugin
* supports can_extents.
*/
if (!conn->structured_replies) {
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
/* Minimum length of the option payload is:
* 32 bit export name length followed by empty export name
* + 32 bit number of queries followed by no queries
* = 8 bytes.
*/
what = "optlen < 8";
if (optlen < 8) {
opt_meta_invalid_option_len:
debug ("newstyle negotiation: %s: invalid option length: %s",
optname, what);
if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)
== -1)
return -1;
continue;
}
memcpy (&exportnamelen, &data[0], 4);
exportnamelen = be32toh (exportnamelen);
what = "validating export name";
if (check_export_name (option, &data[4], exportnamelen,
optlen - 8) == -1)
goto opt_meta_invalid_option_len;
/* Remember the export name: the NBD spec says that if the client
* later uses NBD_OPT_GO on a different export, then the context
* returned here is not usable.
*/
if (option == NBD_OPT_SET_META_CONTEXT) {
conn->exportname_from_set_meta_context =
strndup (&data[4], exportnamelen);
if (conn->exportname_from_set_meta_context == NULL) {
nbdkit_error ("malloc: %m");
return -1;
}
}
opt_index = 4 + exportnamelen;
/* Read the number of queries. */
what = "reading number of queries";
if (opt_index+4 > optlen)
goto opt_meta_invalid_option_len;
memcpy (&nr_queries, &data[opt_index], 4);
nr_queries = be32toh (nr_queries);
opt_index += 4;
/* for LIST: nr_queries == 0 means return all meta contexts
* for SET: nr_queries == 0 means reset all contexts
*/
debug ("newstyle negotiation: %s: %s count: %d", optname,
option == NBD_OPT_LIST_META_CONTEXT ? "query" : "set",
nr_queries);
if (option == NBD_OPT_SET_META_CONTEXT)
conn->meta_context_base_allocation = false;
if (nr_queries == 0) {
if (option == NBD_OPT_LIST_META_CONTEXT) {
if (send_newstyle_option_reply_meta_context (option,
NBD_REP_META_CONTEXT,
0, "base:allocation")
== -1)
return -1;
}
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
}
else {
/* Read and answer each query. */
while (nr_queries > 0) {
what = "reading query string length";
if (opt_index+4 > optlen)
goto opt_meta_invalid_option_len;
memcpy (&querylen, &data[opt_index], 4);
querylen = be32toh (querylen);
opt_index += 4;
what = "reading query string";
if (check_string (option, &data[opt_index], querylen,
optlen - opt_index, "meta context query") == -1)
goto opt_meta_invalid_option_len;
debug ("newstyle negotiation: %s: %s %.*s",
optname,
option == NBD_OPT_LIST_META_CONTEXT ? "query" : "set",
(int) querylen, &data[opt_index]);
/* For LIST, "base:" returns all supported contexts in the
* base namespace. We only support "base:allocation".
*/
if (option == NBD_OPT_LIST_META_CONTEXT &&
querylen == 5 &&
strncmp (&data[opt_index], "base:", 5) == 0) {
if (send_newstyle_option_reply_meta_context
(option, NBD_REP_META_CONTEXT,
0, "base:allocation") == -1)
return -1;
}
/* "base:allocation" requested by name. */
else if (querylen == 15 &&
strncmp (&data[opt_index], "base:allocation", 15) == 0) {
if (send_newstyle_option_reply_meta_context
(option, NBD_REP_META_CONTEXT,
option == NBD_OPT_SET_META_CONTEXT
? base_allocation_id : 0,
"base:allocation") == -1)
return -1;
if (option == NBD_OPT_SET_META_CONTEXT)
conn->meta_context_base_allocation = true;
}
/* Every other query must be ignored. */
opt_index += querylen;
nr_queries--;
}
if (send_newstyle_option_reply (option, NBD_REP_ACK) == -1)
return -1;
}
debug ("newstyle negotiation: %s: reply complete", optname);
}
break;
default:
/* Unknown option. */
if (send_newstyle_option_reply (option, NBD_REP_ERR_UNSUP) == -1)
return -1;
if (conn_recv_full (data, optlen,
"reading unknown option data: conn->recv: %m") == -1)
return -1;
}
/* Note, since it's not very clear from the protocol doc, that the
* client must send NBD_OPT_EXPORT_NAME or NBD_OPT_GO last, and
* that ends option negotiation.
*/
if (option == NBD_OPT_EXPORT_NAME || option == NBD_OPT_GO)
break;
}
if (nr_options == 0) {
nbdkit_error ("client spent too much time negotiating without selecting "
"an export");
return -1;
}
/* In --tls=require / FORCEDTLS mode, we must have upgraded to TLS
* by the time we finish option negotiation. If not, give up.
*/
if (tls == 2 && !conn->using_tls) {
nbdkit_error ("non-TLS client tried to connect in --tls=require mode");
return -1;
}
return 0;
}
| 1
|
445,990
|
_archive_operation_started (FrWindow *window,
FrAction action)
{
GFile *archive;
char *message;
window->priv->action = action;
_fr_window_start_activity_mode (window);
#ifdef DEBUG
debug (DEBUG_INFO, "%s [START] (FR::Window)\n", action_names[action]);
#endif
archive = window->priv->pd_last_archive;
if (archive == NULL)
archive = window->priv->archive_file;
message = get_action_description (window, action, archive);
fr_window_push_message (window, message);
g_free (message);
switch (action) {
case FR_ACTION_EXTRACTING_FILES:
open_progress_dialog (window, ((window->priv->saving_file != NULL)
|| window->priv->batch_mode));
break;
default:
open_progress_dialog (window, window->priv->batch_mode);
break;
}
fr_archive_progress_cb (NULL, -1.0, window);
fr_archive_message_cb (NULL, _("Please wait…"), window);
}
| 0
|
336,017
|
static int sr9700_get_eeprom_len(struct net_device *netdev)
{
return SR_EEPROM_LEN;
}
| 0
|
289,244
|
static int snd_pcm_oss_open(struct inode *inode, struct file *file)
{
int err;
char task_name[32];
struct snd_pcm *pcm;
struct snd_pcm_oss_file *pcm_oss_file;
struct snd_pcm_oss_setup setup[2];
int nonblock;
wait_queue_entry_t wait;
err = nonseekable_open(inode, file);
if (err < 0)
return err;
pcm = snd_lookup_oss_minor_data(iminor(inode),
SNDRV_OSS_DEVICE_TYPE_PCM);
if (pcm == NULL) {
err = -ENODEV;
goto __error1;
}
err = snd_card_file_add(pcm->card, file);
if (err < 0)
goto __error1;
if (!try_module_get(pcm->card->module)) {
err = -EFAULT;
goto __error2;
}
if (snd_task_name(current, task_name, sizeof(task_name)) < 0) {
err = -EFAULT;
goto __error;
}
memset(setup, 0, sizeof(setup));
if (file->f_mode & FMODE_WRITE)
snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK,
task_name, &setup[0]);
if (file->f_mode & FMODE_READ)
snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_CAPTURE,
task_name, &setup[1]);
nonblock = !!(file->f_flags & O_NONBLOCK);
if (!nonblock)
nonblock = nonblock_open;
init_waitqueue_entry(&wait, current);
add_wait_queue(&pcm->open_wait, &wait);
mutex_lock(&pcm->open_mutex);
while (1) {
err = snd_pcm_oss_open_file(file, pcm, &pcm_oss_file,
iminor(inode), setup);
if (err >= 0)
break;
if (err == -EAGAIN) {
if (nonblock) {
err = -EBUSY;
break;
}
} else
break;
set_current_state(TASK_INTERRUPTIBLE);
mutex_unlock(&pcm->open_mutex);
schedule();
mutex_lock(&pcm->open_mutex);
if (pcm->card->shutdown) {
err = -ENODEV;
break;
}
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
}
}
remove_wait_queue(&pcm->open_wait, &wait);
mutex_unlock(&pcm->open_mutex);
if (err < 0)
goto __error;
snd_card_unref(pcm->card);
return err;
__error:
module_put(pcm->card->module);
__error2:
snd_card_file_remove(pcm->card, file);
__error1:
if (pcm)
snd_card_unref(pcm->card);
return err;
}
| 0
|
430,460
|
int ovs_nla_put_key(const struct sw_flow_key *swkey,
const struct sw_flow_key *output, int attr, bool is_mask,
struct sk_buff *skb)
{
int err;
struct nlattr *nla;
nla = nla_nest_start_noflag(skb, attr);
if (!nla)
return -EMSGSIZE;
err = __ovs_nla_put_key(swkey, output, is_mask, skb);
if (err)
return err;
nla_nest_end(skb, nla);
return 0;
}
| 0
|
230,979
|
mrb_vm_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int stack_keep)
{
const mrb_irep *irep = proc->body.irep;
mrb_value result;
struct mrb_context *c = mrb->c;
ptrdiff_t cioff = c->ci - c->cibase;
mrb_int nregs = irep->nregs;
if (!c->stbase) {
stack_init(mrb);
}
if (stack_keep > nregs)
nregs = stack_keep;
mrb_stack_extend(mrb, nregs);
stack_clear(c->ci->stack + stack_keep, nregs - stack_keep);
c->ci->stack[0] = self;
result = mrb_vm_exec(mrb, proc, irep->iseq);
if (mrb->c != c) {
if (mrb->c->fib) {
mrb_write_barrier(mrb, (struct RBasic*)mrb->c->fib);
}
mrb->c = c;
}
else if (c->ci - c->cibase > cioff) {
c->ci = c->cibase + cioff;
}
return result;
}
| 0
|
338,150
|
void WasmBinaryBuilder::processNames() {
for (auto* func : functions) {
wasm.addFunction(func);
}
for (auto& global : globals) {
wasm.addGlobal(std::move(global));
}
for (auto& table : tables) {
wasm.addTable(std::move(table));
}
for (auto& segment : elementSegments) {
wasm.addElementSegment(std::move(segment));
}
// now that we have names, apply things
if (startIndex != static_cast<Index>(-1)) {
wasm.start = getFunctionName(startIndex);
}
for (auto* curr : exportOrder) {
auto index = exportIndices[curr];
switch (curr->kind) {
case ExternalKind::Function: {
curr->value = getFunctionName(index);
break;
}
case ExternalKind::Table:
curr->value = getTableName(index);
break;
case ExternalKind::Memory:
curr->value = wasm.memory.name;
break;
case ExternalKind::Global:
curr->value = getGlobalName(index);
break;
case ExternalKind::Tag:
curr->value = getTagName(index);
break;
default:
throwError("bad export kind");
}
wasm.addExport(curr);
}
for (auto& [index, refs] : functionRefs) {
for (auto* ref : refs) {
if (auto* call = ref->dynCast<Call>()) {
call->target = getFunctionName(index);
} else if (auto* refFunc = ref->dynCast<RefFunc>()) {
refFunc->func = getFunctionName(index);
} else {
WASM_UNREACHABLE("Invalid type in function references");
}
}
}
for (auto& [index, refs] : tableRefs) {
for (auto* ref : refs) {
if (auto* callIndirect = ref->dynCast<CallIndirect>()) {
callIndirect->table = getTableName(index);
} else if (auto* get = ref->dynCast<TableGet>()) {
get->table = getTableName(index);
} else if (auto* set = ref->dynCast<TableSet>()) {
set->table = getTableName(index);
} else if (auto* size = ref->dynCast<TableSize>()) {
size->table = getTableName(index);
} else if (auto* grow = ref->dynCast<TableGrow>()) {
grow->table = getTableName(index);
} else {
WASM_UNREACHABLE("Invalid type in table references");
}
}
}
for (auto& [index, refs] : globalRefs) {
for (auto* ref : refs) {
if (auto* get = ref->dynCast<GlobalGet>()) {
get->name = getGlobalName(index);
} else if (auto* set = ref->dynCast<GlobalSet>()) {
set->name = getGlobalName(index);
} else {
WASM_UNREACHABLE("Invalid type in global references");
}
}
}
// Everything now has its proper name.
wasm.updateMaps();
}
| 0
|
299,901
|
readconf_readname(uschar *name, int len, uschar *s)
{
int p = 0;
while (isspace(*s)) s++;
if (isalpha(*s))
{
while (isalnum(*s) || *s == '_')
{
if (p < len-1) name[p++] = *s;
s++;
}
}
name[p] = 0;
while (isspace(*s)) s++;
return s;
}
| 0
|
225,991
|
GF_Box *mfhd_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_MovieFragmentHeaderBox, GF_ISOM_BOX_TYPE_MFHD);
return (GF_Box *)tmp;
}
| 0
|
195,565
|
String string_number_format(double d, int dec,
const String& dec_point,
const String& thousand_sep) {
char *tmpbuf = nullptr, *resbuf;
char *s, *t; /* source, target */
char *dp;
int integral;
int tmplen, reslen=0;
int count=0;
int is_negative=0;
if (d < 0) {
is_negative = 1;
d = -d;
}
if (dec < 0) dec = 0;
d = php_math_round(d, dec);
// departure from PHP: we got rid of dependencies on spprintf() here.
String tmpstr(63, ReserveString);
tmpbuf = tmpstr.mutableData();
tmplen = snprintf(tmpbuf, 64, "%.*F", dec, d);
if (tmplen < 0) return empty_string();
if (tmpbuf == nullptr || !isdigit((int)tmpbuf[0])) {
tmpstr.setSize(tmplen);
return tmpstr;
}
if (tmplen >= 64) {
// Uncommon, asked for more than 64 chars worth of precision
tmpstr = String(tmplen, ReserveString);
tmpbuf = tmpstr.mutableData();
tmplen = snprintf(tmpbuf, tmplen + 1, "%.*F", dec, d);
if (tmplen < 0) return empty_string();
if (tmpbuf == nullptr || !isdigit((int)tmpbuf[0])) {
tmpstr.setSize(tmplen);
return tmpstr;
}
}
/* find decimal point, if expected */
if (dec) {
dp = strpbrk(tmpbuf, ".,");
} else {
dp = nullptr;
}
/* calculate the length of the return buffer */
if (dp) {
integral = dp - tmpbuf;
} else {
/* no decimal point was found */
integral = tmplen;
}
/* allow for thousand separators */
if (!thousand_sep.empty()) {
if (integral + thousand_sep.size() * ((integral-1) / 3) < integral) {
/* overflow */
raise_error("String overflow");
}
integral += ((integral-1) / 3) * thousand_sep.size();
}
reslen = integral;
if (dec) {
reslen += dec;
if (!dec_point.empty()) {
if (reslen + dec_point.size() < dec_point.size()) {
/* overflow */
raise_error("String overflow");
}
reslen += dec_point.size();
}
}
/* add a byte for minus sign */
if (is_negative) {
reslen++;
}
String resstr(reslen, ReserveString);
resbuf = resstr.mutableData();
s = tmpbuf+tmplen-1;
t = resbuf+reslen-1;
/* copy the decimal places.
* Take care, as the sprintf implementation may return less places than
* we requested due to internal buffer limitations */
if (dec) {
int declen = dp ? s - dp : 0;
int topad = dec > declen ? dec - declen : 0;
/* pad with '0's */
while (topad--) {
*t-- = '0';
}
if (dp) {
s -= declen + 1; /* +1 to skip the point */
t -= declen;
/* now copy the chars after the point */
memcpy(t + 1, dp + 1, declen);
}
/* add decimal point */
if (!dec_point.empty()) {
memcpy(t + (1 - dec_point.size()), dec_point.data(), dec_point.size());
t -= dec_point.size();
}
}
/* copy the numbers before the decimal point, adding thousand
* separator every three digits */
while(s >= tmpbuf) {
*t-- = *s--;
if (thousand_sep && (++count%3)==0 && s>=tmpbuf) {
memcpy(t + (1 - thousand_sep.size()),
thousand_sep.data(),
thousand_sep.size());
t -= thousand_sep.size();
}
}
/* and a minus sign, if needed */
if (is_negative) {
*t-- = '-';
}
resstr.setSize(reslen);
return resstr;
}
| 1
|
455,420
|
xfs_inode_free_cowblocks(
struct xfs_inode *ip,
int flags,
void *args)
{
struct xfs_eofblocks *eofb = args;
struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
int match;
int ret = 0;
if (!xfs_prep_free_cowblocks(ip, ifp))
return 0;
if (eofb) {
if (eofb->eof_flags & XFS_EOF_FLAGS_UNION)
match = xfs_inode_match_id_union(ip, eofb);
else
match = xfs_inode_match_id(ip, eofb);
if (!match)
return 0;
/* skip the inode if the file size is too small */
if (eofb->eof_flags & XFS_EOF_FLAGS_MINFILESIZE &&
XFS_ISIZE(ip) < eofb->eof_min_file_size)
return 0;
}
/* Free the CoW blocks */
xfs_ilock(ip, XFS_IOLOCK_EXCL);
xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
/*
* Check again, nobody else should be able to dirty blocks or change
* the reflink iflag now that we have the first two locks held.
*/
if (xfs_prep_free_cowblocks(ip, ifp))
ret = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, false);
xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
return ret;
}
| 0
|
225,709
|
GF_Err pcrb_box_read(GF_Box *s,GF_BitStream *bs)
{
u32 i;
GF_PcrInfoBox *ptr = (GF_PcrInfoBox*) s;
ISOM_DECREASE_SIZE(ptr, 4);
ptr->subsegment_count = gf_bs_read_u32(bs);
if ((u64)ptr->subsegment_count > ptr->size / 8 || (u64)ptr->subsegment_count > (u64)SIZE_MAX/sizeof(u64)) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid number of subsegment %d in pcrb\n", ptr->subsegment_count));
return GF_ISOM_INVALID_FILE;
}
ptr->pcr_values = gf_malloc(sizeof(u64)*ptr->subsegment_count);
if (!ptr->pcr_values) return GF_OUT_OF_MEM;
for (i=0; i<ptr->subsegment_count; i++) {
u64 data1 = gf_bs_read_u32(bs);
u64 data2 = gf_bs_read_u16(bs);
ISOM_DECREASE_SIZE(ptr, 6);
ptr->pcr_values[i] = (data1 << 10) | (data2 >> 6);
}
return GF_OK;
| 0
|
413,820
|
void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
const methodHandle& resolved_method,
Klass* resolved_klass,
Handle recv,
Klass* recv_klass,
bool check_null_and_abstract, TRAPS) {
// check if receiver exists
if (check_null_and_abstract && recv.is_null()) {
THROW(vmSymbols::java_lang_NullPointerException());
}
// check if receiver klass implements the resolved interface
if (!recv_klass->is_subtype_of(resolved_klass)) {
ResourceMark rm(THREAD);
char buf[200];
jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
recv_klass->external_name(),
resolved_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
}
methodHandle selected_method = resolved_method;
// resolve the method in the receiver class, unless it is private
if (!resolved_method()->is_private()) {
// do lookup based on receiver klass
// This search must match the linktime preparation search for itable initialization
// to correctly enforce loader constraints for interface method inheritance.
// Private methods are skipped as the resolved method was not private.
Method* method = lookup_instance_method_in_klasses(recv_klass,
resolved_method->name(),
resolved_method->signature(),
Klass::PrivateLookupMode::skip);
selected_method = methodHandle(THREAD, method);
if (selected_method.is_null() && !check_null_and_abstract) {
// In theory this is a harmless placeholder value, but
// in practice leaving in null affects the nsk default method tests.
// This needs further study.
selected_method = resolved_method;
}
// check if method exists
if (selected_method.is_null()) {
// Pass arguments for generating a verbose error message.
throw_abstract_method_error(resolved_method, recv_klass, CHECK);
}
// check access
// Throw Illegal Access Error if selected_method is not public.
if (!selected_method->is_public()) {
ResourceMark rm(THREAD);
stringStream ss;
ss.print("'");
Method::print_external_name(&ss, recv_klass, selected_method->name(), selected_method->signature());
ss.print("'");
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}
// check if abstract
if (check_null_and_abstract && selected_method->is_abstract()) {
throw_abstract_method_error(resolved_method, selected_method, recv_klass, CHECK);
}
}
if (log_develop_is_enabled(Trace, itables)) {
trace_method_resolution("invokeinterface selected method: receiver-class:",
recv_klass, resolved_klass, selected_method(), true);
}
// setup result
if (resolved_method->has_vtable_index()) {
int vtable_index = resolved_method->vtable_index();
log_develop_trace(itables)(" -- vtable index: %d", vtable_index);
assert(vtable_index == selected_method->vtable_index(), "sanity check");
result.set_virtual(resolved_klass, resolved_method, selected_method, vtable_index, CHECK);
} else if (resolved_method->has_itable_index()) {
int itable_index = resolved_method()->itable_index();
log_develop_trace(itables)(" -- itable index: %d", itable_index);
result.set_interface(resolved_klass, resolved_method, selected_method, itable_index, CHECK);
} else {
int index = resolved_method->vtable_index();
log_develop_trace(itables)(" -- non itable/vtable index: %d", index);
assert(index == Method::nonvirtual_vtable_index, "Oops hit another case!");
assert(resolved_method()->is_private() ||
(resolved_method()->is_final() && resolved_method->method_holder() == vmClasses::Object_klass()),
"Should only have non-virtual invokeinterface for private or final-Object methods!");
assert(resolved_method()->can_be_statically_bound(), "Should only have non-virtual invokeinterface for statically bound methods!");
// This sets up the nonvirtual form of "virtual" call (as needed for final and private methods)
result.set_virtual(resolved_klass, resolved_method, resolved_method, index, CHECK);
}
}
| 0
|
432,309
|
void *qemu_map_ram_ptr(struct uc_struct *uc, RAMBlock *ram_block, ram_addr_t addr)
{
RAMBlock *block = ram_block;
if (block == NULL) {
block = qemu_get_ram_block(uc, addr);
addr -= block->offset;
}
return ramblock_ptr(block, addr);
}
| 0
|
455,318
|
initialize_readline ()
{
rl_command_func_t *func;
char kseq[2];
if (bash_readline_initialized)
return;
rl_terminal_name = get_string_value ("TERM");
rl_instream = stdin;
rl_outstream = stderr;
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "Bash";
/* Add bindable names before calling rl_initialize so they may be
referenced in the various inputrc files. */
rl_add_defun ("shell-expand-line", shell_expand_line, -1);
#ifdef BANG_HISTORY
rl_add_defun ("history-expand-line", history_expand_line, -1);
rl_add_defun ("magic-space", tcsh_magic_space, -1);
#endif
rl_add_defun ("shell-forward-word", bash_forward_shellword, -1);
rl_add_defun ("shell-backward-word", bash_backward_shellword, -1);
rl_add_defun ("shell-kill-word", bash_kill_shellword, -1);
rl_add_defun ("shell-backward-kill-word", bash_backward_kill_shellword, -1);
rl_add_defun ("shell-transpose-words", bash_transpose_shellwords, -1);
#ifdef ALIAS
rl_add_defun ("alias-expand-line", alias_expand_line, -1);
# ifdef BANG_HISTORY
rl_add_defun ("history-and-alias-expand-line", history_and_alias_expand_line, -1);
# endif
#endif
/* Backwards compatibility. */
rl_add_defun ("insert-last-argument", rl_yank_last_arg, -1);
rl_add_defun ("operate-and-get-next", operate_and_get_next, -1);
rl_add_defun ("display-shell-version", display_shell_version, -1);
rl_add_defun ("edit-and-execute-command", emacs_edit_and_execute_command, -1);
#if defined (BRACE_COMPLETION)
rl_add_defun ("complete-into-braces", bash_brace_completion, -1);
#endif
#if defined (SPECIFIC_COMPLETION_FUNCTIONS)
rl_add_defun ("complete-filename", bash_complete_filename, -1);
rl_add_defun ("possible-filename-completions", bash_possible_filename_completions, -1);
rl_add_defun ("complete-username", bash_complete_username, -1);
rl_add_defun ("possible-username-completions", bash_possible_username_completions, -1);
rl_add_defun ("complete-hostname", bash_complete_hostname, -1);
rl_add_defun ("possible-hostname-completions", bash_possible_hostname_completions, -1);
rl_add_defun ("complete-variable", bash_complete_variable, -1);
rl_add_defun ("possible-variable-completions", bash_possible_variable_completions, -1);
rl_add_defun ("complete-command", bash_complete_command, -1);
rl_add_defun ("possible-command-completions", bash_possible_command_completions, -1);
rl_add_defun ("glob-complete-word", bash_glob_complete_word, -1);
rl_add_defun ("glob-expand-word", bash_glob_expand_word, -1);
rl_add_defun ("glob-list-expansions", bash_glob_list_expansions, -1);
#endif
rl_add_defun ("dynamic-complete-history", dynamic_complete_history, -1);
rl_add_defun ("dabbrev-expand", bash_dabbrev_expand, -1);
/* Bind defaults before binding our custom shell keybindings. */
if (RL_ISSTATE(RL_STATE_INITIALIZED) == 0)
rl_initialize ();
/* Bind up our special shell functions. */
rl_bind_key_if_unbound_in_map (CTRL('E'), shell_expand_line, emacs_meta_keymap);
#ifdef BANG_HISTORY
rl_bind_key_if_unbound_in_map ('^', history_expand_line, emacs_meta_keymap);
#endif
rl_bind_key_if_unbound_in_map (CTRL ('O'), operate_and_get_next, emacs_standard_keymap);
rl_bind_key_if_unbound_in_map (CTRL ('V'), display_shell_version, emacs_ctlx_keymap);
/* In Bash, the user can switch editing modes with "set -o [vi emacs]",
so it is not necessary to allow C-M-j for context switching. Turn
off this occasionally confusing behaviour. */
kseq[0] = CTRL('J');
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
if (func == rl_vi_editing_mode)
rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
kseq[0] = CTRL('M');
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
if (func == rl_vi_editing_mode)
rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
#if defined (VI_MODE)
kseq[0] = CTRL('E');
func = rl_function_of_keyseq (kseq, vi_movement_keymap, (int *)NULL);
if (func == rl_emacs_editing_mode)
rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
#endif
#if defined (BRACE_COMPLETION)
rl_bind_key_if_unbound_in_map ('{', bash_brace_completion, emacs_meta_keymap); /*}*/
#endif /* BRACE_COMPLETION */
#if defined (SPECIFIC_COMPLETION_FUNCTIONS)
rl_bind_key_if_unbound_in_map ('/', bash_complete_filename, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('/', bash_possible_filename_completions, emacs_ctlx_keymap);
/* Have to jump through hoops here because there is a default binding for
M-~ (rl_tilde_expand) */
kseq[0] = '~';
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
if (func == 0 || func == rl_tilde_expand)
rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('@', bash_complete_hostname, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('@', bash_possible_hostname_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('$', bash_complete_variable, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('$', bash_possible_variable_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('!', bash_complete_command, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('!', bash_possible_command_completions, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('g', bash_glob_complete_word, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map ('*', bash_glob_expand_word, emacs_ctlx_keymap);
rl_bind_key_if_unbound_in_map ('g', bash_glob_list_expansions, emacs_ctlx_keymap);
#endif /* SPECIFIC_COMPLETION_FUNCTIONS */
kseq[0] = TAB;
kseq[1] = '\0';
func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
if (func == 0 || func == rl_tab_insert)
rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = attempt_shell_completion;
/* Tell the completer that we might want to follow symbolic links or
do other expansion on directory names. */
set_directory_hook ();
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
rl_filename_stat_hook = bash_filename_stat_hook;
/* Tell the filename completer we want a chance to ignore some names. */
rl_ignore_some_completions_function = filename_completion_ignore;
/* Bind C-xC-e to invoke emacs and run result as commands. */
rl_bind_key_if_unbound_in_map (CTRL ('E'), emacs_edit_and_execute_command, emacs_ctlx_keymap);
#if defined (VI_MODE)
rl_bind_key_if_unbound_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap);
# if defined (ALIAS)
rl_bind_key_if_unbound_in_map ('@', posix_edit_macros, vi_movement_keymap);
# endif
rl_bind_key_in_map ('\\', bash_vi_complete, vi_movement_keymap);
rl_bind_key_in_map ('*', bash_vi_complete, vi_movement_keymap);
rl_bind_key_in_map ('=', bash_vi_complete, vi_movement_keymap);
#endif
rl_completer_quote_characters = "'\"";
/* This sets rl_completer_word_break_characters and rl_special_prefixes
to the appropriate values, depending on whether or not hostname
completion is enabled. */
enable_hostname_completion (perform_hostname_completion);
/* characters that need to be quoted when appearing in filenames. */
rl_filename_quote_characters = default_filename_quote_characters;
set_filename_bstab (rl_filename_quote_characters);
rl_filename_quoting_function = bash_quote_filename;
rl_filename_dequoting_function = bash_dequote_filename;
rl_char_is_quoted_p = char_is_quoted;
/* Add some default bindings for the "shellwords" functions, roughly
parallelling the default word bindings in emacs mode. */
rl_bind_key_if_unbound_in_map (CTRL('B'), bash_backward_shellword, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map (CTRL('D'), bash_kill_shellword, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map (CTRL('F'), bash_forward_shellword, emacs_meta_keymap);
rl_bind_key_if_unbound_in_map (CTRL('T'), bash_transpose_shellwords, emacs_meta_keymap);
#if 0
/* This is superfluous and makes it impossible to use tab completion in
vi mode even when explicitly binding it in ~/.inputrc. sv_strict_posix()
should already have called posix_readline_initialize() when
posixly_correct was set. */
if (posixly_correct)
posix_readline_initialize (1);
#endif
bash_readline_initialized = 1;
}
| 0
|
512,821
|
void Item_func_like::turboBM_compute_good_suffix_shifts(int *suff)
{
turboBM_compute_suffixes(suff);
int *end = bmGs + pattern_len;
int *k;
for (k = bmGs; k < end; k++)
*k = pattern_len;
int tmp;
int i;
int j = 0;
const int plm1 = pattern_len - 1;
for (i = plm1; i > -1; i--)
{
if (suff[i] == i + 1)
{
for (tmp = plm1 - i; j < tmp; j++)
{
int *tmp2 = bmGs + j;
if (*tmp2 == pattern_len)
*tmp2 = tmp;
}
}
}
int *tmp2;
for (tmp = plm1 - i; j < tmp; j++)
{
tmp2 = bmGs + j;
if (*tmp2 == pattern_len)
*tmp2 = tmp;
}
tmp2 = bmGs + plm1;
for (i = 0; i <= pattern_len - 2; i++)
*(tmp2 - suff[i]) = plm1 - i;
}
| 0
|
462,419
|
closeSess(ptcpsess_t *pSess)
{
int sock;
DEFiRet;
if(pSess->compressionMode >= COMPRESS_STREAM_ALWAYS)
doZipFinish(pSess);
sock = pSess->sock;
CHKiRet(removeEPollSock(sock, pSess->epd));
close(sock);
pthread_mutex_lock(&pSess->pLstn->pSrv->mutSessLst);
/* finally unlink session from structures */
if(pSess->next != NULL)
pSess->next->prev = pSess->prev;
if(pSess->prev == NULL) {
/* need to update root! */
pSess->pLstn->pSrv->pSess = pSess->next;
} else {
pSess->prev->next = pSess->next;
}
pthread_mutex_unlock(&pSess->pLstn->pSrv->mutSessLst);
/* unlinked, now remove structure */
destructSess(pSess);
finalize_it:
DBGPRINTF("imptcp: session on socket %d closed with iRet %d.\n", sock, iRet);
RETiRet;
}
| 0
|
245,158
|
lock_tables_maybe(MYSQL *connection, int timeout, int retry_count)
{
if (tables_locked || opt_lock_ddl_per_table) {
return(true);
}
if (have_backup_locks) {
return lock_tables_for_backup(connection, timeout, retry_count);
}
if (have_lock_wait_timeout) {
char query[200];
ut_snprintf(query, sizeof(query),
"SET SESSION lock_wait_timeout=%d", timeout);
xb_mysql_query(connection, query, false);
}
if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) {
/* We do first a FLUSH TABLES. If a long update is running, the
FLUSH TABLES will wait but will not stall the whole mysqld, and
when the long update is done the FLUSH TABLES WITH READ LOCK
will start and succeed quickly. So, FLUSH TABLES is to lower
the probability of a stage where both mysqldump and most client
connections are stalled. Of course, if a second long update
starts between the two FLUSHes, we have that bad stall.
Option lock_wait_timeout serve the same purpose and is not
compatible with this trick.
*/
msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n");
xb_mysql_query(connection,
"FLUSH NO_WRITE_TO_BINLOG TABLES", false);
}
if (opt_lock_wait_timeout) {
if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
opt_lock_wait_threshold)) {
return(false);
}
}
msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n");
if (opt_kill_long_queries_timeout) {
start_query_killer();
}
if (have_galera_enabled) {
xb_mysql_query(connection,
"SET SESSION wsrep_causal_reads=0", false);
}
xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false);
if (opt_kill_long_queries_timeout) {
stop_query_killer();
}
tables_locked = true;
return(true);
}
| 0
|
301,498
|
score_comp_sal(suginfo_T *su)
{
langp_T *lp;
char_u badsound[MAXWLEN];
int i;
suggest_T *stp;
suggest_T *sstp;
int score;
int lpi;
if (ga_grow(&su->su_sga, su->su_ga.ga_len) == FAIL)
return;
// Use the sound-folding of the first language that supports it.
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
if (lp->lp_slang->sl_sal.ga_len > 0)
{
// soundfold the bad word
spell_soundfold(lp->lp_slang, su->su_fbadword, TRUE, badsound);
for (i = 0; i < su->su_ga.ga_len; ++i)
{
stp = &SUG(su->su_ga, i);
// Case-fold the suggested word, sound-fold it and compute the
// sound-a-like score.
score = stp_sal_score(stp, su, lp->lp_slang, badsound);
if (score < SCORE_MAXMAX)
{
// Add the suggestion.
sstp = &SUG(su->su_sga, su->su_sga.ga_len);
sstp->st_word = vim_strsave(stp->st_word);
if (sstp->st_word != NULL)
{
sstp->st_wordlen = stp->st_wordlen;
sstp->st_score = score;
sstp->st_altscore = 0;
sstp->st_orglen = stp->st_orglen;
++su->su_sga.ga_len;
}
}
}
break;
}
}
}
| 0
|
432,171
|
static inline uint64_t memory_region_shift_write_access(uint64_t *value,
signed shift,
uint64_t mask)
{
uint64_t tmp;
if (shift >= 0) {
tmp = (*value >> shift) & mask;
} else {
tmp = (*value << -shift) & mask;
}
return tmp;
}
| 0
|
346,438
|
source_callback(char_u *fname, void *cookie)
{
(void)do_source(fname, FALSE, DOSO_NONE, cookie);
}
| 0
|
90,811
|
UpdateModifiedTimeTask(
QuotaManager* manager,
const GURL& origin,
StorageType type,
base::Time modified_time)
: DatabaseTaskBase(manager),
origin_(origin),
type_(type),
modified_time_(modified_time) {}
| 0
|
440,902
|
VAuditF(const char *f, va_list args)
{
char *prefix;
char buf[1024];
int len;
static char oldbuf[1024];
prefix = AuditPrefix();
len = vsnprintf(buf, sizeof(buf), f, args);
if (len == oldlen && strcmp(buf, oldbuf) == 0) {
/* Message already seen */
nrepeat++;
}
else {
/* new message */
if (auditTimer != NULL)
TimerForce(auditTimer);
ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
strlcpy(oldbuf, buf, sizeof(oldbuf));
oldlen = len;
nrepeat = 0;
auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
}
free(prefix);
}
| 0
|
249,981
|
GF_Err WriteSample(MovieWriter *mw, u32 size, u64 offset, u8 isEdited, GF_BitStream *bs, u32 nb_samp)
{
GF_DataMap *map;
u32 bytes;
if (!size) return GF_OK;
if (size>mw->alloc_size) {
mw->buffer = (char*)gf_realloc(mw->buffer, size);
mw->alloc_size = size;
}
if (!mw->buffer) return GF_OUT_OF_MEM;
if (isEdited) {
map = mw->movie->editFileMap;
} else {
map = mw->movie->movieFileMap;
}
//get the payload...
bytes = gf_isom_datamap_get_data(map, mw->buffer, size, offset);
if (bytes != size)
return GF_IO_ERR;
//write it to our stream...
bytes = gf_bs_write_data(bs, mw->buffer, size);
if (bytes != size)
return GF_IO_ERR;
mw->nb_done+=nb_samp;
muxer_report_progress(mw);
return GF_OK;
}
| 0
|
246,685
|
u32 parse_dsap(char *arg_val, u32 opt)
{
dump_saps = atoi(arg_val);
dump_saps_mode = opt;
return 0;
}
| 0
|
310,047
|
_nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b)
{
int result = ERR;
int maxcolors;
T((T_CALLED("color_content(%p,%d,%p,%p,%p)"),
(void *) sp,
color,
(void *) r,
(void *) g,
(void *) b));
if (sp == 0)
returnCode(result);
maxcolors = MaxColors;
if (color < 0 || !OkColorHi(color) || !sp->_coloron) {
result = ERR;
} else {
int c_r, c_g, c_b;
if (sp->_direct_color.value) {
rgb_bits_t *work = &(sp->_direct_color);
#define max_direct_color(name) ((1 << work->bits.name) - 1)
#define value_direct_color(max) (1000 * ((color >> bitoff) & max)) / max
int max_r = max_direct_color(red);
int max_g = max_direct_color(green);
int max_b = max_direct_color(blue);
int bitoff = 0;
c_b = value_direct_color(max_b);
bitoff += work->bits.blue;
c_g = value_direct_color(max_g);
bitoff += work->bits.green;
c_r = value_direct_color(max_r);
} else {
c_r = sp->_color_table[color].red;
c_g = sp->_color_table[color].green;
c_b = sp->_color_table[color].blue;
}
if (r)
*r = c_r;
if (g)
*g = c_g;
if (b)
*b = c_b;
TR(TRACE_ATTRS, ("...color_content(%d,%d,%d,%d)",
color, c_r, c_g, c_b));
result = OK;
}
returnCode(result);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.