idx
int64 | func
string | target
int64 |
|---|---|---|
512,794
|
bool is_null() const { return m_type == DYN_COL_NULL; }
| 0
|
234,210
|
try_build_id_prefix (const char * prefix, char * filename, const unsigned char * data, unsigned long id_len)
{
char * f = filename;
f += sprintf (f, "%s.build-id/%02x/", prefix, (unsigned) *data++);
id_len --;
while (id_len --)
f += sprintf (f, "%02x", (unsigned) *data++);
strcpy (f, ".debug");
return open_debug_file (filename);
}
| 0
|
261,996
|
static void bundle_destroy(struct connectbundle *bundle)
{
if(!bundle)
return;
Curl_llist_destroy(&bundle->conn_list, NULL);
free(bundle);
}
| 0
|
450,412
|
static int vnc_display_listen(VncDisplay *vd,
SocketAddress **saddr,
size_t nsaddr,
SocketAddress **wsaddr,
size_t nwsaddr,
Error **errp)
{
size_t i;
if (nsaddr) {
vd->listener = qio_net_listener_new();
qio_net_listener_set_name(vd->listener, "vnc-listen");
for (i = 0; i < nsaddr; i++) {
if (qio_net_listener_open_sync(vd->listener,
saddr[i], 1,
errp) < 0) {
return -1;
}
}
qio_net_listener_set_client_func(vd->listener,
vnc_listen_io, vd, NULL);
}
if (nwsaddr) {
vd->wslistener = qio_net_listener_new();
qio_net_listener_set_name(vd->wslistener, "vnc-ws-listen");
for (i = 0; i < nwsaddr; i++) {
if (qio_net_listener_open_sync(vd->wslistener,
wsaddr[i], 1,
errp) < 0) {
return -1;
}
}
qio_net_listener_set_client_func(vd->wslistener,
vnc_listen_io, vd, NULL);
}
return 0;
}
| 0
|
247,553
|
TEST_P(SslSocketTest, GetPeerCertChain) {
const std::string client_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_chain.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_key.pem"
)EOF";
const std::string server_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"
validation_context:
trusted_ca:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
require_client_certificate: true
)EOF";
TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam());
std::string expected_peer_cert_chain =
TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(
"{{ test_rundir "
"}}/test/extensions/transport_sockets/tls/test_data/no_san_chain.pem"));
testUtil(test_options.setExpectedSerialNumber(TEST_NO_SAN_CERT_SERIAL)
.setExpectedPeerCertChain(expected_peer_cert_chain));
}
| 0
|
385,872
|
static int check_acl(struct inode *inode, int mask)
{
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *acl;
if (mask & MAY_NOT_BLOCK) {
acl = get_cached_acl_rcu(inode, ACL_TYPE_ACCESS);
if (!acl)
return -EAGAIN;
/* no ->get_acl() calls in RCU mode... */
if (acl == ACL_NOT_CACHED)
return -ECHILD;
return posix_acl_permission(inode, acl, mask & ~MAY_NOT_BLOCK);
}
acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
/*
* A filesystem can force a ACL callback by just never filling the
* ACL cache. But normally you'd fill the cache either at inode
* instantiation time, or on the first ->get_acl call.
*
* If the filesystem doesn't have a get_acl() function at all, we'll
* just create the negative cache entry.
*/
if (acl == ACL_NOT_CACHED) {
if (inode->i_op->get_acl) {
acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR(acl))
return PTR_ERR(acl);
} else {
set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
return -EAGAIN;
}
}
if (acl) {
int error = posix_acl_permission(inode, acl, mask);
posix_acl_release(acl);
return error;
}
#endif
return -EAGAIN;
}
| 0
|
328,881
|
R_API void r_bin_java_print_bootstrap_method_argument_summary(RBinJavaBootStrapArgument *bsm_arg) {
if (!bsm_arg) {
eprintf ("Attempting to print an invalid RBinJavaBootStrapArgument *.\n");
return;
}
eprintf ("Bootstrap Method Argument Information:\n");
eprintf (" Offset: 0x%08"PFMT64x"", bsm_arg->file_offset);
eprintf (" Name_And_Type Index = (0x%02x)\n", bsm_arg->argument_info_idx);
if (bsm_arg->argument_info_cp_obj) {
eprintf (" Bootstrap Method Argument Type and Name Info:\n");
((RBinJavaCPTypeMetas *) bsm_arg->argument_info_cp_obj)->allocs->print_summary (bsm_arg->argument_info_cp_obj);
} else {
eprintf (" Bootstrap Method Argument Type and Name Info: INVALID\n");
}
}
| 0
|
427,791
|
static bool cmd_allowed_from_miror(u32 cmd_id)
{
/*
* Allow mirrors VM to call KVM_SEV_LAUNCH_UPDATE_VMSA to enable SEV-ES
* active mirror VMs. Also allow the debugging and status commands.
*/
if (cmd_id == KVM_SEV_LAUNCH_UPDATE_VMSA ||
cmd_id == KVM_SEV_GUEST_STATUS || cmd_id == KVM_SEV_DBG_DECRYPT ||
cmd_id == KVM_SEV_DBG_ENCRYPT)
return true;
return false;
}
| 0
|
225,655
|
GF_Err tssy_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TimeStampSynchronyBox *ptr = (GF_TimeStampSynchronyBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_int(bs, 0, 6);
gf_bs_write_int(bs, ptr->timestamp_sync, 2);
return GF_OK;
}
| 0
|
336,641
|
void reds_client_disconnect(RedsState *reds, RedClient *client)
{
RedsMigTargetClient *mig_client;
if (reds->config->exit_on_disconnect)
{
spice_debug("Exiting server because of client disconnect.");
exit(0);
}
if (!client || client->is_disconnecting()) {
spice_debug("client %p already during disconnection", client);
return;
}
spice_debug("trace");
/* disconnecting is set to prevent recursion because of the following:
* main_channel_client_on_disconnect->
* reds_client_disconnect->red_client_destroy->main_channel...
*/
client->set_disconnecting();
// TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how?)
// We shouldn't initialize the agent when there are still clients connected
mig_client = reds_mig_target_client_find(reds, client);
if (mig_client) {
reds_mig_target_client_free(reds, mig_client);
}
if (reds->mig_wait_disconnect) {
reds_mig_remove_wait_disconnect_client(reds, client);
}
/* note that client might be NULL, if the vdagent was once
* up and than was removed */
RedCharDeviceClientOpaque *client_opaque = (RedCharDeviceClientOpaque *) client;
if (reds->agent_dev->client_exists(client_opaque)) {
reds->agent_dev->client_remove(client_opaque);
}
reds->clients.remove(client);
client->destroy();
// TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how? Maybe throw away messages
// if we are in the middle of one from another client)
if (reds->clients.empty()) {
/* Let the agent know the client is disconnected */
if (reds->agent_dev->priv->agent_attached) {
RedCharDeviceWriteBuffer *char_dev_buf =
vdagent_new_write_buffer(reds->agent_dev.get(),
VD_AGENT_CLIENT_DISCONNECTED,
0,
false);
reds->agent_dev->write_buffer_add(char_dev_buf);
}
/* Reset write filter to start with clean state on client reconnect */
agent_msg_filter_init(&reds->agent_dev->priv->write_filter, reds->config->agent_copypaste,
reds->config->agent_file_xfer,
reds_use_client_monitors_config(reds), TRUE);
/* Throw away pending chunks from the current (if any) and future
* messages read from the agent */
reds->agent_dev->priv->read_filter.result = AGENT_MSG_FILTER_DISCARD;
reds->agent_dev->priv->read_filter.discard_all = TRUE;
g_free(reds->agent_dev->priv->mig_data);
reds->agent_dev->priv->mig_data = NULL;
reds_mig_cleanup(reds);
}
}
| 0
|
500,670
|
static sftp_statvfs_t sftp_parse_statvfs(sftp_session sftp, ssh_buffer buf) {
sftp_statvfs_t statvfs;
uint64_t tmp;
int ok = 0;
statvfs = malloc(sizeof(struct sftp_statvfs_struct));
if (statvfs == NULL) {
ssh_set_error_oom(sftp->session);
return NULL;
}
ZERO_STRUCTP(statvfs);
/* try .. catch */
do {
/* file system block size */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_bsize = ntohll(tmp);
/* fundamental fs block size */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_frsize = ntohll(tmp);
/* number of blocks (unit f_frsize) */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_blocks = ntohll(tmp);
/* free blocks in file system */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_bfree = ntohll(tmp);
/* free blocks for non-root */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_bavail = ntohll(tmp);
/* total file inodes */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_files = ntohll(tmp);
/* free file inodes */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_ffree = ntohll(tmp);
/* free file inodes for to non-root */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_favail = ntohll(tmp);
/* file system id */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_fsid = ntohll(tmp);
/* bit mask of f_flag values */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_flag = ntohll(tmp);
/* maximum filename length */
if (buffer_get_u64(buf, &tmp) != sizeof(uint64_t)) {
break;
}
statvfs->f_namemax = ntohll(tmp);
ok = 1;
} while(0);
if (!ok) {
SAFE_FREE(statvfs);
ssh_set_error(sftp->session, SSH_FATAL, "Invalid statvfs structure");
return NULL;
}
return statvfs;
}
| 0
|
438,652
|
u_undoredo(int undo)
{
undoline_T *newarray = NULL;
linenr_T oldsize;
linenr_T newsize;
linenr_T top, bot;
linenr_T lnum;
linenr_T newlnum = MAXLNUM;
pos_T new_curpos = curwin->w_cursor;
long i;
u_entry_T *uep, *nuep;
u_entry_T *newlist = NULL;
int old_flags;
int new_flags;
pos_T namedm[NMARKS];
visualinfo_T visualinfo;
int empty_buffer; // buffer became empty
u_header_T *curhead = curbuf->b_u_curhead;
// Don't want autocommands using the undo structures here, they are
// invalid till the end.
block_autocmds();
#ifdef U_DEBUG
u_check(FALSE);
#endif
old_flags = curhead->uh_flags;
new_flags = (curbuf->b_changed ? UH_CHANGED : 0) +
((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0);
setpcmark();
/*
* save marks before undo/redo
*/
mch_memmove(namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
visualinfo = curbuf->b_visual;
curbuf->b_op_start.lnum = curbuf->b_ml.ml_line_count;
curbuf->b_op_start.col = 0;
curbuf->b_op_end.lnum = 0;
curbuf->b_op_end.col = 0;
for (uep = curhead->uh_entry; uep != NULL; uep = nuep)
{
top = uep->ue_top;
bot = uep->ue_bot;
if (bot == 0)
bot = curbuf->b_ml.ml_line_count + 1;
if (top > curbuf->b_ml.ml_line_count || top >= bot
|| bot > curbuf->b_ml.ml_line_count + 1)
{
unblock_autocmds();
iemsg(_(e_u_undo_line_numbers_wrong));
changed(); // don't want UNCHANGED now
return;
}
oldsize = bot - top - 1; // number of lines before undo
newsize = uep->ue_size; // number of lines after undo
// Decide about the cursor position, depending on what text changed.
// Don't set it yet, it may be invalid if lines are going to be added.
if (top < newlnum)
{
// If the saved cursor is somewhere in this undo block, move it to
// the remembered position. Makes "gwap" put the cursor back
// where it was.
lnum = curhead->uh_cursor.lnum;
if (lnum >= top && lnum <= top + newsize + 1)
{
new_curpos = curhead->uh_cursor;
newlnum = new_curpos.lnum - 1;
}
else
{
// Use the first line that actually changed. Avoids that
// undoing auto-formatting puts the cursor in the previous
// line.
for (i = 0; i < newsize && i < oldsize; ++i)
{
char_u *p = ml_get(top + 1 + i);
if (curbuf->b_ml.ml_line_len != uep->ue_array[i].ul_len
|| memcmp(uep->ue_array[i].ul_line, p,
curbuf->b_ml.ml_line_len) != 0)
break;
}
if (i == newsize && newlnum == MAXLNUM && uep->ue_next == NULL)
{
newlnum = top;
new_curpos.lnum = newlnum + 1;
}
else if (i < newsize)
{
newlnum = top + i;
new_curpos.lnum = newlnum + 1;
}
}
}
empty_buffer = FALSE;
/*
* Delete the lines between top and bot and save them in newarray.
*/
if (oldsize > 0)
{
if ((newarray = U_ALLOC_LINE(sizeof(undoline_T) * oldsize)) == NULL)
{
do_outofmem_msg((long_u)(sizeof(undoline_T) * oldsize));
// We have messed up the entry list, repair is impossible.
// we have to free the rest of the list.
while (uep != NULL)
{
nuep = uep->ue_next;
u_freeentry(uep, uep->ue_size);
uep = nuep;
}
break;
}
// delete backwards, it goes faster in most cases
for (lnum = bot - 1, i = oldsize; --i >= 0; --lnum)
{
// what can we do when we run out of memory?
if (u_save_line(&newarray[i], lnum) == FAIL)
do_outofmem_msg((long_u)0);
// remember we deleted the last line in the buffer, and a
// dummy empty line will be inserted
if (curbuf->b_ml.ml_line_count == 1)
empty_buffer = TRUE;
ml_delete_flags(lnum, ML_DEL_UNDO);
}
}
else
newarray = NULL;
// make sure the cursor is on a valid line after the deletions
check_cursor_lnum();
/*
* Insert the lines in u_array between top and bot.
*/
if (newsize)
{
for (lnum = top, i = 0; i < newsize; ++i, ++lnum)
{
// If the file is empty, there is an empty line 1 that we
// should get rid of, by replacing it with the new line.
if (empty_buffer && lnum == 0)
ml_replace_len((linenr_T)1, uep->ue_array[i].ul_line,
uep->ue_array[i].ul_len, TRUE, TRUE);
else
ml_append_flags(lnum, uep->ue_array[i].ul_line,
(colnr_T)uep->ue_array[i].ul_len, ML_APPEND_UNDO);
vim_free(uep->ue_array[i].ul_line);
}
vim_free((char_u *)uep->ue_array);
}
// adjust marks
if (oldsize != newsize)
{
mark_adjust(top + 1, top + oldsize, (long)MAXLNUM,
(long)newsize - (long)oldsize);
if (curbuf->b_op_start.lnum > top + oldsize)
curbuf->b_op_start.lnum += newsize - oldsize;
if (curbuf->b_op_end.lnum > top + oldsize)
curbuf->b_op_end.lnum += newsize - oldsize;
}
changed_lines(top + 1, 0, bot, newsize - oldsize);
// set '[ and '] mark
if (top + 1 < curbuf->b_op_start.lnum)
curbuf->b_op_start.lnum = top + 1;
if (newsize == 0 && top + 1 > curbuf->b_op_end.lnum)
curbuf->b_op_end.lnum = top + 1;
else if (top + newsize > curbuf->b_op_end.lnum)
curbuf->b_op_end.lnum = top + newsize;
u_newcount += newsize;
u_oldcount += oldsize;
uep->ue_size = oldsize;
uep->ue_array = newarray;
uep->ue_bot = top + newsize + 1;
/*
* insert this entry in front of the new entry list
*/
nuep = uep->ue_next;
uep->ue_next = newlist;
newlist = uep;
}
// Set the cursor to the desired position. Check that the line is valid.
curwin->w_cursor = new_curpos;
check_cursor_lnum();
curhead->uh_entry = newlist;
curhead->uh_flags = new_flags;
if ((old_flags & UH_EMPTYBUF) && BUFEMPTY())
curbuf->b_ml.ml_flags |= ML_EMPTY;
if (old_flags & UH_CHANGED)
changed();
else
#ifdef FEAT_NETBEANS_INTG
// per netbeans undo rules, keep it as modified
if (!isNetbeansModified(curbuf))
#endif
unchanged(curbuf, FALSE, TRUE);
/*
* restore marks from before undo/redo
*/
for (i = 0; i < NMARKS; ++i)
{
if (curhead->uh_namedm[i].lnum != 0)
curbuf->b_namedm[i] = curhead->uh_namedm[i];
if (namedm[i].lnum != 0)
curhead->uh_namedm[i] = namedm[i];
else
curhead->uh_namedm[i].lnum = 0;
}
if (curhead->uh_visual.vi_start.lnum != 0)
{
curbuf->b_visual = curhead->uh_visual;
curhead->uh_visual = visualinfo;
}
/*
* If the cursor is only off by one line, put it at the same position as
* before starting the change (for the "o" command).
* Otherwise the cursor should go to the first undone line.
*/
if (curhead->uh_cursor.lnum + 1 == curwin->w_cursor.lnum
&& curwin->w_cursor.lnum > 1)
--curwin->w_cursor.lnum;
if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count)
{
if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum)
{
curwin->w_cursor.col = curhead->uh_cursor.col;
if (virtual_active() && curhead->uh_cursor_vcol >= 0)
coladvance((colnr_T)curhead->uh_cursor_vcol);
else
curwin->w_cursor.coladd = 0;
}
else
beginline(BL_SOL | BL_FIX);
}
else
{
// We get here with the current cursor line being past the end (eg
// after adding lines at the end of the file, and then undoing it).
// check_cursor() will move the cursor to the last line. Move it to
// the first column here.
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
}
// Make sure the cursor is on an existing line and column.
check_cursor();
// Remember where we are for "g-" and ":earlier 10s".
curbuf->b_u_seq_cur = curhead->uh_seq;
if (undo)
{
// We are below the previous undo. However, to make ":earlier 1s"
// work we compute this as being just above the just undone change.
if (curhead->uh_next.ptr != NULL)
curbuf->b_u_seq_cur = curhead->uh_next.ptr->uh_seq;
else
curbuf->b_u_seq_cur = 0;
}
// Remember where we are for ":earlier 1f" and ":later 1f".
if (curhead->uh_save_nr != 0)
{
if (undo)
curbuf->b_u_save_nr_cur = curhead->uh_save_nr - 1;
else
curbuf->b_u_save_nr_cur = curhead->uh_save_nr;
}
// The timestamp can be the same for multiple changes, just use the one of
// the undone/redone change.
curbuf->b_u_time_cur = curhead->uh_time;
unblock_autocmds();
#ifdef U_DEBUG
u_check(FALSE);
#endif
}
| 0
|
313,832
|
checkclearopq(oparg_T *oap)
{
if (oap->op_type == OP_NOP && !VIsual_active)
return FALSE;
clearopbeep(oap);
return TRUE;
}
| 0
|
413,595
|
R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode) {
ut8 *buf = (ut8 *)malloc (core->blocksize);
if (!buf) {
return -1;
}
int ptrdepth = r_config_get_i (core->config, "anal.ptrdepth");
int i, count = 0;
RAnalOp op = R_EMPTY;
ut64 at;
char bckwrds, do_bckwrd_srch;
int arch = -1;
if (core->rasm->bits == 64) {
// speedup search
if (!strncmp (core->rasm->cur->name, "arm", 3)) {
arch = R2_ARCH_ARM64;
}
}
// TODO: get current section range here or gtfo
// ???
// XXX must read bytes correctly
do_bckwrd_srch = bckwrds = core->search->bckwrds;
if (!ref) {
eprintf ("Null reference search is not supported\n");
free (buf);
return -1;
}
r_cons_break_push (NULL, NULL);
if (core->blocksize > OPSZ) {
if (bckwrds) {
if (from + core->blocksize > to) {
at = from;
do_bckwrd_srch = false;
} else {
at = to - core->blocksize;
}
} else {
at = from;
}
while ((!bckwrds && at < to) || bckwrds) {
eprintf ("\r[0x%08"PFMT64x"-0x%08"PFMT64x"] ", at, to);
if (r_cons_is_breaked ()) {
break;
}
// TODO: this can be probably enhanced
if (!r_io_read_at (core->io, at, buf, core->blocksize)) {
eprintf ("Failed to read at 0x%08" PFMT64x "\n", at);
break;
}
for (i = bckwrds ? (core->blocksize - OPSZ - 1) : 0;
(!bckwrds && i < core->blocksize - OPSZ) ||
(bckwrds && i > 0);
bckwrds ? i-- : i++) {
// TODO: honor anal.align
if (r_cons_is_breaked ()) {
break;
}
switch (mode) {
case 'c':
(void)opiscall (core, &op, at + i, buf + i, core->blocksize - i, arch);
if (op.size < 1) {
op.size = 1;
}
break;
case 'r':
case 'w':
case 'x':
{
r_anal_op (core->anal, &op, at + i, buf + i, core->blocksize - i, R_ANAL_OP_MASK_BASIC);
int mask = mode=='r' ? 1 : mode == 'w' ? 2: mode == 'x' ? 4: 0;
if (op.direction == mask) {
i += op.size;
}
r_anal_op_fini (&op);
continue;
}
break;
default:
if (!r_anal_op (core->anal, &op, at + i, buf + i, core->blocksize - i, R_ANAL_OP_MASK_BASIC)) {
r_anal_op_fini (&op);
continue;
}
}
switch (op.type) {
case R_ANAL_OP_TYPE_JMP:
case R_ANAL_OP_TYPE_CJMP:
case R_ANAL_OP_TYPE_CALL:
case R_ANAL_OP_TYPE_CCALL:
if (op.jump != UT64_MAX &&
core_anal_followptr (core, 'C', at + i, op.jump, ref, true, 0)) {
count ++;
}
break;
case R_ANAL_OP_TYPE_UCJMP:
case R_ANAL_OP_TYPE_UJMP:
case R_ANAL_OP_TYPE_IJMP:
case R_ANAL_OP_TYPE_RJMP:
case R_ANAL_OP_TYPE_IRJMP:
case R_ANAL_OP_TYPE_MJMP:
if (op.ptr != UT64_MAX &&
core_anal_followptr (core, 'c', at + i, op.ptr, ref, true ,1)) {
count ++;
}
break;
case R_ANAL_OP_TYPE_UCALL:
case R_ANAL_OP_TYPE_ICALL:
case R_ANAL_OP_TYPE_RCALL:
case R_ANAL_OP_TYPE_IRCALL:
case R_ANAL_OP_TYPE_UCCALL:
if (op.ptr != UT64_MAX &&
core_anal_followptr (core, 'C', at + i, op.ptr, ref, true ,1)) {
count ++;
}
break;
default:
{
if (!r_anal_op (core->anal, &op, at + i, buf + i, core->blocksize - i, R_ANAL_OP_MASK_BASIC)) {
r_anal_op_fini (&op);
continue;
}
}
if (op.ptr != UT64_MAX &&
core_anal_followptr (core, 'd', at + i, op.ptr, ref, false, ptrdepth)) {
count ++;
}
break;
}
if (op.size < 1) {
op.size = 1;
}
i += op.size - 1;
r_anal_op_fini (&op);
}
if (bckwrds) {
if (!do_bckwrd_srch) {
break;
}
if (at > from + core->blocksize - OPSZ) {
at -= core->blocksize;
} else {
do_bckwrd_srch = false;
at = from;
}
} else {
at += core->blocksize - OPSZ;
}
}
} else {
eprintf ("error: block size too small\n");
}
r_cons_break_pop ();
free (buf);
r_anal_op_fini (&op);
return count;
}
| 0
|
225,642
|
GF_Err proj_type_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_ProjectionTypeBox *ptr = (GF_ProjectionTypeBox *)s;
if (ptr->type==GF_ISOM_BOX_TYPE_CBMP) {
ISOM_DECREASE_SIZE(ptr, 8)
ptr->layout = gf_bs_read_u32(bs);
ptr->padding = gf_bs_read_u32(bs);
}
else if (ptr->type==GF_ISOM_BOX_TYPE_EQUI) {
ISOM_DECREASE_SIZE(ptr, 16)
ptr->bounds_top = gf_bs_read_u32(bs);
ptr->bounds_bottom = gf_bs_read_u32(bs);
ptr->bounds_left = gf_bs_read_u32(bs);
ptr->bounds_right = gf_bs_read_u32(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 8)
ptr->crc = gf_bs_read_u32(bs);
ptr->encoding_4cc = gf_bs_read_u32(bs);
}
return gf_isom_box_array_read(s, bs);
| 0
|
208,506
|
tgs_build_reply(astgs_request_t priv,
hdb_entry_ex *krbtgt,
krb5_enctype krbtgt_etype,
const krb5_keyblock *replykey,
int rk_is_subkey,
krb5_ticket *ticket,
const char **e_text,
AuthorizationData **auth_data,
const struct sockaddr *from_addr)
{
krb5_context context = priv->context;
krb5_kdc_configuration *config = priv->config;
KDC_REQ *req = &priv->req;
KDC_REQ_BODY *b = &priv->req.req_body;
const char *from = priv->from;
krb5_error_code ret, ret2;
krb5_principal cp = NULL, sp = NULL, rsp = NULL, tp = NULL, dp = NULL;
krb5_principal krbtgt_out_principal = NULL;
char *spn = NULL, *cpn = NULL, *tpn = NULL, *dpn = NULL, *krbtgt_out_n = NULL;
hdb_entry_ex *server = NULL, *client = NULL, *s4u2self_impersonated_client = NULL;
HDB *clientdb, *s4u2self_impersonated_clientdb;
krb5_realm ref_realm = NULL;
EncTicketPart *tgt = &ticket->ticket;
krb5_principals spp = NULL;
const EncryptionKey *ekey;
krb5_keyblock sessionkey;
krb5_kvno kvno;
krb5_data rspac;
const char *tgt_realm = /* Realm of TGT issuer */
krb5_principal_get_realm(context, krbtgt->entry.principal);
const char *our_realm = /* Realm of this KDC */
krb5_principal_get_comp_string(context, krbtgt->entry.principal, 1);
char **capath = NULL;
size_t num_capath = 0;
hdb_entry_ex *krbtgt_out = NULL;
METHOD_DATA enc_pa_data;
PrincipalName *s;
Realm r;
EncTicketPart adtkt;
char opt_str[128];
int signedpath = 0;
Key *tkey_check;
Key *tkey_sign;
int flags = HDB_F_FOR_TGS_REQ;
memset(&sessionkey, 0, sizeof(sessionkey));
memset(&adtkt, 0, sizeof(adtkt));
krb5_data_zero(&rspac);
memset(&enc_pa_data, 0, sizeof(enc_pa_data));
s = b->sname;
r = b->realm;
/*
* The canonicalize KDC option is passed as a hint to the backend, but
* can typically be ignored. Per RFC 6806, names are not canonicalized
* in response to a TGS request (although we make an exception, see
* force-canonicalize below).
*/
if (b->kdc_options.canonicalize)
flags |= HDB_F_CANON;
if(b->kdc_options.enc_tkt_in_skey){
Ticket *t;
hdb_entry_ex *uu;
krb5_principal p;
Key *uukey;
krb5uint32 second_kvno = 0;
krb5uint32 *kvno_ptr = NULL;
if(b->additional_tickets == NULL ||
b->additional_tickets->len == 0){
ret = KRB5KDC_ERR_BADOPTION; /* ? */
kdc_log(context, config, 4,
"No second ticket present in user-to-user request");
_kdc_audit_addreason((kdc_request_t)priv,
"No second ticket present in user-to-user request");
goto out;
}
t = &b->additional_tickets->val[0];
if(!get_krbtgt_realm(&t->sname)){
kdc_log(context, config, 4,
"Additional ticket is not a ticket-granting ticket");
_kdc_audit_addreason((kdc_request_t)priv,
"Additional ticket is not a ticket-granting ticket");
ret = KRB5KDC_ERR_POLICY;
goto out;
}
_krb5_principalname2krb5_principal(context, &p, t->sname, t->realm);
ret = krb5_unparse_name(context, p, &tpn);
if (ret)
goto out;
if(t->enc_part.kvno){
second_kvno = *t->enc_part.kvno;
kvno_ptr = &second_kvno;
}
ret = _kdc_db_fetch(context, config, p,
HDB_F_GET_KRBTGT, kvno_ptr,
NULL, &uu);
krb5_free_principal(context, p);
if(ret){
if (ret == HDB_ERR_NOENTRY)
ret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
_kdc_audit_addreason((kdc_request_t)priv,
"User-to-user service principal (TGS) unknown");
goto out;
}
ret = hdb_enctype2key(context, &uu->entry, NULL,
t->enc_part.etype, &uukey);
if(ret){
_kdc_free_ent(context, uu);
ret = KRB5KDC_ERR_ETYPE_NOSUPP; /* XXX */
_kdc_audit_addreason((kdc_request_t)priv,
"User-to-user enctype not supported");
goto out;
}
ret = krb5_decrypt_ticket(context, t, &uukey->key, &adtkt, 0);
_kdc_free_ent(context, uu);
if(ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"User-to-user TGT decrypt failure");
goto out;
}
ret = verify_flags(context, config, &adtkt, tpn);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"User-to-user TGT expired or invalid");
goto out;
}
s = &adtkt.cname;
r = adtkt.crealm;
}
_krb5_principalname2krb5_principal(context, &sp, *s, r);
ret = krb5_unparse_name(context, sp, &priv->sname);
if (ret)
goto out;
spn = priv->sname;
_krb5_principalname2krb5_principal(context, &cp, tgt->cname, tgt->crealm);
ret = krb5_unparse_name(context, cp, &priv->cname);
if (ret)
goto out;
cpn = priv->cname;
unparse_flags (KDCOptions2int(b->kdc_options),
asn1_KDCOptions_units(),
opt_str, sizeof(opt_str));
if(*opt_str)
kdc_log(context, config, 4,
"TGS-REQ %s from %s for %s [%s]",
cpn, from, spn, opt_str);
else
kdc_log(context, config, 4,
"TGS-REQ %s from %s for %s", cpn, from, spn);
/*
* Fetch server
*/
server_lookup:
ret = _kdc_db_fetch(context, config, sp,
HDB_F_GET_SERVER | HDB_F_DELAY_NEW_KEYS | flags,
NULL, NULL, &server);
priv->server = server;
if (ret == HDB_ERR_NOT_FOUND_HERE) {
kdc_log(context, config, 5, "target %s does not have secrets at this KDC, need to proxy", spn);
_kdc_audit_addreason((kdc_request_t)priv, "Target not found here");
goto out;
} else if (ret == HDB_ERR_WRONG_REALM) {
free(ref_realm);
ref_realm = strdup(server->entry.principal->realm);
if (ref_realm == NULL) {
ret = krb5_enomem(context);
goto out;
}
kdc_log(context, config, 4,
"Returning a referral to realm %s for "
"server %s.",
ref_realm, spn);
krb5_free_principal(context, sp);
sp = NULL;
ret = krb5_make_principal(context, &sp, r, KRB5_TGS_NAME,
ref_realm, NULL);
if (ret)
goto out;
free(priv->sname);
priv->sname = NULL;
ret = krb5_unparse_name(context, sp, &priv->sname);
if (ret)
goto out;
spn = priv->sname;
goto server_lookup;
} else if (ret) {
const char *new_rlm, *msg;
Realm req_rlm;
krb5_realm *realms;
if ((req_rlm = get_krbtgt_realm(&sp->name)) != NULL) {
if (capath == NULL) {
/* With referalls, hierarchical capaths are always enabled */
ret2 = _krb5_find_capath(context, tgt->crealm, our_realm,
req_rlm, TRUE, &capath, &num_capath);
if (ret2) {
ret = ret2;
_kdc_audit_addreason((kdc_request_t)priv,
"No trusted path from client realm to ours");
goto out;
}
}
new_rlm = num_capath > 0 ? capath[--num_capath] : NULL;
if (new_rlm) {
kdc_log(context, config, 5, "krbtgt from %s via %s for "
"realm %s not found, trying %s", tgt->crealm,
our_realm, req_rlm, new_rlm);
free(ref_realm);
ref_realm = strdup(new_rlm);
if (ref_realm == NULL) {
ret = krb5_enomem(context);
goto out;
}
krb5_free_principal(context, sp);
sp = NULL;
krb5_make_principal(context, &sp, r,
KRB5_TGS_NAME, ref_realm, NULL);
free(priv->sname);
priv->sname = NULL;
ret = krb5_unparse_name(context, sp, &priv->sname);
if (ret)
goto out;
spn = priv->sname;
goto server_lookup;
}
} else if (need_referral(context, config, &b->kdc_options, sp, &realms)) {
if (strcmp(realms[0], sp->realm) != 0) {
kdc_log(context, config, 4,
"Returning a referral to realm %s for "
"server %s that was not found",
realms[0], spn);
krb5_free_principal(context, sp);
sp = NULL;
krb5_make_principal(context, &sp, r, KRB5_TGS_NAME,
realms[0], NULL);
free(priv->sname);
priv->sname = NULL;
ret = krb5_unparse_name(context, sp, &priv->sname);
if (ret) {
krb5_free_host_realm(context, realms);
goto out;
}
spn = priv->sname;
free(ref_realm);
ref_realm = strdup(realms[0]);
krb5_free_host_realm(context, realms);
goto server_lookup;
}
krb5_free_host_realm(context, realms);
}
msg = krb5_get_error_message(context, ret);
kdc_log(context, config, 3,
"Server not found in database: %s: %s", spn, msg);
krb5_free_error_message(context, msg);
if (ret == HDB_ERR_NOENTRY)
ret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
_kdc_audit_addreason((kdc_request_t)priv,
"Service principal unknown");
goto out;
}
/*
* RFC 6806 notes that names MUST NOT be changed in the response to
* a TGS request. Hence we ignore the setting of the canonicalize
* KDC option. However, for legacy interoperability we do allow the
* backend to override this by setting the force-canonicalize HDB
* flag in the server entry.
*/
if (server->entry.flags.force_canonicalize)
rsp = server->entry.principal;
else
rsp = sp;
/*
* Select enctype, return key and kvno.
*/
{
krb5_enctype etype;
if(b->kdc_options.enc_tkt_in_skey) {
size_t i;
ekey = &adtkt.key;
for(i = 0; i < b->etype.len; i++)
if (b->etype.val[i] == adtkt.key.keytype)
break;
if(i == b->etype.len) {
kdc_log(context, config, 4,
"Addition ticket have not matching etypes");
krb5_clear_error_message(context);
ret = KRB5KDC_ERR_ETYPE_NOSUPP;
_kdc_audit_addreason((kdc_request_t)priv,
"No matching enctypes for 2nd ticket");
goto out;
}
etype = b->etype.val[i];
kvno = 0;
} else {
Key *skey;
ret = _kdc_find_etype(priv, krb5_principal_is_krbtgt(context, sp)
? KFE_IS_TGS : 0,
b->etype.val, b->etype.len, &etype, NULL,
NULL);
if(ret) {
kdc_log(context, config, 4,
"Server (%s) has no support for etypes", spn);
_kdc_audit_addreason((kdc_request_t)priv,
"Enctype not supported");
goto out;
}
ret = _kdc_get_preferred_key(context, config, server, spn,
NULL, &skey);
if(ret) {
kdc_log(context, config, 4,
"Server (%s) has no supported etypes", spn);
_kdc_audit_addreason((kdc_request_t)priv,
"Enctype not supported");
goto out;
}
ekey = &skey->key;
kvno = server->entry.kvno;
}
ret = krb5_generate_random_keyblock(context, etype, &sessionkey);
if (ret)
goto out;
}
/*
* Check that service is in the same realm as the krbtgt. If it's
* not the same, it's someone that is using a uni-directional trust
* backward.
*/
/*
* Validate authorization data
*/
ret = hdb_enctype2key(context, &krbtgt->entry, NULL, /* XXX use the right kvno! */
krbtgt_etype, &tkey_check);
if(ret) {
kdc_log(context, config, 4,
"Failed to find key for krbtgt PAC check");
_kdc_audit_addreason((kdc_request_t)priv,
"No key for krbtgt PAC check");
goto out;
}
/*
* Now refetch the primary krbtgt, and get the current kvno (the
* sign check may have been on an old kvno, and the server may
* have been an incoming trust)
*/
ret = krb5_make_principal(context,
&krbtgt_out_principal,
our_realm,
KRB5_TGS_NAME,
our_realm,
NULL);
if (ret) {
kdc_log(context, config, 4,
"Failed to make krbtgt principal name object for "
"authz-data signatures");
goto out;
}
ret = krb5_unparse_name(context, krbtgt_out_principal, &krbtgt_out_n);
if (ret) {
kdc_log(context, config, 4,
"Failed to make krbtgt principal name object for "
"authz-data signatures");
goto out;
}
ret = _kdc_db_fetch(context, config, krbtgt_out_principal,
HDB_F_GET_KRBTGT, NULL, NULL, &krbtgt_out);
if (ret) {
char *ktpn = NULL;
ret = krb5_unparse_name(context, krbtgt->entry.principal, &ktpn);
kdc_log(context, config, 4,
"No such principal %s (needed for authz-data signature keys) "
"while processing TGS-REQ for service %s with krbtg %s",
krbtgt_out_n, spn, (ret == 0) ? ktpn : "<unknown>");
free(ktpn);
ret = KRB5KRB_AP_ERR_NOT_US;
goto out;
}
/*
* The first realm is the realm of the service, the second is
* krbtgt/<this>/@REALM component of the krbtgt DN the request was
* encrypted to. The redirection via the krbtgt_out entry allows
* the DB to possibly correct the case of the realm (Samba4 does
* this) before the strcmp()
*/
if (strcmp(krb5_principal_get_realm(context, server->entry.principal),
krb5_principal_get_realm(context, krbtgt_out->entry.principal)) != 0) {
char *ktpn;
ret = krb5_unparse_name(context, krbtgt_out->entry.principal, &ktpn);
kdc_log(context, config, 4,
"Request with wrong krbtgt: %s",
(ret == 0) ? ktpn : "<unknown>");
if(ret == 0)
free(ktpn);
ret = KRB5KRB_AP_ERR_NOT_US;
_kdc_audit_addreason((kdc_request_t)priv, "Request with wrong TGT");
goto out;
}
ret = _kdc_get_preferred_key(context, config, krbtgt_out, krbtgt_out_n,
NULL, &tkey_sign);
if (ret) {
kdc_log(context, config, 4,
"Failed to find key for krbtgt PAC signature");
_kdc_audit_addreason((kdc_request_t)priv,
"Failed to find key for krbtgt PAC signature");
goto out;
}
ret = hdb_enctype2key(context, &krbtgt_out->entry, NULL,
tkey_sign->key.keytype, &tkey_sign);
if(ret) {
kdc_log(context, config, 4,
"Failed to find key for krbtgt PAC signature");
_kdc_audit_addreason((kdc_request_t)priv,
"Failed to find key for krbtgt PAC signature");
goto out;
}
{
krb5_data verified_cas;
/*
* If the client doesn't exist in the HDB but has a TGT and it's
* obtained with PKINIT then we assume it's a synthetic client -- that
* is, a client whose name was vouched for by a CA using a PKINIT SAN,
* but which doesn't exist in the HDB proper. We'll allow such a
* client to do TGT requests even though normally we'd reject all
* clients that don't exist in the HDB.
*/
ret = krb5_ticket_get_authorization_data_type(context, ticket,
KRB5_AUTHDATA_INITIAL_VERIFIED_CAS,
&verified_cas);
if (ret == 0) {
krb5_data_free(&verified_cas);
flags |= HDB_F_SYNTHETIC_OK;
}
}
ret = _kdc_db_fetch(context, config, cp, HDB_F_GET_CLIENT | flags,
NULL, &clientdb, &client);
flags &= ~HDB_F_SYNTHETIC_OK;
priv->client = client;
if(ret == HDB_ERR_NOT_FOUND_HERE) {
/* This is OK, we are just trying to find out if they have
* been disabled or deleted in the meantime, missing secrets
* is OK */
} else if(ret){
const char *krbtgt_realm, *msg;
/*
* If the client belongs to the same realm as our krbtgt, it
* should exist in the local database.
*
*/
krbtgt_realm = krb5_principal_get_realm(context, krbtgt_out->entry.principal);
if(strcmp(krb5_principal_get_realm(context, cp), krbtgt_realm) == 0) {
if (ret == HDB_ERR_NOENTRY)
ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;
kdc_log(context, config, 4, "Client no longer in database: %s",
cpn);
_kdc_audit_addreason((kdc_request_t)priv, "Client no longer in HDB");
goto out;
}
msg = krb5_get_error_message(context, ret);
kdc_log(context, config, 4, "Client not found in database: %s", msg);
_kdc_audit_addreason((kdc_request_t)priv, "Client does not exist");
krb5_free_error_message(context, msg);
} else if (ret == 0 &&
(client->entry.flags.invalid || !client->entry.flags.client)) {
_kdc_audit_addreason((kdc_request_t)priv, "Client has invalid bit set");
kdc_log(context, config, 4, "Client has invalid bit set");
ret = KRB5KDC_ERR_POLICY;
goto out;
}
ret = check_PAC(context, config, cp, NULL,
client, server, krbtgt,
&tkey_check->key,
ekey, &tkey_sign->key,
tgt, &rspac, &signedpath);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
_kdc_audit_addreason((kdc_request_t)priv, "PAC check failed");
kdc_log(context, config, 4,
"Verify PAC failed for %s (%s) from %s with %s",
spn, cpn, from, msg);
krb5_free_error_message(context, msg);
goto out;
}
/* also check the krbtgt for signature */
ret = check_KRB5SignedPath(context,
config,
krbtgt,
cp,
tgt,
&spp,
&signedpath);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
_kdc_audit_addreason((kdc_request_t)priv, "KRB5SignedPath check failed");
kdc_log(context, config, 4,
"KRB5SignedPath check failed for %s (%s) from %s with %s",
spn, cpn, from, msg);
krb5_free_error_message(context, msg);
goto out;
}
/*
* Process request
*/
/* by default the tgt principal matches the client principal */
tp = cp;
tpn = cpn;
if (client) {
const PA_DATA *sdata;
int i = 0;
sdata = _kdc_find_padata(req, &i, KRB5_PADATA_FOR_USER);
if (sdata) {
struct astgs_request_desc imp_req;
krb5_crypto crypto;
krb5_data datack;
PA_S4U2Self self;
const char *str;
ret = decode_PA_S4U2Self(sdata->padata_value.data,
sdata->padata_value.length,
&self, NULL);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"Failed to decode PA-S4U2Self");
kdc_log(context, config, 4, "Failed to decode PA-S4U2Self");
goto out;
}
if (!krb5_checksum_is_keyed(context, self.cksum.cksumtype)) {
free_PA_S4U2Self(&self);
_kdc_audit_addreason((kdc_request_t)priv,
"PA-S4U2Self with unkeyed checksum");
kdc_log(context, config, 4, "Reject PA-S4U2Self with unkeyed checksum");
ret = KRB5KRB_AP_ERR_INAPP_CKSUM;
goto out;
}
ret = _krb5_s4u2self_to_checksumdata(context, &self, &datack);
if (ret)
goto out;
ret = krb5_crypto_init(context, &tgt->key, 0, &crypto);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
free_PA_S4U2Self(&self);
krb5_data_free(&datack);
kdc_log(context, config, 4, "krb5_crypto_init failed: %s", msg);
krb5_free_error_message(context, msg);
goto out;
}
/* Allow HMAC_MD5 checksum with any key type */
if (self.cksum.cksumtype == CKSUMTYPE_HMAC_MD5) {
struct krb5_crypto_iov iov;
unsigned char csdata[16];
Checksum cs;
cs.checksum.length = sizeof(csdata);
cs.checksum.data = &csdata;
iov.data.data = datack.data;
iov.data.length = datack.length;
iov.flags = KRB5_CRYPTO_TYPE_DATA;
ret = _krb5_HMAC_MD5_checksum(context, NULL, &crypto->key,
KRB5_KU_OTHER_CKSUM, &iov, 1,
&cs);
if (ret == 0 &&
krb5_data_ct_cmp(&cs.checksum, &self.cksum.checksum) != 0)
ret = KRB5KRB_AP_ERR_BAD_INTEGRITY;
}
else {
ret = krb5_verify_checksum(context,
crypto,
KRB5_KU_OTHER_CKSUM,
datack.data,
datack.length,
&self.cksum);
}
krb5_data_free(&datack);
krb5_crypto_destroy(context, crypto);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
free_PA_S4U2Self(&self);
_kdc_audit_addreason((kdc_request_t)priv,
"S4U2Self checksum failed");
kdc_log(context, config, 4,
"krb5_verify_checksum failed for S4U2Self: %s", msg);
krb5_free_error_message(context, msg);
goto out;
}
ret = _krb5_principalname2krb5_principal(context,
&tp,
self.name,
self.realm);
free_PA_S4U2Self(&self);
if (ret)
goto out;
ret = krb5_unparse_name(context, tp, &tpn);
if (ret)
goto out;
/*
* Note no HDB_F_SYNTHETIC_OK -- impersonating non-existent clients
* is probably not desirable!
*/
ret = _kdc_db_fetch(context, config, tp, HDB_F_GET_CLIENT | flags,
NULL, &s4u2self_impersonated_clientdb,
&s4u2self_impersonated_client);
if (ret) {
const char *msg;
/*
* If the client belongs to the same realm as our krbtgt, it
* should exist in the local database.
*
*/
if (ret == HDB_ERR_NOENTRY)
ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;
msg = krb5_get_error_message(context, ret);
_kdc_audit_addreason((kdc_request_t)priv,
"S4U2Self principal to impersonate not found");
kdc_log(context, config, 2,
"S4U2Self principal to impersonate %s not found in database: %s",
tpn, msg);
krb5_free_error_message(context, msg);
goto out;
}
/* Ignore require_pwchange and pw_end attributes (as Windows does),
* since S4U2Self is not password authentication. */
s4u2self_impersonated_client->entry.flags.require_pwchange = FALSE;
free(s4u2self_impersonated_client->entry.pw_end);
s4u2self_impersonated_client->entry.pw_end = NULL;
imp_req = *priv;
imp_req.client = s4u2self_impersonated_client;
imp_req.client_princ = tp;
ret = kdc_check_flags(&imp_req, FALSE);
if (ret)
goto out; /* kdc_check_flags() calls _kdc_audit_addreason() */
/* If we were about to put a PAC into the ticket, we better fix it to be the right PAC */
if(rspac.data) {
krb5_pac p = NULL;
krb5_data_free(&rspac);
ret = _kdc_pac_generate(context, s4u2self_impersonated_client, &p);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"KRB5SignedPath missing");
kdc_log(context, config, 4, "PAC generation failed for -- %s",
tpn);
goto out;
}
if (p != NULL) {
ret = _krb5_pac_sign(context, p, ticket->ticket.authtime,
s4u2self_impersonated_client->entry.principal,
ekey, &tkey_sign->key,
&rspac);
krb5_pac_free(context, p);
if (ret) {
kdc_log(context, config, 4, "PAC signing failed for -- %s",
tpn);
goto out;
}
}
}
/*
* Check that service doing the impersonating is
* requesting a ticket to it-self.
*/
ret = check_s4u2self(context, config, clientdb, client, sp);
if (ret) {
kdc_log(context, config, 4, "S4U2Self: %s is not allowed "
"to impersonate to service "
"(tried for user %s to service %s)",
cpn, tpn, spn);
goto out;
}
/*
* If the service isn't trusted for authentication to
* delegation or if the impersonate client is disallowed
* forwardable, remove the forwardable flag.
*/
if (client->entry.flags.trusted_for_delegation &&
s4u2self_impersonated_client->entry.flags.forwardable) {
str = "[forwardable]";
} else {
b->kdc_options.forwardable = 0;
str = "";
}
kdc_log(context, config, 4, "s4u2self %s impersonating %s to "
"service %s %s", cpn, tpn, spn, str);
}
}
/*
* Constrained delegation
*/
if (client != NULL
&& b->additional_tickets != NULL
&& b->additional_tickets->len != 0
&& b->kdc_options.cname_in_addl_tkt
&& b->kdc_options.enc_tkt_in_skey == 0)
{
int ad_signedpath = 0;
Key *clientkey;
Ticket *t;
/*
* Require that the KDC have issued the service's krbtgt (not
* self-issued ticket with kimpersonate(1).
*/
if (!signedpath) {
ret = KRB5KDC_ERR_BADOPTION;
_kdc_audit_addreason((kdc_request_t)priv, "KRB5SignedPath missing");
kdc_log(context, config, 4,
"Constrained delegation done on service ticket %s/%s",
cpn, spn);
goto out;
}
t = &b->additional_tickets->val[0];
ret = hdb_enctype2key(context, &client->entry,
hdb_kvno2keys(context, &client->entry,
t->enc_part.kvno ? * t->enc_part.kvno : 0),
t->enc_part.etype, &clientkey);
if(ret){
ret = KRB5KDC_ERR_ETYPE_NOSUPP; /* XXX */
goto out;
}
ret = krb5_decrypt_ticket(context, t, &clientkey->key, &adtkt, 0);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"Failed to decrypt constrained delegation ticket");
kdc_log(context, config, 4,
"failed to decrypt ticket for "
"constrained delegation from %s to %s ", cpn, spn);
goto out;
}
ret = _krb5_principalname2krb5_principal(context,
&tp,
adtkt.cname,
adtkt.crealm);
if (ret)
goto out;
ret = krb5_unparse_name(context, tp, &tpn);
if (ret)
goto out;
_kdc_audit_addkv((kdc_request_t)priv, 0, "impersonatee", "%s", tpn);
ret = _krb5_principalname2krb5_principal(context,
&dp,
t->sname,
t->realm);
if (ret)
goto out;
ret = krb5_unparse_name(context, dp, &dpn);
if (ret)
goto out;
/* check that ticket is valid */
if (adtkt.flags.forwardable == 0) {
_kdc_audit_addreason((kdc_request_t)priv,
"Missing forwardable flag on ticket for constrained delegation");
kdc_log(context, config, 4,
"Missing forwardable flag on ticket for "
"constrained delegation from %s (%s) as %s to %s ",
cpn, dpn, tpn, spn);
ret = KRB5KDC_ERR_BADOPTION;
goto out;
}
ret = check_constrained_delegation(context, config, clientdb,
client, server, sp);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"Constrained delegation not allowed");
kdc_log(context, config, 4,
"constrained delegation from %s (%s) as %s to %s not allowed",
cpn, dpn, tpn, spn);
goto out;
}
ret = verify_flags(context, config, &adtkt, tpn);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv,
"Constrained delegation ticket expired or invalid");
goto out;
}
krb5_data_free(&rspac);
/*
* generate the PAC for the user.
*
* TODO: pass in t->sname and t->realm and build
* a S4U_DELEGATION_INFO blob to the PAC.
*/
ret = check_PAC(context, config, tp, dp,
client, server, krbtgt,
&clientkey->key,
ekey, &tkey_sign->key,
&adtkt, &rspac, &ad_signedpath);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
_kdc_audit_addreason((kdc_request_t)priv,
"Constrained delegation ticket PAC check failed");
kdc_log(context, config, 4,
"Verify delegated PAC failed to %s for client"
"%s (%s) as %s from %s with %s",
spn, cpn, dpn, tpn, from, msg);
krb5_free_error_message(context, msg);
goto out;
}
/*
* Check that the KDC issued the user's ticket.
*/
ret = check_KRB5SignedPath(context,
config,
krbtgt,
cp,
&adtkt,
NULL,
&ad_signedpath);
if (ret) {
const char *msg = krb5_get_error_message(context, ret);
kdc_log(context, config, 4,
"KRB5SignedPath check from service %s failed "
"for delegation to %s for client %s (%s)"
"from %s failed with %s",
spn, tpn, dpn, cpn, from, msg);
krb5_free_error_message(context, msg);
_kdc_audit_addreason((kdc_request_t)priv,
"KRB5SignedPath check failed");
goto out;
}
if (!ad_signedpath) {
ret = KRB5KDC_ERR_BADOPTION;
kdc_log(context, config, 4,
"Ticket not signed with PAC nor SignedPath service %s failed "
"for delegation to %s for client %s (%s)"
"from %s",
spn, tpn, dpn, cpn, from);
_kdc_audit_addreason((kdc_request_t)priv,
"Constrained delegation ticket not signed");
goto out;
}
kdc_log(context, config, 4, "constrained delegation for %s "
"from %s (%s) to %s", tpn, cpn, dpn, spn);
}
/*
* Check flags
*/
ret = kdc_check_flags(priv, FALSE);
if(ret)
goto out;
if((b->kdc_options.validate || b->kdc_options.renew) &&
!krb5_principal_compare(context,
krbtgt->entry.principal,
server->entry.principal)){
_kdc_audit_addreason((kdc_request_t)priv, "Inconsistent request");
kdc_log(context, config, 4, "Inconsistent request.");
ret = KRB5KDC_ERR_SERVER_NOMATCH;
goto out;
}
/* check for valid set of addresses */
if (!_kdc_check_addresses(priv, tgt->caddr, from_addr)) {
if (config->check_ticket_addresses) {
ret = KRB5KRB_AP_ERR_BADADDR;
_kdc_audit_addkv((kdc_request_t)priv, 0, "wrongaddr", "yes");
kdc_log(context, config, 4, "Request from wrong address");
_kdc_audit_addreason((kdc_request_t)priv, "Request from wrong address");
goto out;
} else if (config->warn_ticket_addresses) {
_kdc_audit_addkv((kdc_request_t)priv, 0, "wrongaddr", "yes");
}
}
/* check local and per-principal anonymous ticket issuance policy */
if (is_anon_tgs_request_p(b, tgt)) {
ret = _kdc_check_anon_policy(priv);
if (ret)
goto out;
}
/*
* If this is an referral, add server referral data to the
* auth_data reply .
*/
if (ref_realm) {
PA_DATA pa;
krb5_crypto crypto;
kdc_log(context, config, 3,
"Adding server referral to %s", ref_realm);
ret = krb5_crypto_init(context, &sessionkey, 0, &crypto);
if (ret)
goto out;
ret = build_server_referral(context, config, crypto, ref_realm,
NULL, s, &pa.padata_value);
krb5_crypto_destroy(context, crypto);
if (ret) {
_kdc_audit_addreason((kdc_request_t)priv, "Referral build failed");
kdc_log(context, config, 4,
"Failed building server referral");
goto out;
}
pa.padata_type = KRB5_PADATA_SERVER_REFERRAL;
ret = add_METHOD_DATA(&enc_pa_data, &pa);
krb5_data_free(&pa.padata_value);
if (ret) {
kdc_log(context, config, 4,
"Add server referral METHOD-DATA failed");
goto out;
}
}
/*
*
*/
ret = tgs_make_reply(priv,
tp,
tgt,
replykey,
rk_is_subkey,
ekey,
&sessionkey,
kvno,
*auth_data,
server,
rsp,
client,
cp,
tgt_realm,
krbtgt_out,
tkey_sign->key.keytype,
spp,
&rspac,
&enc_pa_data);
out:
if (tpn != cpn)
free(tpn);
free(dpn);
free(krbtgt_out_n);
_krb5_free_capath(context, capath);
krb5_data_free(&rspac);
krb5_free_keyblock_contents(context, &sessionkey);
if(krbtgt_out)
_kdc_free_ent(context, krbtgt_out);
if(server)
_kdc_free_ent(context, server);
if(client)
_kdc_free_ent(context, client);
if(s4u2self_impersonated_client)
_kdc_free_ent(context, s4u2self_impersonated_client);
if (tp && tp != cp)
krb5_free_principal(context, tp);
krb5_free_principal(context, cp);
krb5_free_principal(context, dp);
krb5_free_principal(context, sp);
krb5_free_principal(context, krbtgt_out_principal);
free(ref_realm);
free_METHOD_DATA(&enc_pa_data);
free_EncTicketPart(&adtkt);
return ret;
}
| 1
|
333,085
|
log_subexpr(regsub_T *sub)
{
int j;
for (j = 0; j < sub->in_use; j++)
if (REG_MULTI)
fprintf(log_fd, "*** group %d, start: c=%d, l=%d, end: c=%d, l=%d\n",
j,
sub->list.multi[j].start_col,
(int)sub->list.multi[j].start_lnum,
sub->list.multi[j].end_col,
(int)sub->list.multi[j].end_lnum);
else
{
char *s = (char *)sub->list.line[j].start;
char *e = (char *)sub->list.line[j].end;
fprintf(log_fd, "*** group %d, start: \"%s\", end: \"%s\"\n",
j,
s == NULL ? "NULL" : s,
e == NULL ? "NULL" : e);
}
}
| 0
|
369,211
|
static void io_free_page_table(void **table, size_t size)
{
unsigned i, nr_tables = DIV_ROUND_UP(size, PAGE_SIZE);
for (i = 0; i < nr_tables; i++)
kfree(table[i]);
kfree(table);
| 0
|
294,488
|
test_unit_v2v_iter(VALUE (* conv1)(VALUE),
VALUE (* conv2)(VALUE))
{
if (!test_unit_v2v_iter2(conv1, conv2))
return 0;
if (!test_unit_v2v_iter2(conv2, conv1))
return 0;
return 1;
}
| 0
|
274,844
|
TEST(ComparisonsTest, NotEqualBroadcastTwoD) {
ComparisonOpModel model({1, 1, 2, 4}, {1, 1, 1, 4}, TensorType_INT32,
BuiltinOperator_NOT_EQUAL);
model.PopulateTensor<int>(model.input1(), {-1, 9, 7, 3, 2, 4, 2, 8});
model.PopulateTensor<int>(model.input2(), {7, 1, 2, 4});
model.Invoke();
EXPECT_THAT(model.GetOutput(),
ElementsAre(true, true, true, true, true, true, false, true));
EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 2, 4));
}
| 0
|
436,042
|
static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries)
{
unsigned int to_submit;
int ret = 0;
to_submit = io_sqring_entries(ctx);
/* if we're handling multiple rings, cap submit size for fairness */
if (cap_entries && to_submit > IORING_SQPOLL_CAP_ENTRIES_VALUE)
to_submit = IORING_SQPOLL_CAP_ENTRIES_VALUE;
if (!list_empty(&ctx->iopoll_list) || to_submit) {
unsigned nr_events = 0;
const struct cred *creds = NULL;
if (ctx->sq_creds != current_cred())
creds = override_creds(ctx->sq_creds);
mutex_lock(&ctx->uring_lock);
if (!list_empty(&ctx->iopoll_list))
io_do_iopoll(ctx, &nr_events, 0);
/*
* Don't submit if refs are dying, good for io_uring_register(),
* but also it is relied upon by io_ring_exit_work()
*/
if (to_submit && likely(!percpu_ref_is_dying(&ctx->refs)) &&
!(ctx->flags & IORING_SETUP_R_DISABLED))
ret = io_submit_sqes(ctx, to_submit);
mutex_unlock(&ctx->uring_lock);
if (to_submit && wq_has_sleeper(&ctx->sqo_sq_wait))
wake_up(&ctx->sqo_sq_wait);
if (creds)
revert_creds(creds);
}
return ret;
| 0
|
301,389
|
static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
{
#ifdef HAVE_FSYNC
int result;
START_PROFILE(syscall_fsync);
result = fsync(fsp->fh->fd);
END_PROFILE(syscall_fsync);
return result;
#else
return 0;
#endif
}
| 0
|
244,173
|
GF_Box *trik_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TrickPlayBox, GF_ISOM_BOX_TYPE_TRIK);
return (GF_Box *)tmp;
}
| 0
|
253,577
|
smb3_set_integrity(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile)
{
struct fsctl_set_integrity_information_req integr_info;
unsigned int ret_data_len;
integr_info.ChecksumAlgorithm = cpu_to_le16(CHECKSUM_TYPE_UNCHANGED);
integr_info.Flags = 0;
integr_info.Reserved = 0;
return SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
cfile->fid.volatile_fid,
FSCTL_SET_INTEGRITY_INFORMATION,
true /* is_fsctl */,
(char *)&integr_info,
sizeof(struct fsctl_set_integrity_information_req),
CIFSMaxBufSize, NULL,
&ret_data_len);
}
| 0
|
198,499
|
static int uECC_sign_with_k(const uint8_t *private_key,
const uint8_t *message_hash,
unsigned hash_size,
uECC_word_t *k,
uint8_t *signature,
uECC_Curve curve) {
uECC_word_t tmp[uECC_MAX_WORDS];
uECC_word_t s[uECC_MAX_WORDS];
uECC_word_t *k2[2] = {tmp, s};
#if uECC_VLI_NATIVE_LITTLE_ENDIAN
uECC_word_t *p = (uECC_word_t *)signature;
#else
uECC_word_t p[uECC_MAX_WORDS * 2];
#endif
uECC_word_t carry;
wordcount_t num_words = curve->num_words;
wordcount_t num_n_words = BITS_TO_WORDS(curve->num_n_bits);
bitcount_t num_n_bits = curve->num_n_bits;
/* Make sure 0 < k < curve_n */
if (uECC_vli_isZero(k, num_words) || uECC_vli_cmp(curve->n, k, num_n_words) != 1) {
return 0;
}
carry = regularize_k(k, tmp, s, curve);
EccPoint_mult(p, curve->G, k2[!carry], 0, num_n_bits + 1, curve);
if (uECC_vli_isZero(p, num_words)) {
return 0;
}
/* If an RNG function was specified, get a random number
to prevent side channel analysis of k. */
if (!g_rng_function) {
uECC_vli_clear(tmp, num_n_words);
tmp[0] = 1;
} else if (!uECC_generate_random_int(tmp, curve->n, num_n_words)) {
return 0;
}
/* Prevent side channel analysis of uECC_vli_modInv() to determine
bits of k / the private key by premultiplying by a random number */
uECC_vli_modMult(k, k, tmp, curve->n, num_n_words); /* k' = rand * k */
uECC_vli_modInv(k, k, curve->n, num_n_words); /* k = 1 / k' */
uECC_vli_modMult(k, k, tmp, curve->n, num_n_words); /* k = 1 / k */
#if uECC_VLI_NATIVE_LITTLE_ENDIAN == 0
uECC_vli_nativeToBytes(signature, curve->num_bytes, p); /* store r */
#endif
#if uECC_VLI_NATIVE_LITTLE_ENDIAN
bcopy((uint8_t *) tmp, private_key, BITS_TO_BYTES(curve->num_n_bits));
#else
uECC_vli_bytesToNative(tmp, private_key, BITS_TO_BYTES(curve->num_n_bits)); /* tmp = d */
#endif
s[num_n_words - 1] = 0;
uECC_vli_set(s, p, num_words);
uECC_vli_modMult(s, tmp, s, curve->n, num_n_words); /* s = r*d */
bits2int(tmp, message_hash, hash_size, curve);
uECC_vli_modAdd(s, tmp, s, curve->n, num_n_words); /* s = e + r*d */
uECC_vli_modMult(s, s, k, curve->n, num_n_words); /* s = (e + r*d) / k */
if (uECC_vli_numBits(s, num_n_words) > (bitcount_t)curve->num_bytes * 8) {
return 0;
}
#if uECC_VLI_NATIVE_LITTLE_ENDIAN
bcopy((uint8_t *) signature + curve->num_bytes, (uint8_t *) s, curve->num_bytes);
#else
uECC_vli_nativeToBytes(signature + curve->num_bytes, curve->num_bytes, s);
#endif
return 1;
}
| 1
|
225,407
|
static void init_vdev(struct video_device *vdev, int nr)
{
MARK();
#ifdef V4L2LOOPBACK_WITH_STD
vdev->tvnorms = V4L2_STD_ALL;
#endif /* V4L2LOOPBACK_WITH_STD */
vdev->vfl_type = VFL_TYPE_VIDEO;
vdev->fops = &v4l2_loopback_fops;
vdev->ioctl_ops = &v4l2_loopback_ioctl_ops;
vdev->release = &video_device_release;
vdev->minor = -1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
#ifdef V4L2_CAP_VIDEO_M2M
vdev->device_caps |= V4L2_CAP_VIDEO_M2M;
#endif
#endif /* >=linux-4.7.0 */
if (debug > 1)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
vdev->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
#else
vdev->dev_debug =
V4L2_DEV_DEBUG_IOCTL | V4L2_DEV_DEBUG_IOCTL_ARG;
#endif
/* since kernel-3.7, there is a new field 'vfl_dir' that has to be
* set to VFL_DIR_M2M for bidirectional devices */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
vdev->vfl_dir = VFL_DIR_M2M;
#endif
MARK();
}
| 0
|
466,180
|
static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt)
{
struct x86_emulate_ops *ops = ctxt->ops;
u32 eax, ebx, ecx, edx;
/*
* syscall should always be enabled in longmode - so only become
* vendor specific (cpuid) if other modes are active...
*/
if (ctxt->mode == X86EMUL_MODE_PROT64)
return true;
eax = 0x00000000;
ecx = 0x00000000;
if (ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx)) {
/*
* Intel ("GenuineIntel")
* remark: Intel CPUs only support "syscall" in 64bit
* longmode. Also an 64bit guest with a
* 32bit compat-app running will #UD !! While this
* behaviour can be fixed (by emulating) into AMD
* response - CPUs of AMD can't behave like Intel.
*/
if (ebx == X86EMUL_CPUID_VENDOR_GenuineIntel_ebx &&
ecx == X86EMUL_CPUID_VENDOR_GenuineIntel_ecx &&
edx == X86EMUL_CPUID_VENDOR_GenuineIntel_edx)
return false;
/* AMD ("AuthenticAMD") */
if (ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx &&
ecx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx &&
edx == X86EMUL_CPUID_VENDOR_AuthenticAMD_edx)
return true;
/* AMD ("AMDisbetter!") */
if (ebx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx &&
ecx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx &&
edx == X86EMUL_CPUID_VENDOR_AMDisbetterI_edx)
return true;
}
/* default: (not Intel, not AMD), apply Intel's stricter rules... */
return false;
}
| 0
|
343,119
|
static void __exit esp4_fini(void)
{
if (xfrm4_protocol_deregister(&esp4_protocol, IPPROTO_ESP) < 0)
pr_info("%s: can't remove protocol\n", __func__);
xfrm_unregister_type(&esp_type, AF_INET);
}
| 0
|
398,495
|
RZ_API bool rz_bin_dwarf_line_op_run(const RzBinDwarfLineHeader *hdr, RzBinDwarfSMRegisters *regs, RzBinDwarfLineOp *op,
RZ_NULLABLE RzBinSourceLineInfoBuilder *bob, RZ_NULLABLE RzBinDwarfDebugInfo *info, RZ_NULLABLE RzBinDwarfLineFileCache fnc) {
rz_return_val_if_fail(hdr && regs && op, false);
switch (op->type) {
case RZ_BIN_DWARF_LINE_OP_TYPE_STD:
switch (op->opcode) {
case DW_LNS_copy:
if (bob) {
store_line_sample(bob, hdr, regs, info, fnc);
}
regs->basic_block = DWARF_FALSE;
break;
case DW_LNS_advance_pc:
regs->address += op->args.advance_pc * hdr->min_inst_len;
break;
case DW_LNS_advance_line:
regs->line += op->args.advance_line;
break;
case DW_LNS_set_file:
regs->file = op->args.set_file;
break;
case DW_LNS_set_column:
regs->column = op->args.set_column;
break;
case DW_LNS_negate_stmt:
regs->is_stmt = regs->is_stmt ? DWARF_FALSE : DWARF_TRUE;
break;
case DW_LNS_set_basic_block:
regs->basic_block = DWARF_TRUE;
break;
case DW_LNS_const_add_pc:
regs->address += rz_bin_dwarf_line_header_get_spec_op_advance_pc(hdr, 255);
break;
case DW_LNS_fixed_advance_pc:
regs->address += op->args.fixed_advance_pc;
break;
case DW_LNS_set_prologue_end:
regs->prologue_end = ~0;
break;
case DW_LNS_set_epilogue_begin:
regs->epilogue_begin = ~0;
break;
case DW_LNS_set_isa:
regs->isa = op->args.set_isa;
break;
default:
return false;
}
break;
case RZ_BIN_DWARF_LINE_OP_TYPE_EXT:
switch (op->opcode) {
case DW_LNE_end_sequence:
regs->end_sequence = DWARF_TRUE;
if (bob) {
// closing entry
rz_bin_source_line_info_builder_push_sample(bob, regs->address, 0, 0, NULL);
}
rz_bin_dwarf_line_header_reset_regs(hdr, regs);
break;
case DW_LNE_set_address:
regs->address = op->args.set_address;
break;
case DW_LNE_define_file:
break;
case DW_LNE_set_discriminator:
regs->discriminator = op->args.set_discriminator;
break;
default:
return false;
}
break;
case RZ_BIN_DWARF_LINE_OP_TYPE_SPEC:
regs->address += rz_bin_dwarf_line_header_get_spec_op_advance_pc(hdr, op->opcode);
regs->line += rz_bin_dwarf_line_header_get_spec_op_advance_line(hdr, op->opcode);
if (bob) {
store_line_sample(bob, hdr, regs, info, fnc);
}
regs->basic_block = DWARF_FALSE;
regs->prologue_end = DWARF_FALSE;
regs->epilogue_begin = DWARF_FALSE;
regs->discriminator = 0;
break;
default:
return false;
}
return true;
}
| 0
|
236,188
|
GF_Err blnk_box_size(GF_Box *s)
{
s->size += 4;
return GF_OK;
}
| 0
|
491,919
|
long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
unsigned int flags)
{
struct fuse_file *ff = file->private_data;
struct fuse_conn *fc = ff->fc;
struct fuse_ioctl_in inarg = {
.fh = ff->fh,
.cmd = cmd,
.arg = arg,
.flags = flags
};
struct fuse_ioctl_out outarg;
struct fuse_req *req = NULL;
struct page **pages = NULL;
struct page *iov_page = NULL;
struct iovec *in_iov = NULL, *out_iov = NULL;
unsigned int in_iovs = 0, out_iovs = 0, num_pages = 0, max_pages;
size_t in_size, out_size, transferred;
int err;
/* assume all the iovs returned by client always fits in a page */
BUILD_BUG_ON(sizeof(struct iovec) * FUSE_IOCTL_MAX_IOV > PAGE_SIZE);
err = -ENOMEM;
pages = kzalloc(sizeof(pages[0]) * FUSE_MAX_PAGES_PER_REQ, GFP_KERNEL);
iov_page = alloc_page(GFP_KERNEL);
if (!pages || !iov_page)
goto out;
/*
* If restricted, initialize IO parameters as encoded in @cmd.
* RETRY from server is not allowed.
*/
if (!(flags & FUSE_IOCTL_UNRESTRICTED)) {
struct iovec *iov = page_address(iov_page);
iov->iov_base = (void __user *)arg;
iov->iov_len = _IOC_SIZE(cmd);
if (_IOC_DIR(cmd) & _IOC_WRITE) {
in_iov = iov;
in_iovs = 1;
}
if (_IOC_DIR(cmd) & _IOC_READ) {
out_iov = iov;
out_iovs = 1;
}
}
retry:
inarg.in_size = in_size = iov_length(in_iov, in_iovs);
inarg.out_size = out_size = iov_length(out_iov, out_iovs);
/*
* Out data can be used either for actual out data or iovs,
* make sure there always is at least one page.
*/
out_size = max_t(size_t, out_size, PAGE_SIZE);
max_pages = DIV_ROUND_UP(max(in_size, out_size), PAGE_SIZE);
/* make sure there are enough buffer pages and init request with them */
err = -ENOMEM;
if (max_pages > FUSE_MAX_PAGES_PER_REQ)
goto out;
while (num_pages < max_pages) {
pages[num_pages] = alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
if (!pages[num_pages])
goto out;
num_pages++;
}
req = fuse_get_req(fc);
if (IS_ERR(req)) {
err = PTR_ERR(req);
req = NULL;
goto out;
}
memcpy(req->pages, pages, sizeof(req->pages[0]) * num_pages);
req->num_pages = num_pages;
/* okay, let's send it to the client */
req->in.h.opcode = FUSE_IOCTL;
req->in.h.nodeid = ff->nodeid;
req->in.numargs = 1;
req->in.args[0].size = sizeof(inarg);
req->in.args[0].value = &inarg;
if (in_size) {
req->in.numargs++;
req->in.args[1].size = in_size;
req->in.argpages = 1;
err = fuse_ioctl_copy_user(pages, in_iov, in_iovs, in_size,
false);
if (err)
goto out;
}
req->out.numargs = 2;
req->out.args[0].size = sizeof(outarg);
req->out.args[0].value = &outarg;
req->out.args[1].size = out_size;
req->out.argpages = 1;
req->out.argvar = 1;
fuse_request_send(fc, req);
err = req->out.h.error;
transferred = req->out.args[1].size;
fuse_put_request(fc, req);
req = NULL;
if (err)
goto out;
/* did it ask for retry? */
if (outarg.flags & FUSE_IOCTL_RETRY) {
char *vaddr;
/* no retry if in restricted mode */
err = -EIO;
if (!(flags & FUSE_IOCTL_UNRESTRICTED))
goto out;
in_iovs = outarg.in_iovs;
out_iovs = outarg.out_iovs;
/*
* Make sure things are in boundary, separate checks
* are to protect against overflow.
*/
err = -ENOMEM;
if (in_iovs > FUSE_IOCTL_MAX_IOV ||
out_iovs > FUSE_IOCTL_MAX_IOV ||
in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV)
goto out;
err = -EIO;
if ((in_iovs + out_iovs) * sizeof(struct iovec) != transferred)
goto out;
/* okay, copy in iovs and retry */
vaddr = kmap_atomic(pages[0], KM_USER0);
memcpy(page_address(iov_page), vaddr, transferred);
kunmap_atomic(vaddr, KM_USER0);
in_iov = page_address(iov_page);
out_iov = in_iov + in_iovs;
goto retry;
}
err = -EIO;
if (transferred > inarg.out_size)
goto out;
err = fuse_ioctl_copy_user(pages, out_iov, out_iovs, transferred, true);
out:
if (req)
fuse_put_request(fc, req);
if (iov_page)
__free_page(iov_page);
while (num_pages)
__free_page(pages[--num_pages]);
kfree(pages);
return err ? err : outarg.result;
}
| 0
|
210,702
|
static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offset,
struct inode **i)
{
struct squashfs_dir_header dirh;
char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]
__attribute__((aligned));
struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer;
long long start;
long long bytes;
int dir_count, size;
struct dir_ent *new_dir;
struct dir *dir;
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
block_start, offset);
*i = read_inode(block_start, offset);
dir = malloc(sizeof(struct dir));
if(dir == NULL)
EXIT_UNSQUASH("squashfs_opendir: malloc failed!\n");
dir->dir_count = 0;
dir->cur_entry = 0;
dir->mode = (*i)->mode;
dir->uid = (*i)->uid;
dir->guid = (*i)->gid;
dir->mtime = (*i)->time;
dir->xattr = (*i)->xattr;
dir->dirs = NULL;
if ((*i)->data == 3)
/*
* if the directory is empty, skip the unnecessary
* lookup_entry, this fixes the corner case with
* completely empty filesystems where lookup_entry correctly
* returning -1 is incorrectly treated as an error
*/
return dir;
start = sBlk.s.directory_table_start + (*i)->start;
bytes = lookup_entry(directory_table_hash, start);
if(bytes == -1)
EXIT_UNSQUASH("squashfs_opendir: directory block %lld not "
"found!\n", start);
bytes += (*i)->offset;
size = (*i)->data + bytes - 3;
while(bytes < size) {
SQUASHFS_SWAP_DIR_HEADER(directory_table + bytes, &dirh);
dir_count = dirh.count + 1;
TRACE("squashfs_opendir: Read directory header @ byte position "
"%d, %d directory entries\n", bytes, dir_count);
bytes += sizeof(dirh);
/* dir_count should never be larger than SQUASHFS_DIR_COUNT */
if(dir_count > SQUASHFS_DIR_COUNT) {
ERROR("File system corrupted: too many entries in directory\n");
goto corrupted;
}
while(dir_count--) {
SQUASHFS_SWAP_DIR_ENTRY(directory_table + bytes, dire);
bytes += sizeof(*dire);
/* size should never be SQUASHFS_NAME_LEN or larger */
if(dire->size >= SQUASHFS_NAME_LEN) {
ERROR("File system corrupted: filename too long\n");
goto corrupted;
}
memcpy(dire->name, directory_table + bytes,
dire->size + 1);
dire->name[dire->size + 1] = '\0';
TRACE("squashfs_opendir: directory entry %s, inode "
"%d:%d, type %d\n", dire->name,
dirh.start_block, dire->offset, dire->type);
if((dir->dir_count % DIR_ENT_SIZE) == 0) {
new_dir = realloc(dir->dirs, (dir->dir_count +
DIR_ENT_SIZE) * sizeof(struct dir_ent));
if(new_dir == NULL)
EXIT_UNSQUASH("squashfs_opendir: "
"realloc failed!\n");
dir->dirs = new_dir;
}
strcpy(dir->dirs[dir->dir_count].name, dire->name);
dir->dirs[dir->dir_count].start_block =
dirh.start_block;
dir->dirs[dir->dir_count].offset = dire->offset;
dir->dirs[dir->dir_count].type = dire->type;
dir->dir_count ++;
bytes += dire->size + 1;
}
}
return dir;
corrupted:
free(dir->dirs);
free(dir);
return NULL;
}
| 1
|
262,792
|
static void mctp_serial_rx(struct mctp_serial *dev)
{
struct mctp_skb_cb *cb;
struct sk_buff *skb;
if (dev->rxfcs != dev->rxfcs_rcvd) {
dev->netdev->stats.rx_dropped++;
dev->netdev->stats.rx_crc_errors++;
return;
}
skb = netdev_alloc_skb(dev->netdev, dev->rxlen);
if (!skb) {
dev->netdev->stats.rx_dropped++;
return;
}
skb->protocol = htons(ETH_P_MCTP);
skb_put_data(skb, dev->rxbuf, dev->rxlen);
skb_reset_network_header(skb);
cb = __mctp_cb(skb);
cb->halen = 0;
netif_rx_ni(skb);
dev->netdev->stats.rx_packets++;
dev->netdev->stats.rx_bytes += dev->rxlen;
}
| 0
|
384,793
|
vim_iswordp(char_u *p)
{
return vim_iswordp_buf(p, curbuf);
}
| 0
|
512,798
|
bool Item_func_ifnull::native_op(THD *thd, Native *to)
{
DBUG_ASSERT(fixed == 1);
if (!val_native_with_conversion_from_item(thd, args[0], to, type_handler()))
return false;
return val_native_with_conversion_from_item(thd, args[1], to, type_handler());
}
| 0
|
502,716
|
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type,
int val) {
return ctx->info_callback;
}
| 0
|
282,860
|
int rsi_hal_load_key(struct rsi_common *common,
u8 *data,
u16 key_len,
u8 key_type,
u8 key_id,
u32 cipher,
s16 sta_id,
struct ieee80211_vif *vif)
{
struct sk_buff *skb = NULL;
struct rsi_set_key *set_key;
u16 key_descriptor = 0;
u16 frame_len = sizeof(struct rsi_set_key);
rsi_dbg(MGMT_TX_ZONE, "%s: Sending load key frame\n", __func__);
skb = dev_alloc_skb(frame_len);
if (!skb) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
__func__);
return -ENOMEM;
}
memset(skb->data, 0, frame_len);
set_key = (struct rsi_set_key *)skb->data;
if (key_type == RSI_GROUP_KEY) {
key_descriptor = RSI_KEY_TYPE_BROADCAST;
if (vif->type == NL80211_IFTYPE_AP)
key_descriptor |= RSI_KEY_MODE_AP;
}
if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
(cipher == WLAN_CIPHER_SUITE_WEP104)) {
key_id = 0;
key_descriptor |= RSI_WEP_KEY;
if (key_len >= 13)
key_descriptor |= RSI_WEP_KEY_104;
} else if (cipher != KEY_TYPE_CLEAR) {
key_descriptor |= RSI_CIPHER_WPA;
if (cipher == WLAN_CIPHER_SUITE_TKIP)
key_descriptor |= RSI_CIPHER_TKIP;
}
key_descriptor |= RSI_PROTECT_DATA_FRAMES;
key_descriptor |= (key_id << RSI_KEY_ID_OFFSET);
rsi_set_len_qno(&set_key->desc_dword0.len_qno,
(frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q);
set_key->desc_dword0.frame_type = SET_KEY_REQ;
set_key->key_desc = cpu_to_le16(key_descriptor);
set_key->sta_id = sta_id;
if (data) {
if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
(cipher == WLAN_CIPHER_SUITE_WEP104)) {
memcpy(&set_key->key[key_id][1], data, key_len * 2);
} else {
memcpy(&set_key->key[0][0], data, key_len);
}
memcpy(set_key->tx_mic_key, &data[16], 8);
memcpy(set_key->rx_mic_key, &data[24], 8);
} else {
memset(&set_key[FRAME_DESC_SZ], 0, frame_len - FRAME_DESC_SZ);
}
skb_put(skb, frame_len);
return rsi_send_internal_mgmt_frame(common, skb);
}
| 0
|
432,093
|
sug_filltree(spellinfo_T *spin, slang_T *slang)
{
char_u *byts;
idx_T *idxs;
int depth;
idx_T arridx[MAXWLEN];
int curi[MAXWLEN];
char_u tword[MAXWLEN];
char_u tsalword[MAXWLEN];
int c;
idx_T n;
unsigned words_done = 0;
int wordcount[MAXWLEN];
// We use si_foldroot for the soundfolded trie.
spin->si_foldroot = wordtree_alloc(spin);
if (spin->si_foldroot == NULL)
return FAIL;
// let tree_add_word() know we're adding to the soundfolded tree
spin->si_sugtree = TRUE;
/*
* Go through the whole case-folded tree, soundfold each word and put it
* in the trie. Bail out if the tree is empty.
*/
byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
if (byts == NULL || idxs == NULL)
return FAIL;
arridx[0] = 0;
curi[0] = 1;
wordcount[0] = 0;
depth = 0;
while (depth >= 0 && !got_int)
{
if (curi[depth] > byts[arridx[depth]])
{
// Done all bytes at this node, go up one level.
idxs[arridx[depth]] = wordcount[depth];
if (depth > 0)
wordcount[depth - 1] += wordcount[depth];
--depth;
line_breakcheck();
}
else
{
// Do one more byte at this node.
n = arridx[depth] + curi[depth];
++curi[depth];
c = byts[n];
if (c == 0)
{
// Sound-fold the word.
tword[depth] = NUL;
spell_soundfold(slang, tword, TRUE, tsalword);
// We use the "flags" field for the MSB of the wordnr,
// "region" for the LSB of the wordnr.
if (tree_add_word(spin, tsalword, spin->si_foldroot,
words_done >> 16, words_done & 0xffff,
0) == FAIL)
return FAIL;
++words_done;
++wordcount[depth];
// Reset the block count each time to avoid compression
// kicking in.
spin->si_blocks_cnt = 0;
// Skip over any other NUL bytes (same word with different
// flags). But don't go over the end.
while (n + 1 < slang->sl_fbyts_len && byts[n + 1] == 0)
{
++n;
++curi[depth];
}
}
else
{
// Normal char, go one level deeper.
tword[depth++] = c;
arridx[depth] = idxs[n];
curi[depth] = 1;
wordcount[depth] = 0;
}
}
}
smsg(_("Total number of words: %d"), words_done);
return OK;
}
| 0
|
236,209
|
void gpp_read_box(GF_BitStream *bs, GF_BoxRecord *rec)
{
rec->top = gf_bs_read_u16(bs);
rec->left = gf_bs_read_u16(bs);
rec->bottom = gf_bs_read_u16(bs);
rec->right = gf_bs_read_u16(bs);
}
| 0
|
413,830
|
void LinkResolver::resolve_special_call(CallInfo& result,
Handle recv,
const LinkInfo& link_info,
TRAPS) {
Method* resolved_method = linktime_resolve_special_method(link_info, CHECK);
runtime_resolve_special_method(result, link_info, methodHandle(THREAD, resolved_method), recv, CHECK);
}
| 0
|
202,783
|
static Bigint * Balloc(int k)
{
int x;
Bigint *rv;
_THREAD_PRIVATE_MUTEX_LOCK(dtoa_mutex);
if ((rv = freelist[k])) {
freelist[k] = rv->next;
} else {
x = 1 << k;
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long));
rv->k = k;
rv->maxwds = x;
}
_THREAD_PRIVATE_MUTEX_UNLOCK(dtoa_mutex);
rv->sign = rv->wds = 0;
return rv;
}
| 1
|
312,486
|
ex_copen(exarg_T *eap)
{
qf_info_T *qi;
qf_list_T *qfl;
int height;
int status = FAIL;
int lnum;
if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL)
return;
incr_quickfix_busy();
if (eap->addr_count != 0)
height = eap->line2;
else
height = QF_WINHEIGHT;
reset_VIsual_and_resel(); // stop Visual mode
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
// Find an existing quickfix window, or open a new one.
if (cmdmod.cmod_tab == 0)
status = qf_goto_cwindow(qi, eap->addr_count != 0, height,
cmdmod.cmod_split & WSP_VERT);
if (status == FAIL)
if (qf_open_new_cwindow(qi, height) == FAIL)
{
decr_quickfix_busy();
return;
}
qfl = qf_get_curlist(qi);
qf_set_title_var(qfl);
// Save the current index here, as updating the quickfix buffer may free
// the quickfix list
lnum = qfl->qf_index;
// Fill the buffer with the quickfix list.
qf_fill_buffer(qfl, curbuf, NULL, curwin->w_id);
decr_quickfix_busy();
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = 0;
check_cursor();
update_topline(); // scroll to show the line
}
| 0
|
198,743
|
static ptrdiff_t finderrfunc(lua_State *L)
{
cTValue *frame = L->base-1, *bot = tvref(L->stack);
void *cf = L->cframe;
while (frame > bot && cf) {
while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */
if (frame >= restorestack(L, -cframe_nres(cf)))
break;
if (cframe_errfunc(cf) >= 0) /* Error handler not inherited (-1)? */
return cframe_errfunc(cf);
cf = cframe_prev(cf); /* Else unwind cframe and continue searching. */
if (cf == NULL)
return 0;
}
switch (frame_typep(frame)) {
case FRAME_LUA:
case FRAME_LUAP:
frame = frame_prevl(frame);
break;
case FRAME_C:
cf = cframe_prev(cf);
/* fallthrough */
case FRAME_VARG:
frame = frame_prevd(frame);
break;
case FRAME_CONT:
#if LJ_HASFFI
if ((frame-1)->u32.lo == LJ_CONT_FFI_CALLBACK)
cf = cframe_prev(cf);
#endif
frame = frame_prevd(frame);
break;
case FRAME_CP:
if (cframe_canyield(cf)) return 0;
if (cframe_errfunc(cf) >= 0)
return cframe_errfunc(cf);
frame = frame_prevd(frame);
break;
case FRAME_PCALL:
case FRAME_PCALLH:
if (frame_ftsz(frame) >= (ptrdiff_t)(2*sizeof(TValue))) /* xpcall? */
return savestack(L, frame-1); /* Point to xpcall's errorfunc. */
return 0;
default:
lua_assert(0);
return 0;
}
}
return 0;
}
| 1
|
234,831
|
int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info)
{
struct btrfs_path *path;
struct btrfs_root *root = fs_info->dev_root;
struct btrfs_key key;
u64 prev_devid = 0;
u64 prev_dev_ext_end = 0;
int ret = 0;
/*
* We don't have a dev_root because we mounted with ignorebadroots and
* failed to load the root, so we want to skip the verification in this
* case for sure.
*
* However if the dev root is fine, but the tree itself is corrupted
* we'd still fail to mount. This verification is only to make sure
* writes can happen safely, so instead just bypass this check
* completely in the case of IGNOREBADROOTS.
*/
if (btrfs_test_opt(fs_info, IGNOREBADROOTS))
return 0;
key.objectid = 1;
key.type = BTRFS_DEV_EXTENT_KEY;
key.offset = 0;
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
path->reada = READA_FORWARD;
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto out;
if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) {
ret = btrfs_next_leaf(root, path);
if (ret < 0)
goto out;
/* No dev extents at all? Not good */
if (ret > 0) {
ret = -EUCLEAN;
goto out;
}
}
while (1) {
struct extent_buffer *leaf = path->nodes[0];
struct btrfs_dev_extent *dext;
int slot = path->slots[0];
u64 chunk_offset;
u64 physical_offset;
u64 physical_len;
u64 devid;
btrfs_item_key_to_cpu(leaf, &key, slot);
if (key.type != BTRFS_DEV_EXTENT_KEY)
break;
devid = key.objectid;
physical_offset = key.offset;
dext = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent);
chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dext);
physical_len = btrfs_dev_extent_length(leaf, dext);
/* Check if this dev extent overlaps with the previous one */
if (devid == prev_devid && physical_offset < prev_dev_ext_end) {
btrfs_err(fs_info,
"dev extent devid %llu physical offset %llu overlap with previous dev extent end %llu",
devid, physical_offset, prev_dev_ext_end);
ret = -EUCLEAN;
goto out;
}
ret = verify_one_dev_extent(fs_info, chunk_offset, devid,
physical_offset, physical_len);
if (ret < 0)
goto out;
prev_devid = devid;
prev_dev_ext_end = physical_offset + physical_len;
ret = btrfs_next_item(root, path);
if (ret < 0)
goto out;
if (ret > 0) {
ret = 0;
break;
}
}
/* Ensure all chunks have corresponding dev extents */
ret = verify_chunk_dev_extent_mapping(fs_info);
out:
btrfs_free_path(path);
return ret;
}
| 0
|
218,966
|
bool ConstantFolding::ForwardInputs(NodeDef* node,
absl::Span<const int> inputs_to_forward) {
for (int input_idx : inputs_to_forward) {
if (input_idx < 0 || input_idx >= node->input_size()) {
return false;
}
}
const auto& tmp = node_map_->GetOutputs(node->name());
const std::vector<NodeDef*> consumers(tmp.begin(), tmp.end());
bool updated_graph = false;
for (int input_idx : inputs_to_forward) {
const string& input = node->input(input_idx);
if (IsControlInput(input) && consumers.size() > 1) {
continue;
}
const NodeDef* input_node = node_map_->GetNode(NodeName(input));
if (input_node == nullptr) {
LOG(ERROR) << "Bad input: " << input;
break;
}
// Update each consumer.
for (NodeDef* consumer : consumers) {
bool add_dep = false;
for (int consumer_input_idx = 0;
consumer_input_idx < consumer->input_size(); ++consumer_input_idx) {
const string& consumer_input = consumer->input(consumer_input_idx);
if (IsControlInput(consumer_input)) {
break;
}
// It is illegal to add control dependencies to _Retval nodes, so we
// can't bypass value producing `node` and forward inputs to `consumer`.
if (IsRetval(*consumer)) {
break;
}
int output_idx;
const string input_node_name =
ParseNodeName(consumer_input, &output_idx);
if (input_node_name == node->name() && output_idx == input_idx) {
consumer->set_input(consumer_input_idx, input);
// We will keep the input from the node through a control
// dependency, so we only need to add the consumer as an output
// for the input node.
node_map_->AddOutput(NodeName(input), consumer->name());
add_dep = true;
}
}
if (add_dep) {
consumer->add_input(AsControlDependency(node->name()));
updated_graph = true;
}
}
}
if (updated_graph) {
for (NodeDef* consumer : consumers) {
DedupControlInputs(consumer);
}
}
return updated_graph;
}
| 0
|
400,747
|
static inline void data_start(const struct iov_iter *i,
unsigned int *iter_headp, size_t *offp)
{
unsigned int p_mask = i->pipe->ring_size - 1;
unsigned int iter_head = i->head;
size_t off = i->iov_offset;
if (off && (!allocated(&i->pipe->bufs[iter_head & p_mask]) ||
off == PAGE_SIZE)) {
iter_head++;
off = 0;
}
*iter_headp = iter_head;
*offp = off;
}
| 0
|
328,902
|
R_API RBinSymbol *r_bin_java_create_new_symbol_from_field(RBinJavaField *fm_type, ut64 baddr) {
RBinSymbol *sym = R_NEW0 (RBinSymbol);
if (!fm_type || !fm_type->field_ref_cp_obj || fm_type->field_ref_cp_obj == &R_BIN_JAVA_NULL_TYPE) {
R_FREE (sym);
}
if (sym) {
sym->name = strdup (fm_type->name);
// strncpy (sym->type, fm_type->descriptor, R_BIN_SIZEOF_STRINGS);
if (fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {
sym->type = R_BIN_TYPE_FUNC_STR;
sym->paddr = r_bin_java_get_method_code_offset (fm_type);
sym->vaddr = r_bin_java_get_method_code_offset (fm_type) + baddr;
sym->size = r_bin_java_get_method_code_size (fm_type);
} else {
sym->type = "FIELD";
sym->paddr = fm_type->file_offset;// r_bin_java_get_method_code_offset (fm_type);
sym->vaddr = fm_type->file_offset + baddr;
sym->size = fm_type->size;
}
if (r_bin_java_is_fm_type_protected (fm_type)) {
sym->bind = R_BIN_BIND_LOCAL_STR;
} else if (r_bin_java_is_fm_type_private (fm_type)) {
sym->bind = R_BIN_BIND_LOCAL_STR;
} else if (r_bin_java_is_fm_type_protected (fm_type)) {
sym->bind = R_BIN_BIND_GLOBAL_STR;
}
sym->forwarder = "NONE";
if (fm_type->class_name) {
sym->classname = strdup (fm_type->class_name);
} else {
sym->classname = strdup ("UNKNOWN"); // dupped names?
}
sym->ordinal = fm_type->metas->ord;
sym->visibility = fm_type->flags;
if (fm_type->flags_str) {
sym->visibility_str = strdup (fm_type->flags_str);
}
}
return sym;
}
| 0
|
355,657
|
do_string_sub(
char_u *str,
char_u *pat,
char_u *sub,
typval_T *expr,
char_u *flags)
{
int sublen;
regmatch_T regmatch;
int i;
int do_all;
char_u *tail;
char_u *end;
garray_T ga;
char_u *ret;
char_u *save_cpo;
char_u *zero_width = NULL;
// Make 'cpoptions' empty, so that the 'l' flag doesn't work here
save_cpo = p_cpo;
p_cpo = empty_option;
ga_init2(&ga, 1, 200);
do_all = (flags[0] == 'g');
regmatch.rm_ic = p_ic;
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
if (regmatch.regprog != NULL)
{
tail = str;
end = str + STRLEN(str);
while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
{
// Skip empty match except for first match.
if (regmatch.startp[0] == regmatch.endp[0])
{
if (zero_width == regmatch.startp[0])
{
// avoid getting stuck on a match with an empty string
i = mb_ptr2len(tail);
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
(size_t)i);
ga.ga_len += i;
tail += i;
continue;
}
zero_width = regmatch.startp[0];
}
/*
* Get some space for a temporary buffer to do the substitution
* into. It will contain:
* - The text up to where the match is.
* - The substituted text.
* - The text after the match.
*/
sublen = vim_regsub(®match, sub, expr, tail, FALSE, TRUE, FALSE);
if (ga_grow(&ga, (int)((end - tail) + sublen -
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
{
ga_clear(&ga);
break;
}
// copy the text up to where the match is
i = (int)(regmatch.startp[0] - tail);
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i);
// add the substituted text
(void)vim_regsub(®match, sub, expr, (char_u *)ga.ga_data
+ ga.ga_len + i, TRUE, TRUE, FALSE);
ga.ga_len += i + sublen - 1;
tail = regmatch.endp[0];
if (*tail == NUL)
break;
if (!do_all)
break;
}
if (ga.ga_data != NULL)
STRCPY((char *)ga.ga_data + ga.ga_len, tail);
vim_regfree(regmatch.regprog);
}
ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
ga_clear(&ga);
if (p_cpo == empty_option)
p_cpo = save_cpo;
else
{
// Darn, evaluating {sub} expression or {expr} changed the value.
// If it's still empty it was changed and restored, need to restore in
// the complicated way.
if (*p_cpo == NUL)
set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
free_string_option(save_cpo);
}
return ret;
}
| 0
|
427,204
|
static void movegotosout (FuncState *fs, BlockCnt *bl) {
int i;
Labellist *gl = &fs->ls->dyd->gt;
/* correct pending gotos to current block */
for (i = bl->firstgoto; i < gl->n; i++) { /* for each pending goto */
Labeldesc *gt = &gl->arr[i];
/* leaving a variable scope? */
if (reglevel(fs, gt->nactvar) > reglevel(fs, bl->nactvar))
gt->close |= bl->upval; /* jump may need a close */
gt->nactvar = bl->nactvar; /* update goto level */
}
}
| 0
|
270,117
|
TfLiteStatus CalculateShapeForBroadcast(TfLiteContext* context,
const TfLiteTensor* input1,
const TfLiteTensor* input2,
const TfLiteTensor* input3,
TfLiteIntArray** output_shape) {
const int dims1 = NumDimensions(input1);
const int dims2 = NumDimensions(input2);
const int dims3 = NumDimensions(input3);
const int out_dims = std::max(std::max(dims1, dims2), dims3);
std::unique_ptr<TfLiteIntArray, void (*)(TfLiteIntArray*)> shape(
TfLiteIntArrayCreate(out_dims), TfLiteIntArrayFree);
for (int i = 0; i < out_dims; ++i) {
const int d1 = i >= dims1 ? 1 : SizeOfDimension(input1, dims1 - i - 1);
const int d2 = i >= dims2 ? 1 : SizeOfDimension(input2, dims2 - i - 1);
const int d3 = i >= dims3 ? 1 : SizeOfDimension(input3, dims3 - i - 1);
const int min_value = std::min(std::min(d1, d2), d3);
int max_value = std::max(std::max(d1, d2), d3);
// If one dimention is 0, others must be 0 or 1.
if (min_value == 0) max_value = 0;
if (!(d1 == 1 || d1 == max_value) || !(d2 == 1 || d2 == max_value) ||
!(d3 == 1 || d3 == max_value)) {
context->ReportError(
context, "Given shapes, %s, %s and %s, are not broadcastable.",
GetShapeDebugString(input1->dims).c_str(),
GetShapeDebugString(input2->dims).c_str(),
GetShapeDebugString(input3->dims).c_str());
return kTfLiteError;
}
shape->data[out_dims - i - 1] = max_value;
}
*output_shape = shape.release();
return kTfLiteOk;
}
| 0
|
404,193
|
static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
int type, int stackptr, int stacktop, BOOL has_quit)
{
delayed_mem_copy_status status;
PCRE2_SPTR alternative;
sljit_sw private_srcw[2];
sljit_sw shared_srcw[3];
sljit_sw kept_shared_srcw[2];
int private_count, shared_count, kept_shared_count;
int from_sp, base_reg, offset, i;
memset(common->recurse_bitset, 0, common->recurse_bitset_size);
#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
SLJIT_ASSERT(common->control_head_ptr != 0);
recurse_check_bit(common, common->control_head_ptr);
#endif
switch (type)
{
case recurse_copy_from_global:
from_sp = TRUE;
base_reg = STACK_TOP;
break;
case recurse_copy_private_to_global:
case recurse_copy_shared_to_global:
case recurse_copy_kept_shared_to_global:
from_sp = FALSE;
base_reg = STACK_TOP;
break;
default:
SLJIT_ASSERT(type == recurse_swap_global);
from_sp = FALSE;
base_reg = TMP2;
break;
}
stackptr = STACK(stackptr);
stacktop = STACK(stacktop);
status.tmp_regs[0] = TMP1;
status.saved_tmp_regs[0] = TMP1;
if (base_reg != TMP2)
{
status.tmp_regs[1] = TMP2;
status.saved_tmp_regs[1] = TMP2;
}
else
{
status.saved_tmp_regs[1] = RETURN_ADDR;
if (HAS_VIRTUAL_REGISTERS)
status.tmp_regs[1] = STR_PTR;
else
status.tmp_regs[1] = RETURN_ADDR;
}
status.saved_tmp_regs[2] = TMP3;
if (HAS_VIRTUAL_REGISTERS)
status.tmp_regs[2] = STR_END;
else
status.tmp_regs[2] = TMP3;
delayed_mem_copy_init(&status, common);
if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
{
SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_private_to_global || type == recurse_swap_global);
if (!from_sp)
delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->recursive_head_ptr);
if (from_sp || type == recurse_swap_global)
delayed_mem_copy_move(&status, SLJIT_SP, common->recursive_head_ptr, base_reg, stackptr);
}
stackptr += sizeof(sljit_sw);
#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
if (type != recurse_copy_shared_to_global)
{
if (!from_sp)
delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->control_head_ptr);
if (from_sp || type == recurse_swap_global)
delayed_mem_copy_move(&status, SLJIT_SP, common->control_head_ptr, base_reg, stackptr);
}
stackptr += sizeof(sljit_sw);
#endif
while (cc < ccend)
{
private_count = 0;
shared_count = 0;
kept_shared_count = 0;
switch(*cc)
{
case OP_SET_SOM:
SLJIT_ASSERT(common->has_set_som);
if (has_quit && recurse_check_bit(common, OVECTOR(0)))
{
kept_shared_srcw[0] = OVECTOR(0);
kept_shared_count = 1;
}
cc += 1;
break;
case OP_RECURSE:
if (has_quit)
{
if (common->has_set_som && recurse_check_bit(common, OVECTOR(0)))
{
kept_shared_srcw[0] = OVECTOR(0);
kept_shared_count = 1;
}
if (common->mark_ptr != 0 && recurse_check_bit(common, common->mark_ptr))
{
kept_shared_srcw[kept_shared_count] = common->mark_ptr;
kept_shared_count++;
}
}
if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
{
shared_srcw[0] = common->capture_last_ptr;
shared_count = 1;
}
cc += 1 + LINK_SIZE;
break;
case OP_KET:
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0)
{
if (recurse_check_bit(common, private_srcw[0]))
private_count = 1;
SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
cc += PRIVATE_DATA(cc + 1);
}
cc += 1 + LINK_SIZE;
break;
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ASSERT_NA:
case OP_ASSERTBACK_NA:
case OP_ONCE:
case OP_SCRIPT_RUN:
case OP_BRAPOS:
case OP_SBRA:
case OP_SBRAPOS:
case OP_SCOND:
private_srcw[0] = PRIVATE_DATA(cc);
if (recurse_check_bit(common, private_srcw[0]))
private_count = 1;
cc += 1 + LINK_SIZE;
break;
case OP_CBRA:
case OP_SCBRA:
offset = GET2(cc, 1 + LINK_SIZE);
shared_srcw[0] = OVECTOR(offset << 1);
if (recurse_check_bit(common, shared_srcw[0]))
{
shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
shared_count = 2;
}
if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
{
shared_srcw[shared_count] = common->capture_last_ptr;
shared_count++;
}
if (common->optimized_cbracket[offset] == 0)
{
private_srcw[0] = OVECTOR_PRIV(offset);
if (recurse_check_bit(common, private_srcw[0]))
private_count = 1;
}
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
case OP_CBRAPOS:
case OP_SCBRAPOS:
offset = GET2(cc, 1 + LINK_SIZE);
shared_srcw[0] = OVECTOR(offset << 1);
if (recurse_check_bit(common, shared_srcw[0]))
{
shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
shared_count = 2;
}
if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
{
shared_srcw[shared_count] = common->capture_last_ptr;
shared_count++;
}
private_srcw[0] = PRIVATE_DATA(cc);
if (recurse_check_bit(common, private_srcw[0]))
private_count = 1;
offset = OVECTOR_PRIV(offset);
if (recurse_check_bit(common, offset))
{
private_srcw[private_count] = offset;
private_count++;
}
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
case OP_COND:
/* Might be a hidden SCOND. */
alternative = cc + GET(cc, 1);
if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
{
private_srcw[0] = PRIVATE_DATA(cc);
if (recurse_check_bit(common, private_srcw[0]))
private_count = 1;
}
cc += 1 + LINK_SIZE;
break;
CASE_ITERATOR_PRIVATE_DATA_1
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
private_count = 1;
cc += 2;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
CASE_ITERATOR_PRIVATE_DATA_2A
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
{
private_count = 2;
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
}
cc += 2;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
CASE_ITERATOR_PRIVATE_DATA_2B
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
{
private_count = 2;
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
}
cc += 2 + IMM2_SIZE;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_1
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
private_count = 1;
cc += 1;
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
{
private_count = 2;
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
}
cc += 1;
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
private_srcw[0] = PRIVATE_DATA(cc);
if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
{
private_count = 2;
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
}
cc += 1 + IMM2_SIZE;
break;
case OP_CLASS:
case OP_NCLASS:
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8
case OP_XCLASS:
i = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(PCRE2_UCHAR);
#else
i = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
#endif
if (PRIVATE_DATA(cc) != 0)
switch(get_class_iterator_size(cc + i))
{
case 1:
private_srcw[0] = PRIVATE_DATA(cc);
break;
case 2:
private_srcw[0] = PRIVATE_DATA(cc);
if (recurse_check_bit(common, private_srcw[0]))
{
private_count = 2;
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
}
break;
default:
SLJIT_UNREACHABLE();
break;
}
cc += i;
break;
case OP_MARK:
case OP_COMMIT_ARG:
case OP_PRUNE_ARG:
case OP_THEN_ARG:
SLJIT_ASSERT(common->mark_ptr != 0);
if (has_quit && recurse_check_bit(common, common->mark_ptr))
{
kept_shared_srcw[0] = common->mark_ptr;
kept_shared_count = 1;
}
if (common->control_head_ptr != 0 && recurse_check_bit(common, common->control_head_ptr))
{
private_srcw[0] = common->control_head_ptr;
private_count = 1;
}
cc += 1 + 2 + cc[1];
break;
case OP_THEN:
SLJIT_ASSERT(common->control_head_ptr != 0);
if (recurse_check_bit(common, common->control_head_ptr))
{
private_srcw[0] = common->control_head_ptr;
private_count = 1;
}
cc++;
break;
default:
cc = next_opcode(common, cc);
SLJIT_ASSERT(cc != NULL);
continue;
}
if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
{
SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_private_to_global || type == recurse_swap_global);
for (i = 0; i < private_count; i++)
{
SLJIT_ASSERT(private_srcw[i] != 0);
if (!from_sp)
delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, private_srcw[i]);
if (from_sp || type == recurse_swap_global)
delayed_mem_copy_move(&status, SLJIT_SP, private_srcw[i], base_reg, stackptr);
stackptr += sizeof(sljit_sw);
}
}
else
stackptr += sizeof(sljit_sw) * private_count;
if (type != recurse_copy_private_to_global && type != recurse_copy_kept_shared_to_global)
{
SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_shared_to_global || type == recurse_swap_global);
for (i = 0; i < shared_count; i++)
{
SLJIT_ASSERT(shared_srcw[i] != 0);
if (!from_sp)
delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, shared_srcw[i]);
if (from_sp || type == recurse_swap_global)
delayed_mem_copy_move(&status, SLJIT_SP, shared_srcw[i], base_reg, stackptr);
stackptr += sizeof(sljit_sw);
}
}
else
stackptr += sizeof(sljit_sw) * shared_count;
if (type != recurse_copy_private_to_global && type != recurse_swap_global)
{
SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_shared_to_global || type == recurse_copy_kept_shared_to_global);
for (i = 0; i < kept_shared_count; i++)
{
SLJIT_ASSERT(kept_shared_srcw[i] != 0);
if (!from_sp)
delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, kept_shared_srcw[i]);
if (from_sp || type == recurse_swap_global)
delayed_mem_copy_move(&status, SLJIT_SP, kept_shared_srcw[i], base_reg, stackptr);
stackptr += sizeof(sljit_sw);
}
}
else
stackptr += sizeof(sljit_sw) * kept_shared_count;
}
SLJIT_ASSERT(cc == ccend && stackptr == stacktop);
delayed_mem_copy_finish(&status);
}
| 0
|
195,082
|
void recalc_intercepts(struct vcpu_svm *svm)
{
struct vmcb_control_area *c, *h, *g;
unsigned int i;
vmcb_mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
if (!is_guest_mode(&svm->vcpu))
return;
c = &svm->vmcb->control;
h = &svm->vmcb01.ptr->control;
g = &svm->nested.ctl;
for (i = 0; i < MAX_INTERCEPT; i++)
c->intercepts[i] = h->intercepts[i];
if (g->int_ctl & V_INTR_MASKING_MASK) {
/* We only want the cr8 intercept bits of L1 */
vmcb_clr_intercept(c, INTERCEPT_CR8_READ);
vmcb_clr_intercept(c, INTERCEPT_CR8_WRITE);
/*
* Once running L2 with HF_VINTR_MASK, EFLAGS.IF does not
* affect any interrupt we may want to inject; therefore,
* interrupt window vmexits are irrelevant to L0.
*/
vmcb_clr_intercept(c, INTERCEPT_VINTR);
}
/* We don't want to see VMMCALLs from a nested guest */
vmcb_clr_intercept(c, INTERCEPT_VMMCALL);
for (i = 0; i < MAX_INTERCEPT; i++)
c->intercepts[i] |= g->intercepts[i];
/* If SMI is not intercepted, ignore guest SMI intercept as well */
if (!intercept_smi)
vmcb_clr_intercept(c, INTERCEPT_SMI);
}
| 1
|
513,367
|
static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
Item *having)
{
handler *file=table->file;
uchar *record=table->record[0];
int error;
DBUG_ENTER("remove_dup_with_compare");
if (file->ha_rnd_init_with_error(1))
DBUG_RETURN(1);
error= file->ha_rnd_next(record);
for (;;)
{
if (thd->check_killed())
{
thd->send_kill_message();
error=0;
goto err;
}
if (error)
{
if (error == HA_ERR_RECORD_DELETED)
{
error= file->ha_rnd_next(record);
continue;
}
if (error == HA_ERR_END_OF_FILE)
break;
goto err;
}
if (having && !having->val_int())
{
if ((error= file->ha_delete_row(record)))
goto err;
error= file->ha_rnd_next(record);
continue;
}
if (copy_blobs(first_field))
{
my_message(ER_OUTOFMEMORY, ER_THD(thd,ER_OUTOFMEMORY),
MYF(ME_FATALERROR));
error=0;
goto err;
}
store_record(table,record[1]);
/* Read through rest of file and mark duplicated rows deleted */
bool found=0;
for (;;)
{
if ((error= file->ha_rnd_next(record)))
{
if (error == HA_ERR_RECORD_DELETED)
continue;
if (error == HA_ERR_END_OF_FILE)
break;
goto err;
}
if (compare_record(table, first_field) == 0)
{
if ((error= file->ha_delete_row(record)))
goto err;
}
else if (!found)
{
found=1;
if ((error= file->remember_rnd_pos()))
goto err;
}
}
if (!found)
break; // End of file
/* Restart search on saved row */
if ((error= file->restart_rnd_next(record)))
goto err;
}
file->extra(HA_EXTRA_NO_CACHE);
(void) file->ha_rnd_end();
DBUG_RETURN(0);
err:
file->extra(HA_EXTRA_NO_CACHE);
(void) file->ha_rnd_end();
if (error)
file->print_error(error,MYF(0));
DBUG_RETURN(1);
}
| 0
|
245,154
|
char *make_argv(char *buf, size_t len, int argc, char **argv)
{
size_t left= len;
const char *arg;
buf[0]= 0;
++argv; --argc;
while (argc > 0 && left > 0)
{
arg = *argv;
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
arg = "--password=...";
}
if (strncmp(*argv, "-p", strlen("-p")) == 0) {
arg = "-p...";
}
if (strncmp(*argv, "--encrypt-key",
strlen("--encrypt-key")) == 0) {
arg = "--encrypt-key=...";
}
if (strncmp(*argv, "--encrypt_key",
strlen("--encrypt_key")) == 0) {
arg = "--encrypt_key=...";
}
if (strncmp(*argv, "--transition-key",
strlen("--transition-key")) == 0) {
arg = "--transition-key=...";
}
if (strncmp(*argv, "--transition_key",
strlen("--transition_key")) == 0) {
arg = "--transition_key=...";
}
left-= ut_snprintf(buf + len - left, left,
"%s%c", arg, argc > 1 ? ' ' : 0);
++argv; --argc;
}
return buf;
}
| 0
|
468,370
|
g_socket_client_connect (GSocketClient *client,
GSocketConnectable *connectable,
GCancellable *cancellable,
GError **error)
{
GIOStream *connection = NULL;
GSocketAddressEnumerator *enumerator = NULL;
GError *last_error, *tmp_error;
last_error = NULL;
if (can_use_proxy (client))
{
enumerator = g_socket_connectable_proxy_enumerate (connectable);
if (client->priv->proxy_resolver &&
G_IS_PROXY_ADDRESS_ENUMERATOR (enumerator))
{
g_object_set (G_OBJECT (enumerator),
"proxy-resolver", client->priv->proxy_resolver,
NULL);
}
}
else
enumerator = g_socket_connectable_enumerate (connectable);
while (connection == NULL)
{
GSocketAddress *address = NULL;
gboolean application_proxy = FALSE;
GSocket *socket;
gboolean using_proxy;
if (g_cancellable_is_cancelled (cancellable))
{
g_clear_error (error);
g_cancellable_set_error_if_cancelled (cancellable, error);
break;
}
tmp_error = NULL;
g_socket_client_emit_event (client, G_SOCKET_CLIENT_RESOLVING,
connectable, NULL);
address = g_socket_address_enumerator_next (enumerator, cancellable,
&tmp_error);
if (address == NULL)
{
if (tmp_error)
{
g_clear_error (&last_error);
g_propagate_error (error, tmp_error);
}
else if (last_error)
{
g_propagate_error (error, last_error);
}
else
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Unknown error on connect"));
break;
}
g_socket_client_emit_event (client, G_SOCKET_CLIENT_RESOLVED,
connectable, NULL);
using_proxy = (G_IS_PROXY_ADDRESS (address) &&
client->priv->enable_proxy);
/* clear error from previous attempt */
g_clear_error (&last_error);
socket = create_socket (client, address, &last_error);
if (socket == NULL)
{
g_object_unref (address);
continue;
}
connection = (GIOStream *)g_socket_connection_factory_create_connection (socket);
g_socket_connection_set_cached_remote_address ((GSocketConnection*)connection, address);
g_socket_client_emit_event (client, G_SOCKET_CLIENT_CONNECTING, connectable, connection);
if (g_socket_connection_connect (G_SOCKET_CONNECTION (connection),
address, cancellable, &last_error))
{
g_socket_connection_set_cached_remote_address ((GSocketConnection*)connection, NULL);
g_socket_client_emit_event (client, G_SOCKET_CLIENT_CONNECTED, connectable, connection);
}
else
{
clarify_connect_error (last_error, connectable, address);
g_object_unref (connection);
connection = NULL;
}
if (connection && using_proxy)
{
GProxyAddress *proxy_addr = G_PROXY_ADDRESS (address);
const gchar *protocol;
GProxy *proxy;
protocol = g_proxy_address_get_protocol (proxy_addr);
/* The connection should not be anything else then TCP Connection,
* but let's put a safety guard in case
*/
if (!G_IS_TCP_CONNECTION (connection))
{
g_critical ("Trying to proxy over non-TCP connection, this is "
"most likely a bug in GLib IO library.");
g_set_error_literal (&last_error,
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Proxying over a non-TCP connection is not supported."));
g_object_unref (connection);
connection = NULL;
}
else if (g_hash_table_contains (client->priv->app_proxies, protocol))
{
application_proxy = TRUE;
}
else if ((proxy = g_proxy_get_default_for_protocol (protocol)))
{
GIOStream *proxy_connection;
g_socket_client_emit_event (client, G_SOCKET_CLIENT_PROXY_NEGOTIATING, connectable, connection);
proxy_connection = g_proxy_connect (proxy,
connection,
proxy_addr,
cancellable,
&last_error);
g_object_unref (connection);
connection = proxy_connection;
g_object_unref (proxy);
if (connection)
g_socket_client_emit_event (client, G_SOCKET_CLIENT_PROXY_NEGOTIATED, connectable, connection);
}
else
{
g_set_error (&last_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Proxy protocol “%s” is not supported."),
protocol);
g_object_unref (connection);
connection = NULL;
}
}
if (!application_proxy && connection && client->priv->tls)
{
GIOStream *tlsconn;
tlsconn = g_tls_client_connection_new (connection, connectable, &last_error);
g_object_unref (connection);
connection = tlsconn;
if (tlsconn)
{
g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn),
client->priv->tls_validation_flags);
g_socket_client_emit_event (client, G_SOCKET_CLIENT_TLS_HANDSHAKING, connectable, connection);
if (g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn),
cancellable, &last_error))
{
g_socket_client_emit_event (client, G_SOCKET_CLIENT_TLS_HANDSHAKED, connectable, connection);
}
else
{
g_object_unref (tlsconn);
connection = NULL;
}
}
}
if (connection && !G_IS_SOCKET_CONNECTION (connection))
{
GSocketConnection *wrapper_connection;
wrapper_connection = g_tcp_wrapper_connection_new (connection, socket);
g_object_unref (connection);
connection = (GIOStream *)wrapper_connection;
}
g_object_unref (socket);
g_object_unref (address);
}
g_object_unref (enumerator);
g_socket_client_emit_event (client, G_SOCKET_CLIENT_COMPLETE, connectable, connection);
return G_SOCKET_CONNECTION (connection);
}
| 0
|
450,402
|
VncInfo2List *qmp_query_vnc_servers(Error **errp)
{
VncInfo2List *item, *prev = NULL;
VncInfo2 *info;
VncDisplay *vd;
DeviceState *dev;
size_t i;
QTAILQ_FOREACH(vd, &vnc_displays, next) {
info = g_new0(VncInfo2, 1);
info->id = g_strdup(vd->id);
info->clients = qmp_query_client_list(vd);
qmp_query_auth(vd->auth, vd->subauth, &info->auth,
&info->vencrypt, &info->has_vencrypt);
if (vd->dcl.con) {
dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con),
"device", NULL));
info->has_display = true;
info->display = g_strdup(dev->id);
}
for (i = 0; vd->listener != NULL && i < vd->listener->nsioc; i++) {
info->server = qmp_query_server_entry(
vd->listener->sioc[i], false, vd->auth, vd->subauth,
info->server);
}
for (i = 0; vd->wslistener != NULL && i < vd->wslistener->nsioc; i++) {
info->server = qmp_query_server_entry(
vd->wslistener->sioc[i], true, vd->ws_auth,
vd->ws_subauth, info->server);
}
item = g_new0(VncInfo2List, 1);
item->value = info;
item->next = prev;
prev = item;
}
return prev;
}
| 0
|
317,337
|
static inline u16 socket_type_to_security_class(int family, int type, int protocol)
{
int extsockclass = selinux_policycap_extsockclass();
switch (family) {
case PF_UNIX:
switch (type) {
case SOCK_STREAM:
case SOCK_SEQPACKET:
return SECCLASS_UNIX_STREAM_SOCKET;
case SOCK_DGRAM:
case SOCK_RAW:
return SECCLASS_UNIX_DGRAM_SOCKET;
}
break;
case PF_INET:
case PF_INET6:
switch (type) {
case SOCK_STREAM:
case SOCK_SEQPACKET:
if (default_protocol_stream(protocol))
return SECCLASS_TCP_SOCKET;
else if (extsockclass && protocol == IPPROTO_SCTP)
return SECCLASS_SCTP_SOCKET;
else
return SECCLASS_RAWIP_SOCKET;
case SOCK_DGRAM:
if (default_protocol_dgram(protocol))
return SECCLASS_UDP_SOCKET;
else if (extsockclass && (protocol == IPPROTO_ICMP ||
protocol == IPPROTO_ICMPV6))
return SECCLASS_ICMP_SOCKET;
else
return SECCLASS_RAWIP_SOCKET;
case SOCK_DCCP:
return SECCLASS_DCCP_SOCKET;
default:
return SECCLASS_RAWIP_SOCKET;
}
break;
case PF_NETLINK:
switch (protocol) {
case NETLINK_ROUTE:
return SECCLASS_NETLINK_ROUTE_SOCKET;
case NETLINK_SOCK_DIAG:
return SECCLASS_NETLINK_TCPDIAG_SOCKET;
case NETLINK_NFLOG:
return SECCLASS_NETLINK_NFLOG_SOCKET;
case NETLINK_XFRM:
return SECCLASS_NETLINK_XFRM_SOCKET;
case NETLINK_SELINUX:
return SECCLASS_NETLINK_SELINUX_SOCKET;
case NETLINK_ISCSI:
return SECCLASS_NETLINK_ISCSI_SOCKET;
case NETLINK_AUDIT:
return SECCLASS_NETLINK_AUDIT_SOCKET;
case NETLINK_FIB_LOOKUP:
return SECCLASS_NETLINK_FIB_LOOKUP_SOCKET;
case NETLINK_CONNECTOR:
return SECCLASS_NETLINK_CONNECTOR_SOCKET;
case NETLINK_NETFILTER:
return SECCLASS_NETLINK_NETFILTER_SOCKET;
case NETLINK_DNRTMSG:
return SECCLASS_NETLINK_DNRT_SOCKET;
case NETLINK_KOBJECT_UEVENT:
return SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET;
case NETLINK_GENERIC:
return SECCLASS_NETLINK_GENERIC_SOCKET;
case NETLINK_SCSITRANSPORT:
return SECCLASS_NETLINK_SCSITRANSPORT_SOCKET;
case NETLINK_RDMA:
return SECCLASS_NETLINK_RDMA_SOCKET;
case NETLINK_CRYPTO:
return SECCLASS_NETLINK_CRYPTO_SOCKET;
default:
return SECCLASS_NETLINK_SOCKET;
}
case PF_PACKET:
return SECCLASS_PACKET_SOCKET;
case PF_KEY:
return SECCLASS_KEY_SOCKET;
case PF_APPLETALK:
return SECCLASS_APPLETALK_SOCKET;
}
if (extsockclass) {
switch (family) {
case PF_AX25:
return SECCLASS_AX25_SOCKET;
case PF_IPX:
return SECCLASS_IPX_SOCKET;
case PF_NETROM:
return SECCLASS_NETROM_SOCKET;
case PF_ATMPVC:
return SECCLASS_ATMPVC_SOCKET;
case PF_X25:
return SECCLASS_X25_SOCKET;
case PF_ROSE:
return SECCLASS_ROSE_SOCKET;
case PF_DECnet:
return SECCLASS_DECNET_SOCKET;
case PF_ATMSVC:
return SECCLASS_ATMSVC_SOCKET;
case PF_RDS:
return SECCLASS_RDS_SOCKET;
case PF_IRDA:
return SECCLASS_IRDA_SOCKET;
case PF_PPPOX:
return SECCLASS_PPPOX_SOCKET;
case PF_LLC:
return SECCLASS_LLC_SOCKET;
case PF_CAN:
return SECCLASS_CAN_SOCKET;
case PF_TIPC:
return SECCLASS_TIPC_SOCKET;
case PF_BLUETOOTH:
return SECCLASS_BLUETOOTH_SOCKET;
case PF_IUCV:
return SECCLASS_IUCV_SOCKET;
case PF_RXRPC:
return SECCLASS_RXRPC_SOCKET;
case PF_ISDN:
return SECCLASS_ISDN_SOCKET;
case PF_PHONET:
return SECCLASS_PHONET_SOCKET;
case PF_IEEE802154:
return SECCLASS_IEEE802154_SOCKET;
case PF_CAIF:
return SECCLASS_CAIF_SOCKET;
case PF_ALG:
return SECCLASS_ALG_SOCKET;
case PF_NFC:
return SECCLASS_NFC_SOCKET;
case PF_VSOCK:
return SECCLASS_VSOCK_SOCKET;
case PF_KCM:
return SECCLASS_KCM_SOCKET;
case PF_QIPCRTR:
return SECCLASS_QIPCRTR_SOCKET;
case PF_SMC:
return SECCLASS_SMC_SOCKET;
case PF_XDP:
return SECCLASS_XDP_SOCKET;
case PF_MCTP:
return SECCLASS_MCTP_SOCKET;
#if PF_MAX > 46
#error New address family defined, please update this function.
#endif
}
}
return SECCLASS_SOCKET;
}
| 0
|
502,733
|
int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len)
{
if (s->version >= TLS1_VERSION) {
if (s->tlsext_session_ticket) {
OPENSSL_free(s->tlsext_session_ticket);
s->tlsext_session_ticket = NULL;
}
s->tlsext_session_ticket =
OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
if (!s->tlsext_session_ticket) {
SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE);
return 0;
}
if (ext_data) {
s->tlsext_session_ticket->length = ext_len;
s->tlsext_session_ticket->data = s->tlsext_session_ticket + 1;
memcpy(s->tlsext_session_ticket->data, ext_data, ext_len);
} else {
s->tlsext_session_ticket->length = 0;
s->tlsext_session_ticket->data = NULL;
}
return 1;
}
return 0;
}
| 0
|
294,489
|
date_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE vy, vm, vd, vsg, y, fr, fr2, ret;
int m, d;
double sg;
struct SimpleDateData *dat = rb_check_typeddata(self, &d_lite_type);
if (!simple_dat_p(dat)) {
rb_raise(rb_eTypeError, "Date expected");
}
rb_scan_args(argc, argv, "04", &vy, &vm, &vd, &vsg);
y = INT2FIX(-4712);
m = 1;
d = 1;
fr2 = INT2FIX(0);
sg = DEFAULT_SG;
switch (argc) {
case 4:
val2sg(vsg, sg);
case 3:
check_numeric(vd, "day");
num2int_with_frac(d, positive_inf);
case 2:
check_numeric(vm, "month");
m = NUM2INT(vm);
case 1:
check_numeric(vy, "year");
y = vy;
}
if (guess_style(y, sg) < 0) {
VALUE nth;
int ry, rm, rd;
if (!valid_gregorian_p(y, m, d,
&nth, &ry,
&rm, &rd))
rb_raise(eDateError, "invalid date");
set_to_simple(self, dat, nth, 0, sg, ry, rm, rd, HAVE_CIVIL);
}
else {
VALUE nth;
int ry, rm, rd, rjd, ns;
if (!valid_civil_p(y, m, d, sg,
&nth, &ry,
&rm, &rd, &rjd,
&ns))
rb_raise(eDateError, "invalid date");
set_to_simple(self, dat, nth, rjd, sg, ry, rm, rd, HAVE_JD | HAVE_CIVIL);
}
ret = self;
add_frac();
return ret;
}
| 0
|
225,405
|
static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
{
struct v4l2_loopback_device *dev;
struct v4l2_loopback_opener *opener;
int index;
struct v4l2l_buffer *b;
dev = v4l2loopback_getdevice(file);
opener = fh_to_opener(fh);
if (opener->timeout_image_io) {
*buf = dev->timeout_image_buffer.buffer;
return 0;
}
switch (buf->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
index = get_capture_buffer(file);
if (index < 0)
return index;
dprintkrw("capture DQBUF pos: %d index: %d\n",
opener->read_position - 1, index);
if (!(dev->buffers[index].buffer.flags &
V4L2_BUF_FLAG_MAPPED)) {
dprintk("trying to return not mapped buf[%d]\n", index);
return -EINVAL;
}
unset_flags(&dev->buffers[index]);
*buf = dev->buffers[index].buffer;
return 0;
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
b = list_entry(dev->outbufs_list.prev, struct v4l2l_buffer,
list_head);
list_move_tail(&b->list_head, &dev->outbufs_list);
dprintkrw("output DQBUF index: %d\n", b->buffer.index);
unset_flags(b);
*buf = b->buffer;
buf->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
return 0;
default:
return -EINVAL;
}
}
| 0
|
279,943
|
ex_align(exarg_T *eap)
{
pos_T save_curpos;
int len;
int indent = 0;
int new_indent;
int has_tab;
int width;
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
{
// switch left and right aligning
if (eap->cmdidx == CMD_right)
eap->cmdidx = CMD_left;
else if (eap->cmdidx == CMD_left)
eap->cmdidx = CMD_right;
}
#endif
width = atoi((char *)eap->arg);
save_curpos = curwin->w_cursor;
if (eap->cmdidx == CMD_left) // width is used for new indent
{
if (width >= 0)
indent = width;
}
else
{
/*
* if 'textwidth' set, use it
* else if 'wrapmargin' set, use it
* if invalid value, use 80
*/
if (width <= 0)
width = curbuf->b_p_tw;
if (width == 0 && curbuf->b_p_wm > 0)
width = curwin->w_width - curbuf->b_p_wm;
if (width <= 0)
width = 80;
}
if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
return;
for (curwin->w_cursor.lnum = eap->line1;
curwin->w_cursor.lnum <= eap->line2; ++curwin->w_cursor.lnum)
{
if (eap->cmdidx == CMD_left) // left align
new_indent = indent;
else
{
has_tab = FALSE; // avoid uninit warnings
len = linelen(eap->cmdidx == CMD_right ? &has_tab
: NULL) - get_indent();
if (len <= 0) // skip blank lines
continue;
if (eap->cmdidx == CMD_center)
new_indent = (width - len) / 2;
else
{
new_indent = width - len; // right align
/*
* Make sure that embedded TABs don't make the text go too far
* to the right.
*/
if (has_tab)
while (new_indent > 0)
{
(void)set_indent(new_indent, 0);
if (linelen(NULL) <= width)
{
/*
* Now try to move the line as much as possible to
* the right. Stop when it moves too far.
*/
do
(void)set_indent(++new_indent, 0);
while (linelen(NULL) <= width);
--new_indent;
break;
}
--new_indent;
}
}
}
if (new_indent < 0)
new_indent = 0;
(void)set_indent(new_indent, 0); // set indent
}
changed_lines(eap->line1, 0, eap->line2 + 1, 0L);
curwin->w_cursor = save_curpos;
beginline(BL_WHITE | BL_FIX);
}
| 0
|
312,502
|
qf_entry_on_or_after_pos(qfline_T *qfp, pos_T *pos, int linewise)
{
if (linewise)
return qfp->qf_lnum >= pos->lnum;
else
return (qfp->qf_lnum > pos->lnum ||
(qfp->qf_lnum == pos->lnum && qfp->qf_col >= pos->col));
}
| 0
|
310,197
|
NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx
chtype newmode,
NCURSES_SP_OUTC outc)
{
attr_t turn_on, turn_off;
int pair;
bool reverse = FALSE;
bool can_color = (SP_PARM == 0 || SP_PARM->_coloron);
#if NCURSES_EXT_FUNCS
bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color);
#else
#define fix_pair0 FALSE
#endif
newmode &= A_ATTRIBUTES;
T((T_CALLED("vidputs(%p,%s)"), (void *) SP_PARM, _traceattr(newmode)));
if (!IsValidTIScreen(SP_PARM))
returnCode(ERR);
/* this allows us to go on whether or not newterm() has been called */
if (SP_PARM)
PreviousAttr = AttrOf(SCREEN_ATTRS(SP_PARM));
TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr)));
if ((SP_PARM != 0)
&& (magic_cookie_glitch > 0)) {
#if USE_XMC_SUPPORT
static const chtype table[] =
{
A_STANDOUT,
A_UNDERLINE,
A_REVERSE,
A_BLINK,
A_DIM,
A_BOLD,
A_INVIS,
A_PROTECT,
#if USE_ITALIC
A_ITALIC,
#endif
};
unsigned n;
int used = 0;
#ifdef max_attributes /* not in U/Win */
int limit = (max_attributes <= 0) ? 1 : max_attributes;
#else
int limit = 1;
#endif
chtype retain = 0;
/*
* Limit the number of attribute bits set in the newmode according to
* the terminfo max_attributes value.
*/
for (n = 0; n < SIZEOF(table); ++n) {
if ((table[n] & SP_PARM->_ok_attributes) == 0) {
newmode &= ~table[n];
} else if ((table[n] & newmode) != 0) {
if (used++ >= limit) {
newmode &= ~table[n];
if (newmode == retain)
break;
} else {
retain = newmode;
}
}
}
#else
newmode &= ~(SP_PARM->_xmc_suppress);
#endif
TR(TRACE_ATTRS, ("suppressed attribute is %s", _traceattr(newmode)));
}
/*
* If we have a terminal that cannot combine color with video
* attributes, use the colors in preference.
*/
if (((newmode & A_COLOR) != 0
|| fix_pair0)
&& (no_color_video > 0)) {
/*
* If we had chosen the A_xxx definitions to correspond to the
* no_color_video mask, we could simply shift it up and mask off the
* attributes. But we did not (actually copied Solaris' definitions).
* However, this is still simpler/faster than a lookup table.
*
* The 63 corresponds to A_STANDOUT, A_UNDERLINE, A_REVERSE, A_BLINK,
* A_DIM, A_BOLD which are 1:1 with no_color_video. The bits that
* correspond to A_INVIS, A_PROTECT (192) must be shifted up 1 and
* A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS
* macro so this will work properly for the wide-character layout.
*/
unsigned value = (unsigned) no_color_video;
attr_t mask = NCURSES_BITS((value & 63)
| ((value & 192) << 1)
| ((value & 256) >> 2), 8);
if ((mask & A_REVERSE) != 0
&& (newmode & A_REVERSE) != 0) {
reverse = TRUE;
mask &= ~A_REVERSE;
}
newmode &= ~mask;
}
if (newmode == PreviousAttr)
returnCode(OK);
pair = PairNumber(newmode);
if (reverse) {
newmode &= ~A_REVERSE;
}
turn_off = (~newmode & PreviousAttr) & ALL_BUT_COLOR;
turn_on = (newmode & ~(PreviousAttr & TPARM_ATTR)) & ALL_BUT_COLOR;
SetColorsIf(((pair == 0) && !fix_pair0), PreviousAttr);
if (newmode == A_NORMAL) {
if ((PreviousAttr & A_ALTCHARSET) && exit_alt_charset_mode) {
doPut(exit_alt_charset_mode);
PreviousAttr &= ~A_ALTCHARSET;
}
if (PreviousAttr) {
if (exit_attribute_mode) {
doPut(exit_attribute_mode);
} else {
if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
#if USE_ITALIC
if (!SP_PARM || SP_PARM->_use_ritm) {
TurnOff(A_ITALIC, exit_italics_mode);
}
#endif
}
PreviousAttr &= ALL_BUT_COLOR;
}
SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
TIPARM_9(set_attributes,
(newmode & A_STANDOUT) != 0,
(newmode & A_UNDERLINE) != 0,
(newmode & A_REVERSE) != 0,
(newmode & A_BLINK) != 0,
(newmode & A_DIM) != 0,
(newmode & A_BOLD) != 0,
(newmode & A_INVIS) != 0,
(newmode & A_PROTECT) != 0,
(newmode & A_ALTCHARSET) != 0),
1, outc);
PreviousAttr &= ALL_BUT_COLOR;
}
#if USE_ITALIC
if (!SP_PARM || SP_PARM->_use_ritm) {
if (turn_on & A_ITALIC) {
TurnOn(A_ITALIC, enter_italics_mode);
} else if (turn_off & A_ITALIC) {
TurnOff(A_ITALIC, exit_italics_mode);
}
}
#endif
SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
} else {
TR(TRACE_ATTRS, ("turning %s off", _traceattr(turn_off)));
TurnOff(A_ALTCHARSET, exit_alt_charset_mode);
if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
#if USE_ITALIC
if (!SP_PARM || SP_PARM->_use_ritm) {
TurnOff(A_ITALIC, exit_italics_mode);
}
#endif
if (turn_off && exit_attribute_mode) {
doPut(exit_attribute_mode);
turn_on |= (newmode & ALL_BUT_COLOR);
PreviousAttr &= ALL_BUT_COLOR;
}
SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
TR(TRACE_ATTRS, ("turning %s on", _traceattr(turn_on)));
/* *INDENT-OFF* */
TurnOn(A_ALTCHARSET, enter_alt_charset_mode);
TurnOn(A_BLINK, enter_blink_mode);
TurnOn(A_BOLD, enter_bold_mode);
TurnOn(A_DIM, enter_dim_mode);
TurnOn(A_REVERSE, enter_reverse_mode);
TurnOn(A_STANDOUT, enter_standout_mode);
TurnOn(A_PROTECT, enter_protected_mode);
TurnOn(A_INVIS, enter_secure_mode);
TurnOn(A_UNDERLINE, enter_underline_mode);
#if USE_ITALIC
TurnOn(A_ITALIC, enter_italics_mode);
#endif
#if USE_WIDEC_SUPPORT && defined(enter_horizontal_hl_mode)
TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode);
TurnOn(A_LEFT, enter_left_hl_mode);
TurnOn(A_LOW, enter_low_hl_mode);
TurnOn(A_RIGHT, enter_right_hl_mode);
TurnOn(A_TOP, enter_top_hl_mode);
TurnOn(A_VERTICAL, enter_vertical_hl_mode);
#endif
/* *INDENT-ON* */
}
if (reverse)
newmode |= A_REVERSE;
if (SP_PARM)
SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
else
PreviousAttr = newmode;
returnCode(OK);
}
| 0
|
234,712
|
int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical)
{
struct btrfs_block_group *cache;
/* Do not attempt to repair in degraded state */
if (btrfs_test_opt(fs_info, DEGRADED))
return 0;
cache = btrfs_lookup_block_group(fs_info, logical);
if (!cache)
return 0;
spin_lock(&cache->lock);
if (cache->relocating_repair) {
spin_unlock(&cache->lock);
btrfs_put_block_group(cache);
return 0;
}
cache->relocating_repair = 1;
spin_unlock(&cache->lock);
kthread_run(relocating_repair_kthread, cache,
"btrfs-relocating-repair");
return 0;
}
| 0
|
254,724
|
njs_typed_array_generic_compare(const void *a, const void *b, void *c)
{
double num;
njs_int_t ret;
njs_value_t arguments[3], retval;
njs_typed_array_sort_ctx_t *ctx;
ctx = c;
if (njs_slow_path(ctx->exception)) {
return 0;
}
njs_set_undefined(&arguments[0]);
njs_set_number(&arguments[1], ctx->get(a));
njs_set_number(&arguments[2], ctx->get(b));
ret = njs_function_apply(ctx->vm, ctx->function, arguments, 3, &retval);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
ret = njs_value_to_number(ctx->vm, &retval, &num);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
if (njs_slow_path(njs_is_detached_buffer(ctx->buffer))) {
njs_type_error(ctx->vm, "detached buffer");
goto exception;
}
if (njs_slow_path(isnan(num))) {
return 0;
}
if (num != 0) {
return (num > 0) - (num < 0);
}
return 0;
exception:
ctx->exception = 1;
return 0;
}
| 0
|
90,745
|
bool AppendEntry(const TableEntry& entry) {
entries_.push_back(entry);
return true;
}
| 0
|
386,548
|
void DL_Dxf::addImage(DL_CreationInterface* creationInterface) {
DL_ImageData id(// pass ref insead of name we don't have yet
getStringValue(340, ""),
// ins point:
getRealValue(10, 0.0),
getRealValue(20, 0.0),
getRealValue(30, 0.0),
// u vector:
getRealValue(11, 1.0),
getRealValue(21, 0.0),
getRealValue(31, 0.0),
// v vector:
getRealValue(12, 0.0),
getRealValue(22, 1.0),
getRealValue(32, 0.0),
// image size (pixel):
getIntValue(13, 1),
getIntValue(23, 1),
// brightness, contrast, fade
getIntValue(281, 50),
getIntValue(282, 50),
getIntValue(283, 0));
creationInterface->addImage(id);
creationInterface->endEntity();
currentObjectType = DL_UNKNOWN;
}
| 0
|
309,946
|
set_colors(int fg, int bg)
{
int pair = mypair(fg, bg);
if (pair > 0) {
(void) color_set((short) pair, NewPair(pair));
}
}
| 0
|
512,560
|
void Item_equal::add_const(THD *thd, Item *c)
{
if (cond_false)
return;
if (!with_const)
{
with_const= TRUE;
equal_items.push_front(c, thd->mem_root);
return;
}
/*
Suppose we have an expression (with a string type field) like this:
WHERE field=const1 AND field=const2 ...
For all pairs field=constXXX we know that:
- Item_func_eq::fix_length_and_dec() performed collation and character
set aggregation and added character set converters when needed.
Note, the case like:
WHERE field=const1 COLLATE latin1_bin AND field=const2
is not handled here, because the field would be replaced to
Item_func_set_collation, which cannot get into Item_equal.
So all constXXX that are handled by Item_equal
already have compatible character sets with "field".
- Also, Field_str::test_if_equality_guarantees_uniqueness() guarantees
that the comparison collation of all equalities handled by Item_equal
match the the collation of the field.
Therefore, at Item_equal::add_const() time all constants constXXX
should be directly comparable to each other without an additional
character set conversion.
It's safe to do val_str() for "const_item" and "c" and compare
them according to the collation of the *field*.
So in a script like this:
CREATE TABLE t1 (a VARCHAR(10) COLLATE xxx);
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1 WHERE a='a' AND a='A';
Item_equal::add_const() effectively rewrites the condition to:
SELECT * FROM t1 WHERE a='a' AND 'a' COLLATE xxx='A';
and then to:
SELECT * FROM t1 WHERE a='a'; // if the two constants were equal
// e.g. in case of latin1_swedish_ci
or to:
SELECT * FROM t1 WHERE FALSE; // if the two constants were not equal
// e.g. in case of latin1_bin
Note, both "const_item" and "c" can return NULL, e.g.:
SELECT * FROM t1 WHERE a=NULL AND a='const';
SELECT * FROM t1 WHERE a='const' AND a=NULL;
SELECT * FROM t1 WHERE a='const' AND a=(SELECT MAX(a) FROM t2)
*/
cond_false= !Item_equal::compare_type_handler()->Item_eq_value(thd, this, c,
get_const());
if (with_const && equal_items.elements == 1)
cond_true= TRUE;
if (cond_false || cond_true)
const_item_cache= 1;
}
| 0
|
408,968
|
bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
{
int c;
char_u buf[NUMBUFLEN + MB_MAXBYTES];
int idx = 0;
char_u *end = find_termcode((char_u *)"PE");
int ret_char = -1;
int save_allow_keys = allow_keys;
int save_paste = p_paste;
// If the end code is too long we can't detect it, read everything.
if (end != NULL && STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
allow_keys = 0;
if (!p_paste)
// Also have the side effects of setting 'paste' to make it work much
// faster.
set_option_value((char_u *)"paste", TRUE, NULL, 0);
for (;;)
{
// When the end is not defined read everything there is.
if (end == NULL && vpeekc() == NUL)
break;
do
c = vgetc();
while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C))
// When CTRL-C was encountered the typeahead will be flushed and we
// won't get the end sequence. Except when using ":normal".
break;
if (has_mbyte)
idx += (*mb_char2bytes)(c, buf + idx);
else
buf[idx++] = c;
buf[idx] = NUL;
if (end != NULL && STRNCMP(buf, end, idx) == 0)
{
if (end[idx] == NUL)
break; // Found the end of paste code.
continue;
}
if (!drop)
{
switch (mode)
{
case PASTE_CMDLINE:
put_on_cmdline(buf, idx, TRUE);
break;
case PASTE_EX:
// add one for the NUL that is going to be appended
if (gap != NULL && ga_grow(gap, idx + 1) == OK)
{
mch_memmove((char *)gap->ga_data + gap->ga_len,
buf, (size_t)idx);
gap->ga_len += idx;
}
break;
case PASTE_INSERT:
if (stop_arrow() == OK)
{
c = buf[0];
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
ins_eol(c);
else
{
ins_char_bytes(buf, idx);
AppendToRedobuffLit(buf, idx);
}
}
break;
case PASTE_ONE_CHAR:
if (ret_char == -1)
{
if (has_mbyte)
ret_char = (*mb_ptr2char)(buf);
else
ret_char = buf[0];
}
break;
}
}
idx = 0;
}
--no_mapping;
allow_keys = save_allow_keys;
if (!save_paste)
set_option_value((char_u *)"paste", FALSE, NULL, 0);
return ret_char;
}
| 0
|
274,749
|
callbacks_open_activate(GtkMenuItem *menuitem, gpointer user_data)
{
GSList *fns = NULL;
screen.win.gerber =
gtk_file_chooser_dialog_new (
_("Open Gerbv project, Gerber, drill, "
"or pick&place files"),
NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_select_multiple(
(GtkFileChooser *)screen.win.gerber, TRUE);
gtk_file_chooser_set_current_folder(
(GtkFileChooser *)screen.win.gerber, mainProject->path);
gtk_widget_show (screen.win.gerber);
if (gtk_dialog_run ((GtkDialog*)screen.win.gerber) ==
GTK_RESPONSE_ACCEPT) {
fns = gtk_file_chooser_get_filenames(
GTK_FILE_CHOOSER (screen.win.gerber));
/* Update the last folder */
g_free (mainProject->path);
mainProject->path = gtk_file_chooser_get_current_folder(
(GtkFileChooser *)screen.win.gerber);
}
gtk_widget_destroy (screen.win.gerber);
open_files (fns);
g_slist_free_full (fns, g_free);
}
| 0
|
267,977
|
static ut64 binobj_a2b(RBinObject *bo, ut64 addr) {
return addr + (bo ? bo->baddr_shift : 0);
}
| 0
|
204,137
|
bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str,
const double *ptm, int paintType, int /*tilingType*/, Dict *resDict,
const double *mat, const double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep)
{
PDFRectangle box;
Gfx *gfx;
Splash *formerSplash = splash;
SplashBitmap *formerBitmap = bitmap;
double width, height;
int surface_width, surface_height, result_width, result_height, i;
int repeatX, repeatY;
SplashCoord matc[6];
Matrix m1;
const double *ctm;
double savedCTM[6];
double kx, ky, sx, sy;
bool retValue = false;
width = bbox[2] - bbox[0];
height = bbox[3] - bbox[1];
if (xStep != width || yStep != height)
return false;
// calculate offsets
ctm = state->getCTM();
for (i = 0; i < 6; ++i) {
savedCTM[i] = ctm[i];
}
state->concatCTM(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
state->concatCTM(1, 0, 0, 1, bbox[0], bbox[1]);
ctm = state->getCTM();
for (i = 0; i < 6; ++i) {
if (!std::isfinite(ctm[i])) {
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
return false;
}
}
matc[4] = x0 * xStep * ctm[0] + y0 * yStep * ctm[2] + ctm[4];
matc[5] = x0 * xStep * ctm[1] + y0 * yStep * ctm[3] + ctm[5];
if (splashAbs(ctm[1]) > splashAbs(ctm[0])) {
kx = -ctm[1];
ky = ctm[2] - (ctm[0] * ctm[3]) / ctm[1];
} else {
kx = ctm[0];
ky = ctm[3] - (ctm[1] * ctm[2]) / ctm[0];
}
result_width = (int) ceil(fabs(kx * width * (x1 - x0)));
result_height = (int) ceil(fabs(ky * height * (y1 - y0)));
kx = state->getHDPI() / 72.0;
ky = state->getVDPI() / 72.0;
m1.m[0] = (ptm[0] == 0) ? fabs(ptm[2]) * kx : fabs(ptm[0]) * kx;
m1.m[1] = 0;
m1.m[2] = 0;
m1.m[3] = (ptm[3] == 0) ? fabs(ptm[1]) * ky : fabs(ptm[3]) * ky;
m1.m[4] = 0;
m1.m[5] = 0;
m1.transform(width, height, &kx, &ky);
surface_width = (int) ceil (fabs(kx));
surface_height = (int) ceil (fabs(ky));
sx = (double) result_width / (surface_width * (x1 - x0));
sy = (double) result_height / (surface_height * (y1 - y0));
m1.m[0] *= sx;
m1.m[3] *= sy;
m1.transform(width, height, &kx, &ky);
if(fabs(kx) < 1 && fabs(ky) < 1) {
kx = std::min<double>(kx, ky);
ky = 2 / kx;
m1.m[0] *= ky;
m1.m[3] *= ky;
m1.transform(width, height, &kx, &ky);
surface_width = (int) ceil (fabs(kx));
surface_height = (int) ceil (fabs(ky));
repeatX = x1 - x0;
repeatY = y1 - y0;
} else {
if ((unsigned long) surface_width * surface_height > 0x800000L) {
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
return false;
}
while(fabs(kx) > 16384 || fabs(ky) > 16384) {
// limit pattern bitmap size
m1.m[0] /= 2;
m1.m[3] /= 2;
m1.transform(width, height, &kx, &ky);
}
surface_width = (int) ceil (fabs(kx));
surface_height = (int) ceil (fabs(ky));
// adjust repeat values to completely fill region
repeatX = result_width / surface_width;
repeatY = result_height / surface_height;
if (surface_width * repeatX < result_width)
repeatX++;
if (surface_height * repeatY < result_height)
repeatY++;
if (x1 - x0 > repeatX)
repeatX = x1 - x0;
if (y1 - y0 > repeatY)
repeatY = y1 - y0;
}
// restore CTM and calculate rotate and scale with rounded matrix
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
state->concatCTM(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
state->concatCTM(width * repeatX, 0, 0, height * repeatY, bbox[0], bbox[1]);
ctm = state->getCTM();
matc[0] = ctm[0];
matc[1] = ctm[1];
matc[2] = ctm[2];
matc[3] = ctm[3];
if (surface_width == 0 || surface_height == 0 || repeatX * repeatY <= 4) {
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
return false;
}
m1.transform(bbox[0], bbox[1], &kx, &ky);
m1.m[4] = -kx;
m1.m[5] = -ky;
bitmap = new SplashBitmap(surface_width, surface_height, 1,
(paintType == 1) ? colorMode : splashModeMono8, true);
if (bitmap->getDataPtr() == nullptr) {
SplashBitmap *tBitmap = bitmap;
bitmap = formerBitmap;
delete tBitmap;
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
return false;
}
splash = new Splash(bitmap, true);
if (paintType == 2) {
SplashColor clearColor;
#ifdef SPLASH_CMYK
clearColor[0] = (colorMode == splashModeCMYK8 || colorMode == splashModeDeviceN8) ? 0x00 : 0xFF;
#else
clearColor[0] = 0xFF;
#endif
splash->clear(clearColor, 0);
} else {
splash->clear(paperColor, 0);
}
splash->setThinLineMode(formerSplash->getThinLineMode());
splash->setMinLineWidth(s_minLineWidth);
box.x1 = bbox[0]; box.y1 = bbox[1];
box.x2 = bbox[2]; box.y2 = bbox[3];
gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA);
// set pattern transformation matrix
gfx->getState()->setCTM(m1.m[0], m1.m[1], m1.m[2], m1.m[3], m1.m[4], m1.m[5]);
updateCTM(gfx->getState(), m1.m[0], m1.m[1], m1.m[2], m1.m[3], m1.m[4], m1.m[5]);
gfx->display(str);
delete splash;
splash = formerSplash;
TilingSplashOutBitmap imgData;
imgData.bitmap = bitmap;
imgData.paintType = paintType;
imgData.pattern = splash->getFillPattern();
imgData.colorMode = colorMode;
imgData.y = 0;
imgData.repeatX = repeatX;
imgData.repeatY = repeatY;
SplashBitmap *tBitmap = bitmap;
bitmap = formerBitmap;
result_width = tBitmap->getWidth() * imgData.repeatX;
result_height = tBitmap->getHeight() * imgData.repeatY;
if (splashAbs(matc[1]) > splashAbs(matc[0])) {
kx = -matc[1];
ky = matc[2] - (matc[0] * matc[3]) / matc[1];
} else {
kx = matc[0];
ky = matc[3] - (matc[1] * matc[2]) / matc[0];
}
kx = result_width / (fabs(kx) + 1);
ky = result_height / (fabs(ky) + 1);
state->concatCTM(kx, 0, 0, ky, 0, 0);
ctm = state->getCTM();
matc[0] = ctm[0];
matc[1] = ctm[1];
matc[2] = ctm[2];
matc[3] = ctm[3];
bool minorAxisZero = matc[1] == 0 && matc[2] == 0;
if (matc[0] > 0 && minorAxisZero && matc[3] > 0) {
// draw the tiles
for (int y = 0; y < imgData.repeatY; ++y) {
for (int x = 0; x < imgData.repeatX; ++x) {
x0 = splashFloor(matc[4]) + x * tBitmap->getWidth();
y0 = splashFloor(matc[5]) + y * tBitmap->getHeight();
splash->blitImage(tBitmap, true, x0, y0);
}
}
retValue = true;
} else {
retValue = splash->drawImage(&tilingBitmapSrc, nullptr, &imgData, colorMode, true, result_width, result_height, matc, false, true) == splashOk;
}
delete tBitmap;
delete gfx;
return retValue;
}
| 1
|
366,240
|
int __mnt_want_write_file(struct file *file)
{
if (file->f_mode & FMODE_WRITER) {
/*
* Superblock may have become readonly while there are still
* writable fd's, e.g. due to a fs error with errors=remount-ro
*/
if (__mnt_is_readonly(file->f_path.mnt))
return -EROFS;
return 0;
}
return __mnt_want_write(file->f_path.mnt);
}
| 0
|
512,636
|
bool Item_bool_rowready_func2::fix_length_and_dec()
{
max_length= 1; // Function returns 0 or 1
/*
As some compare functions are generated after sql_yacc,
we have to check for out of memory conditions here
*/
if (!args[0] || !args[1])
return FALSE;
return setup_args_and_comparator(current_thd, &cmp);
}
| 0
|
474,075
|
onig_error_code_to_format(int code)
{
const char *p;
if (code >= 0) return (UChar* )0;
switch (code) {
case ONIG_MISMATCH:
p = "mismatch"; break;
case ONIG_NO_SUPPORT_CONFIG:
p = "no support in this configuration"; break;
case ONIGERR_MEMORY:
p = "failed to allocate memory"; break;
case ONIGERR_MATCH_STACK_LIMIT_OVER:
p = "match-stack limit over"; break;
case ONIGERR_TYPE_BUG:
p = "undefined type (bug)"; break;
case ONIGERR_PARSER_BUG:
p = "internal parser error (bug)"; break;
case ONIGERR_STACK_BUG:
p = "stack error (bug)"; break;
case ONIGERR_UNDEFINED_BYTECODE:
p = "undefined bytecode (bug)"; break;
case ONIGERR_UNEXPECTED_BYTECODE:
p = "unexpected bytecode (bug)"; break;
case ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED:
p = "default multibyte-encoding is not setted"; break;
case ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR:
p = "can't convert to wide-char on specified multibyte-encoding"; break;
case ONIGERR_INVALID_ARGUMENT:
p = "invalid argument"; break;
case ONIGERR_END_PATTERN_AT_LEFT_BRACE:
p = "end pattern at left brace"; break;
case ONIGERR_END_PATTERN_AT_LEFT_BRACKET:
p = "end pattern at left bracket"; break;
case ONIGERR_EMPTY_CHAR_CLASS:
p = "empty char-class"; break;
case ONIGERR_PREMATURE_END_OF_CHAR_CLASS:
p = "premature end of char-class"; break;
case ONIGERR_END_PATTERN_AT_ESCAPE:
p = "end pattern at escape"; break;
case ONIGERR_END_PATTERN_AT_META:
p = "end pattern at meta"; break;
case ONIGERR_END_PATTERN_AT_CONTROL:
p = "end pattern at control"; break;
case ONIGERR_META_CODE_SYNTAX:
p = "invalid meta-code syntax"; break;
case ONIGERR_CONTROL_CODE_SYNTAX:
p = "invalid control-code syntax"; break;
case ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE:
p = "char-class value at end of range"; break;
case ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE:
p = "char-class value at start of range"; break;
case ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS:
p = "unmatched range specifier in char-class"; break;
case ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED:
p = "target of repeat operator is not specified"; break;
case ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID:
p = "target of repeat operator is invalid"; break;
case ONIGERR_NESTED_REPEAT_OPERATOR:
p = "nested repeat operator"; break;
case ONIGERR_UNMATCHED_CLOSE_PARENTHESIS:
p = "unmatched close parenthesis"; break;
case ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS:
p = "end pattern with unmatched parenthesis"; break;
case ONIGERR_END_PATTERN_IN_GROUP:
p = "end pattern in group"; break;
case ONIGERR_UNDEFINED_GROUP_OPTION:
p = "undefined group option"; break;
case ONIGERR_INVALID_POSIX_BRACKET_TYPE:
p = "invalid POSIX bracket type"; break;
case ONIGERR_INVALID_LOOK_BEHIND_PATTERN:
p = "invalid pattern in look-behind"; break;
case ONIGERR_INVALID_REPEAT_RANGE_PATTERN:
p = "invalid repeat range {lower,upper}"; break;
case ONIGERR_TOO_BIG_NUMBER:
p = "too big number"; break;
case ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE:
p = "too big number for repeat range"; break;
case ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE:
p = "upper is smaller than lower in repeat range"; break;
case ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS:
p = "empty range in char class"; break;
case ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE:
p = "mismatch multibyte code length in char-class range"; break;
case ONIGERR_TOO_MANY_MULTI_BYTE_RANGES:
p = "too many multibyte code ranges are specified"; break;
case ONIGERR_TOO_SHORT_MULTI_BYTE_STRING:
p = "too short multibyte code string"; break;
case ONIGERR_TOO_BIG_BACKREF_NUMBER:
p = "too big backref number"; break;
case ONIGERR_INVALID_BACKREF:
#ifdef USE_NAMED_GROUP
p = "invalid backref number/name"; break;
#else
p = "invalid backref number"; break;
#endif
case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED:
p = "numbered backref/call is not allowed. (use name)"; break;
case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE:
p = "too big wide-char value"; break;
case ONIGERR_TOO_LONG_WIDE_CHAR_VALUE:
p = "too long wide-char value"; break;
case ONIGERR_INVALID_CODE_POINT_VALUE:
p = "invalid code point value"; break;
case ONIGERR_EMPTY_GROUP_NAME:
p = "group name is empty"; break;
case ONIGERR_INVALID_GROUP_NAME:
p = "invalid group name <%n>"; break;
case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
#ifdef USE_NAMED_GROUP
p = "invalid char in group name <%n>"; break;
#else
p = "invalid char in group number <%n>"; break;
#endif
case ONIGERR_UNDEFINED_NAME_REFERENCE:
p = "undefined name <%n> reference"; break;
case ONIGERR_UNDEFINED_GROUP_REFERENCE:
p = "undefined group <%n> reference"; break;
case ONIGERR_MULTIPLEX_DEFINED_NAME:
p = "multiplex defined name <%n>"; break;
case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL:
p = "multiplex definition name <%n> call"; break;
case ONIGERR_NEVER_ENDING_RECURSION:
p = "never ending recursion"; break;
case ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY:
p = "group number is too big for capture history"; break;
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
p = "invalid character property name {%n}"; break;
case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION:
p = "not supported encoding combination"; break;
case ONIGERR_INVALID_COMBINATION_OF_OPTIONS:
p = "invalid combination of options"; break;
case ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT:
p = "over thread pass limit count"; break;
default:
p = "undefined error code"; break;
}
return (UChar* )p;
}
| 0
|
352,956
|
csnNormalize21(
slap_mask_t usage,
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
struct berval *normalized,
void *ctx )
{
struct berval gt, cnt, sid, mod;
struct berval bv;
char buf[ STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) + 1 ];
char *ptr;
ber_len_t i;
assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 );
assert( !BER_BVISEMPTY( val ) );
gt = *val;
ptr = ber_bvchr( >, '#' );
if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
gt.bv_len = ptr - gt.bv_val;
if ( gt.bv_len != STRLENOF( "YYYYmmddHH:MM:SSZ" ) ) {
return LDAP_INVALID_SYNTAX;
}
if ( gt.bv_val[ 10 ] != ':' || gt.bv_val[ 13 ] != ':' ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_val = ptr + 1;
cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val );
ptr = ber_bvchr( &cnt, '#' );
if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_len = ptr - cnt.bv_val;
if ( cnt.bv_len != STRLENOF( "0x0000" ) ) {
return LDAP_INVALID_SYNTAX;
}
if ( strncmp( cnt.bv_val, "0x", STRLENOF( "0x" ) ) != 0 ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_val += STRLENOF( "0x" );
cnt.bv_len -= STRLENOF( "0x" );
sid.bv_val = ptr + 1;
sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val );
ptr = ber_bvchr( &sid, '#' );
if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
sid.bv_len = ptr - sid.bv_val;
if ( sid.bv_len != STRLENOF( "0" ) ) {
return LDAP_INVALID_SYNTAX;
}
mod.bv_val = ptr + 1;
mod.bv_len = val->bv_len - ( mod.bv_val - val->bv_val );
if ( mod.bv_len != STRLENOF( "0000" ) ) {
return LDAP_INVALID_SYNTAX;
}
bv.bv_len = STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" );
bv.bv_val = buf;
ptr = bv.bv_val;
ptr = lutil_strncopy( ptr, gt.bv_val, STRLENOF( "YYYYmmddHH" ) );
ptr = lutil_strncopy( ptr, >.bv_val[ STRLENOF( "YYYYmmddHH:" ) ],
STRLENOF( "MM" ) );
ptr = lutil_strncopy( ptr, >.bv_val[ STRLENOF( "YYYYmmddHH:MM:" ) ],
STRLENOF( "SS" ) );
ptr = lutil_strcopy( ptr, ".000000Z#00" );
ptr = lutil_strbvcopy( ptr, &cnt );
*ptr++ = '#';
*ptr++ = '0';
*ptr++ = '0';
*ptr++ = sid.bv_val[ 0 ];
*ptr++ = '#';
*ptr++ = '0';
*ptr++ = '0';
for ( i = 0; i < mod.bv_len; i++ ) {
*ptr++ = TOLOWER( mod.bv_val[ i ] );
}
*ptr = '\0';
assert( ptr == &bv.bv_val[bv.bv_len] );
if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
ber_dupbv_x( normalized, &bv, ctx );
return LDAP_SUCCESS;
}
| 0
|
353,146
|
bool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) {
SplashFunctionPattern *pattern = new SplashFunctionPattern(colorMode, state, shading);
double xMin, yMin, xMax, yMax;
bool vaa = getVectorAntialias();
// restore vector antialias because we support it here
setVectorAntialias(true);
bool retVal = false;
// get the clip region bbox
if (pattern->getShading()->getHasBBox()) {
pattern->getShading()->getBBox(&xMin, &yMin, &xMax, &yMax);
} else {
state->getClipBBox(&xMin, &yMin, &xMax, &yMax);
xMin = floor (xMin);
yMin = floor (yMin);
xMax = ceil (xMax);
yMax = ceil (yMax);
{
Matrix ctm, ictm;
double x[4], y[4];
int i;
state->getCTM(&ctm);
ctm.invertTo(&ictm);
ictm.transform(xMin, yMin, &x[0], &y[0]);
ictm.transform(xMax, yMin, &x[1], &y[1]);
ictm.transform(xMin, yMax, &x[2], &y[2]);
ictm.transform(xMax, yMax, &x[3], &y[3]);
xMin = xMax = x[0];
yMin = yMax = y[0];
for (i = 1; i < 4; i++) {
xMin = std::min<double>(xMin, x[i]);
yMin = std::min<double>(yMin, y[i]);
xMax = std::max<double>(xMax, x[i]);
yMax = std::max<double>(yMax, y[i]);
}
}
}
// fill the region
state->moveTo(xMin, yMin);
state->lineTo(xMax, yMin);
state->lineTo(xMax, yMax);
state->lineTo(xMin, yMax);
state->closePath();
SplashPath path = convertPath(state, state->getPath(), true);
#ifdef SPLASH_CMYK
pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
#endif
setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
retVal = (splash->shadedFill(&path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
state->clearPath();
setVectorAntialias(vaa);
delete pattern;
return retVal;
}
| 0
|
264,287
|
static void send_ext_key_event_ack(VncState *vs)
{
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1);
vnc_framebuffer_update(vs, 0, 0,
surface_width(vs->vd->ds),
surface_height(vs->vd->ds),
VNC_ENCODING_EXT_KEY_EVENT);
vnc_unlock_output(vs);
vnc_flush(vs);
}
| 0
|
300,733
|
int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
int err;
u32 tsk_portid = cb->args[0];
u32 last_publ = cb->args[1];
u32 done = cb->args[2];
struct net *net = sock_net(skb->sk);
struct tipc_sock *tsk;
if (!tsk_portid) {
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1];
if (!attrs[TIPC_NLA_SOCK])
return -EINVAL;
err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX,
attrs[TIPC_NLA_SOCK],
tipc_nl_sock_policy, NULL);
if (err)
return err;
if (!sock[TIPC_NLA_SOCK_REF])
return -EINVAL;
tsk_portid = nla_get_u32(sock[TIPC_NLA_SOCK_REF]);
}
if (done)
return 0;
tsk = tipc_sk_lookup(net, tsk_portid);
if (!tsk)
return -EINVAL;
lock_sock(&tsk->sk);
err = __tipc_nl_list_sk_publ(skb, cb, tsk, &last_publ);
if (!err)
done = 1;
release_sock(&tsk->sk);
sock_put(&tsk->sk);
cb->args[0] = tsk_portid;
cb->args[1] = last_publ;
cb->args[2] = done;
return skb->len;
}
| 0
|
261,892
|
njs_string_prototype_pad(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t pad_start)
{
u_char *p, *start;
size_t padding, trunc, new_size;
int64_t length, new_length;
uint32_t n, pad_length;
njs_int_t ret;
njs_value_t *value, *pad;
const u_char *end;
njs_string_prop_t string, pad_string;
static const njs_value_t string_space = njs_string(" ");
ret = njs_string_object_validate(vm, njs_argument(args, 0));
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
length = njs_string_prop(&string, njs_argument(args, 0));
new_length = 0;
if (nargs > 1) {
value = njs_argument(args, 1);
if (njs_slow_path(!njs_is_number(value))) {
ret = njs_value_to_integer(vm, value, &new_length);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
} else {
new_length = njs_number_to_integer(njs_number(value));
}
}
if (new_length <= length) {
vm->retval = args[0];
return NJS_OK;
}
if (njs_slow_path(new_length >= NJS_STRING_MAX_LENGTH)) {
njs_range_error(vm, NULL);
return NJS_ERROR;
}
padding = new_length - length;
/* GCC and Clang complain about uninitialized n and trunc. */
n = 0;
trunc = 0;
pad = njs_arg(args, nargs, 2);
if (njs_slow_path(!njs_is_string(pad))) {
if (njs_is_undefined(pad)) {
pad = njs_value_arg(&string_space);
} else {
ret = njs_value_to_string(vm, pad, pad);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
}
}
pad_length = njs_string_prop(&pad_string, pad);
if (pad_string.size == 0) {
vm->retval = args[0];
return NJS_OK;
}
if (pad_string.size > 1) {
n = padding / pad_length;
trunc = padding % pad_length;
if (pad_string.size != (size_t) pad_length) {
/* UTF-8 string. */
end = pad_string.start + pad_string.size;
end = njs_string_offset(pad_string.start, end, trunc);
trunc = end - pad_string.start;
padding = pad_string.size * n + trunc;
}
}
new_size = string.size + padding;
start = njs_string_alloc(vm, &vm->retval, new_size, new_length);
if (njs_slow_path(start == NULL)) {
return NJS_ERROR;
}
p = start;
if (pad_start) {
start += padding;
} else {
p += string.size;
}
memcpy(start, string.start, string.size);
if (pad_string.size == 1) {
njs_memset(p, pad_string.start[0], padding);
} else {
while (n != 0) {
memcpy(p, pad_string.start, pad_string.size);
p += pad_string.size;
n--;
}
memcpy(p, pad_string.start, trunc);
}
return NJS_OK;
}
| 0
|
238,614
|
static int check_stack_write(struct bpf_verifier_env *env,
int ptr_regno, int off, int size,
int value_regno, int insn_idx)
{
struct bpf_reg_state *reg = reg_state(env, ptr_regno);
struct bpf_func_state *state = func(env, reg);
int err;
if (tnum_is_const(reg->var_off)) {
off += reg->var_off.value;
err = check_stack_write_fixed_off(env, state, off, size,
value_regno, insn_idx);
} else {
/* Variable offset stack reads need more conservative handling
* than fixed offset ones.
*/
err = check_stack_write_var_off(env, state,
ptr_regno, off, size,
value_regno, insn_idx);
}
return err;
}
| 0
|
309,921
|
tparm_tc_compat(TPARM_DATA * data)
{
bool termcap_hack = FALSE;
TPS(stack_ptr) = 0;
if (data->num_popped == 0) {
int i;
termcap_hack = TRUE;
for (i = data->num_parsed - 1; i >= 0; i--) {
if (data->p_is_s[i])
spush(data->p_is_s[i]);
else
npush((int) data->param[i]);
}
}
return termcap_hack;
}
| 0
|
474,433
|
ObjectCreateHMACSequence(
TPMI_ALG_HASH hashAlg, // IN: hash algorithm
OBJECT *keyObject, // IN: the object containing the HMAC key
TPM2B_AUTH *auth, // IN: authValue
TPMI_DH_OBJECT *newHandle // OUT: HMAC sequence object handle
)
{
HASH_OBJECT *hmacObject;
//
// Try to allocate a slot for new object
hmacObject = AllocateSequenceSlot(newHandle, auth);
if(hmacObject == NULL)
return TPM_RC_OBJECT_MEMORY;
// Set HMAC sequence bit
hmacObject->attributes.hmacSeq = SET;
#if !SMAC_IMPLEMENTED
if(CryptHmacStart(&hmacObject->state.hmacState, hashAlg,
keyObject->sensitive.sensitive.bits.b.size,
keyObject->sensitive.sensitive.bits.b.buffer) == 0)
#else
if(CryptMacStart(&hmacObject->state.hmacState,
&keyObject->publicArea.parameters,
hashAlg, &keyObject->sensitive.sensitive.any.b) == 0)
#endif // SMAC_IMPLEMENTED
return TPM_RC_FAILURE;
return TPM_RC_SUCCESS;
}
| 0
|
238,427
|
static void __update_reg64_bounds(struct bpf_reg_state *reg)
{
/* min signed is max(sign bit) | min(other bits) */
reg->smin_value = max_t(s64, reg->smin_value,
reg->var_off.value | (reg->var_off.mask & S64_MIN));
/* max signed is min(sign bit) | max(other bits) */
reg->smax_value = min_t(s64, reg->smax_value,
reg->var_off.value | (reg->var_off.mask & S64_MAX));
reg->umin_value = max(reg->umin_value, reg->var_off.value);
reg->umax_value = min(reg->umax_value,
reg->var_off.value | reg->var_off.mask);
}
| 0
|
310,063
|
increment(int *all_parms, int *num_parms, int len_parms, int end_parms)
{
int rc = 0;
int n;
if (len_parms > 9)
len_parms = 9;
if (end_parms < len_parms) {
if (all_parms[end_parms]++ >= num_parms[end_parms]) {
all_parms[end_parms] = 0;
increment(all_parms, num_parms, len_parms, end_parms + 1);
}
}
for (n = 0; n < len_parms; ++n) {
if (all_parms[n] != 0) {
rc = 1;
break;
}
}
/* return 1 until the vector resets to all 0's */
return rc;
}
| 0
|
391,666
|
NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
const struct smb_filename *smb_fname,
bool use_privs,
uint32_t access_mask)
{
/* Check if we have rights to open. */
NTSTATUS status;
struct security_descriptor *sd = NULL;
uint32_t rejected_share_access;
uint32_t rejected_mask = access_mask;
uint32_t do_not_check_mask = 0;
rejected_share_access = access_mask & ~(conn->share_access);
if (rejected_share_access) {
DEBUG(10, ("smbd_check_access_rights: rejected share access 0x%x "
"on %s (0x%x)\n",
(unsigned int)access_mask,
smb_fname_str_dbg(smb_fname),
(unsigned int)rejected_share_access ));
return NT_STATUS_ACCESS_DENIED;
}
if (!use_privs && get_current_uid(conn) == (uid_t)0) {
/* I'm sorry sir, I didn't know you were root... */
DEBUG(10,("smbd_check_access_rights: root override "
"on %s. Granting 0x%x\n",
smb_fname_str_dbg(smb_fname),
(unsigned int)access_mask ));
return NT_STATUS_OK;
}
if ((access_mask & DELETE_ACCESS) && !lp_acl_check_permissions(SNUM(conn))) {
DEBUG(10,("smbd_check_access_rights: not checking ACL "
"on DELETE_ACCESS on file %s. Granting 0x%x\n",
smb_fname_str_dbg(smb_fname),
(unsigned int)access_mask ));
return NT_STATUS_OK;
}
if (access_mask == DELETE_ACCESS &&
VALID_STAT(smb_fname->st) &&
S_ISLNK(smb_fname->st.st_ex_mode)) {
/* We can always delete a symlink. */
DEBUG(10,("smbd_check_access_rights: not checking ACL "
"on DELETE_ACCESS on symlink %s.\n",
smb_fname_str_dbg(smb_fname) ));
return NT_STATUS_OK;
}
status = SMB_VFS_GET_NT_ACL(conn, smb_fname->base_name,
(SECINFO_OWNER |
SECINFO_GROUP |
SECINFO_DACL), talloc_tos(), &sd);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("smbd_check_access_rights: Could not get acl "
"on %s: %s\n",
smb_fname_str_dbg(smb_fname),
nt_errstr(status)));
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
goto access_denied;
}
return status;
}
/*
* If we can access the path to this file, by
* default we have FILE_READ_ATTRIBUTES from the
* containing directory. See the section:
* "Algorithm to Check Access to an Existing File"
* in MS-FSA.pdf.
*
* se_file_access_check() also takes care of
* owner WRITE_DAC and READ_CONTROL.
*/
do_not_check_mask = FILE_READ_ATTRIBUTES;
/*
* Samba 3.6 and earlier granted execute access even
* if the ACL did not contain execute rights.
* Samba 4.0 is more correct and checks it.
* The compatibilty mode allows to skip this check
* to smoothen upgrades.
*/
if (lp_acl_allow_execute_always(SNUM(conn))) {
do_not_check_mask |= FILE_EXECUTE;
}
status = se_file_access_check(sd,
get_current_nttok(conn),
use_privs,
(access_mask & ~do_not_check_mask),
&rejected_mask);
DEBUG(10,("smbd_check_access_rights: file %s requesting "
"0x%x returning 0x%x (%s)\n",
smb_fname_str_dbg(smb_fname),
(unsigned int)access_mask,
(unsigned int)rejected_mask,
nt_errstr(status) ));
if (!NT_STATUS_IS_OK(status)) {
if (DEBUGLEVEL >= 10) {
DEBUG(10,("smbd_check_access_rights: acl for %s is:\n",
smb_fname_str_dbg(smb_fname) ));
NDR_PRINT_DEBUG(security_descriptor, sd);
}
}
TALLOC_FREE(sd);
if (NT_STATUS_IS_OK(status) ||
!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
return status;
}
/* Here we know status == NT_STATUS_ACCESS_DENIED. */
access_denied:
if ((access_mask & FILE_WRITE_ATTRIBUTES) &&
(rejected_mask & FILE_WRITE_ATTRIBUTES) &&
!lp_store_dos_attributes(SNUM(conn)) &&
(lp_map_readonly(SNUM(conn)) ||
lp_map_archive(SNUM(conn)) ||
lp_map_hidden(SNUM(conn)) ||
lp_map_system(SNUM(conn)))) {
rejected_mask &= ~FILE_WRITE_ATTRIBUTES;
DEBUG(10,("smbd_check_access_rights: "
"overrode "
"FILE_WRITE_ATTRIBUTES "
"on file %s\n",
smb_fname_str_dbg(smb_fname)));
}
if (parent_override_delete(conn,
smb_fname,
access_mask,
rejected_mask)) {
/* Were we trying to do an open
* for delete and didn't get DELETE
* access (only) ? Check if the
* directory allows DELETE_CHILD.
* See here:
* http://blogs.msdn.com/oldnewthing/archive/2004/06/04/148426.aspx
* for details. */
rejected_mask &= ~DELETE_ACCESS;
DEBUG(10,("smbd_check_access_rights: "
"overrode "
"DELETE_ACCESS on "
"file %s\n",
smb_fname_str_dbg(smb_fname)));
}
if (rejected_mask != 0) {
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;
}
| 0
|
244,018
|
void ssix_box_del(GF_Box *s)
{
u32 i;
GF_SubsegmentIndexBox *ptr = (GF_SubsegmentIndexBox *)s;
if (ptr == NULL) return;
if (ptr->subsegments) {
for (i = 0; i < ptr->subsegment_alloc; i++) {
GF_SubsegmentInfo *subsegment = &ptr->subsegments[i];
if (subsegment->ranges) gf_free(subsegment->ranges);
}
gf_free(ptr->subsegments);
}
gf_free(ptr);
}
| 0
|
369,151
|
static int io_fallocate(struct io_kiocb *req, unsigned int issue_flags)
{
int ret;
/* fallocate always requiring blocking context */
if (issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
ret = vfs_fallocate(req->file, req->sync.mode, req->sync.off,
req->sync.len);
if (ret < 0)
req_set_fail(req);
else
fsnotify_modify(req->file);
io_req_complete(req, ret);
return 0;
}
| 0
|
352,944
|
bootParameterValidate(
Syntax *syntax,
struct berval *val )
{
char *p, *e;
if ( BER_BVISEMPTY( val ) ) {
return LDAP_INVALID_SYNTAX;
}
p = (char *)val->bv_val;
e = p + val->bv_len;
/* key */
for (; ( p < e ) && ( *p != '=' ); p++ ) {
if ( !AD_CHAR( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
if ( *p != '=' ) {
return LDAP_INVALID_SYNTAX;
}
/* server */
for ( p++; ( p < e ) && ( *p != ':' ); p++ ) {
if ( !AD_CHAR( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
if ( *p != ':' ) {
return LDAP_INVALID_SYNTAX;
}
/* path */
for ( p++; p < e; p++ ) {
if ( !SLAP_PRINTABLE( *p ) ) {
return LDAP_INVALID_SYNTAX;
}
}
return LDAP_SUCCESS;
}
| 0
|
474,014
|
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower,
OnigEncoding enc ARG_UNUSED)
{
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
*lower++ = 's';
*lower = 's';
(*pp)++;
return 2;
}
*lower = ENC_ISO_8859_16_TO_LOWER_CASE(*p);
(*pp)++;
return 1; /* return byte length of converted char to lower */
}
| 0
|
281,094
|
xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
const struct flowi *fl, u16 family,
struct dst_entry *dst_orig)
{
struct net *net = xp_net(pols[0]);
struct xfrm_state *xfrm[XFRM_MAX_DEPTH];
struct dst_entry *dst;
struct xfrm_dst *xdst;
int err;
/* Try to instantiate a bundle */
err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
if (err <= 0) {
if (err != 0 && err != -EAGAIN)
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
return ERR_PTR(err);
}
dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig);
if (IS_ERR(dst)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTBUNDLEGENERROR);
return ERR_CAST(dst);
}
xdst = (struct xfrm_dst *)dst;
xdst->num_xfrms = err;
xdst->num_pols = num_pols;
memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols);
xdst->policy_genid = atomic_read(&pols[0]->genid);
return xdst;
}
| 0
|
462,395
|
*/
static void php_wddx_pop_element(void *user_data, const XML_Char *name)
{
st_entry *ent1, *ent2;
wddx_stack *stack = (wddx_stack *)user_data;
HashTable *target_hash;
zend_class_entry **pce;
zval *obj;
zval *tmp;
TSRMLS_FETCH();
/* OBJECTS_FIXME */
if (stack->top == 0) {
return;
}
if (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||
!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||
!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||
!strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY) ||
!strcmp(name, EL_DATETIME)) {
wddx_stack_top(stack, (void**)&ent1);
if (!ent1->data) {
if (stack->top > 1) {
stack->top--;
} else {
stack->done = 1;
}
efree(ent1);
return;
}
if (!strcmp(name, EL_BINARY)) {
int new_len=0;
unsigned char *new_str;
new_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);
STR_FREE(Z_STRVAL_P(ent1->data));
if (new_str) {
Z_STRVAL_P(ent1->data) = new_str;
Z_STRLEN_P(ent1->data) = new_len;
} else {
ZVAL_EMPTY_STRING(ent1->data);
}
}
/* Call __wakeup() method on the object. */
if (Z_TYPE_P(ent1->data) == IS_OBJECT) {
zval *fname, *retval = NULL;
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname, "__wakeup", 1);
call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);
zval_dtor(fname);
FREE_ZVAL(fname);
if (retval) {
zval_ptr_dtor(&retval);
}
}
if (stack->top > 1) {
stack->top--;
wddx_stack_top(stack, (void**)&ent2);
/* if non-existent field */
if (ent2->type == ST_FIELD && ent2->data == NULL) {
zval_ptr_dtor(&ent1->data);
efree(ent1);
return;
}
if (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {
target_hash = HASH_OF(ent2->data);
if (ent1->varname) {
if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&
Z_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data) &&
ent2->type == ST_STRUCT && Z_TYPE_P(ent2->data) == IS_ARRAY) {
zend_bool incomplete_class = 0;
zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),
Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {
incomplete_class = 1;
pce = &PHP_IC_ENTRY;
}
/* Initialize target object */
MAKE_STD_ZVAL(obj);
object_init_ex(obj, *pce);
/* Merge current hashtable with object's default properties */
zend_hash_merge(Z_OBJPROP_P(obj),
Z_ARRVAL_P(ent2->data),
(void (*)(void *)) zval_add_ref,
(void *) &tmp, sizeof(zval *), 0);
if (incomplete_class) {
php_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
}
/* Clean up old array entry */
zval_ptr_dtor(&ent2->data);
/* Set stack entry to point to the newly created object */
ent2->data = obj;
/* Clean up class name var entry */
zval_ptr_dtor(&ent1->data);
} else if (Z_TYPE_P(ent2->data) == IS_OBJECT) {
zend_class_entry *old_scope = EG(scope);
EG(scope) = Z_OBJCE_P(ent2->data);
Z_DELREF_P(ent1->data);
add_property_zval(ent2->data, ent1->varname, ent1->data);
EG(scope) = old_scope;
} else {
zend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);
}
efree(ent1->varname);
} else {
zend_hash_next_index_insert(target_hash, &ent1->data, sizeof(zval *), NULL);
}
}
efree(ent1);
} else {
stack->done = 1;
}
} else if (!strcmp(name, EL_VAR) && stack->varname) {
efree(stack->varname);
stack->varname = NULL;
} else if (!strcmp(name, EL_FIELD)) {
st_entry *ent;
wddx_stack_top(stack, (void **)&ent);
efree(ent);
stack->top--;
}
| 0
|
411,935
|
build_server_referral(krb5_context context,
krb5_kdc_configuration *config,
krb5_crypto session,
krb5_const_realm referred_realm,
const PrincipalName *true_principal_name,
const PrincipalName *requested_principal,
krb5_data *outdata)
{
PA_ServerReferralData ref;
krb5_error_code ret;
EncryptedData ed;
krb5_data data;
size_t size = 0;
memset(&ref, 0, sizeof(ref));
if (referred_realm) {
ALLOC(ref.referred_realm);
if (ref.referred_realm == NULL)
goto eout;
*ref.referred_realm = strdup(referred_realm);
if (*ref.referred_realm == NULL)
goto eout;
}
if (true_principal_name) {
ALLOC(ref.true_principal_name);
if (ref.true_principal_name == NULL)
goto eout;
ret = copy_PrincipalName(true_principal_name, ref.true_principal_name);
if (ret)
goto eout;
}
if (requested_principal) {
ALLOC(ref.requested_principal_name);
if (ref.requested_principal_name == NULL)
goto eout;
ret = copy_PrincipalName(requested_principal,
ref.requested_principal_name);
if (ret)
goto eout;
}
ASN1_MALLOC_ENCODE(PA_ServerReferralData,
data.data, data.length,
&ref, &size, ret);
free_PA_ServerReferralData(&ref);
if (ret)
return ret;
if (data.length != size)
krb5_abortx(context, "internal asn.1 encoder error");
ret = krb5_encrypt_EncryptedData(context, session,
KRB5_KU_PA_SERVER_REFERRAL,
data.data, data.length,
0 /* kvno */, &ed);
free(data.data);
if (ret)
return ret;
ASN1_MALLOC_ENCODE(EncryptedData,
outdata->data, outdata->length,
&ed, &size, ret);
free_EncryptedData(&ed);
if (ret)
return ret;
if (outdata->length != size)
krb5_abortx(context, "internal asn.1 encoder error");
return 0;
eout:
free_PA_ServerReferralData(&ref);
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
return ENOMEM;
}
| 0
|
225,705
|
GF_Err def_parent_box_read(GF_Box *s, GF_BitStream *bs)
{
return gf_isom_box_array_read(s, bs);
}
| 0
|
292,162
|
methodHandle LinkResolver::linktime_resolve_interface_method(const LinkInfo& link_info,
TRAPS) {
// normal interface method resolution
methodHandle resolved_method = resolve_interface_method(link_info, Bytecodes::_invokeinterface, CHECK_NULL);
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier");
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier");
return resolved_method;
}
| 0
|
427,208
|
static int block_follow (LexState *ls, int withuntil) {
switch (ls->t.token) {
case TK_ELSE: case TK_ELSEIF:
case TK_END: case TK_EOS:
return 1;
case TK_UNTIL: return withuntil;
default: return 0;
}
}
| 0
|
196,841
|
inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord, const DivPattern** patCache) {
static char id[32];
bool selectedRow=(i>=sel1.y && i<=sel2.y);
ImGui::TableNextRow(0,lineHeight);
ImGui::TableNextColumn();
float cursorPosY=ImGui::GetCursorPos().y-ImGui::GetScrollY();
// check if the row is visible
if (cursorPosY<-lineHeight || cursorPosY>ImGui::GetWindowSize().y) {
return;
}
// check if we are in range
if (ord<0 || ord>=e->song.ordersLen) {
return;
}
if (i<0 || i>=e->song.patLen) {
return;
}
bool isPushing=false;
ImVec4 activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE];
ImVec4 inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE];
ImVec4 rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX];
if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE_HI2];
inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE_HI2];
rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX_HI2];
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE_HI1];
inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE_HI1];
rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX_HI1];
}
// check overflow highlight
if (settings.overflowHighlight) {
if (edit && cursor.y==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (isPlaying && oldRow==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1]));
}
} else {
isPushing=true;
if (edit && cursor.y==i) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (isPlaying && oldRow==i) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1]));
} else {
isPushing=false;
}
}
// row number
if (settings.patRowsBase==1) {
ImGui::TextColored(rowIndexColor," %.2X ",i);
} else {
ImGui::TextColored(rowIndexColor,"%3d ",i);
}
// for each column
for (int j=0; j<chans; j++) {
// check if channel is not hidden
if (!e->song.chanShow[j]) {
patChanX[j]=ImGui::GetCursorPosX();
continue;
}
int chanVolMax=e->getMaxVolumeChan(j);
if (chanVolMax<1) chanVolMax=1;
const DivPattern* pat=patCache[j];
ImGui::TableNextColumn();
patChanX[j]=ImGui::GetCursorPosX();
// selection highlight flags
int sel1XSum=sel1.xCoarse*32+sel1.xFine;
int sel2XSum=sel2.xCoarse*32+sel2.xFine;
int j32=j*32;
bool selectedNote=selectedRow && (j32>=sel1XSum && j32<=sel2XSum);
bool selectedIns=selectedRow && (j32+1>=sel1XSum && j32+1<=sel2XSum);
bool selectedVol=selectedRow && (j32+2>=sel1XSum && j32+2<=sel2XSum);
bool cursorNote=(cursor.y==i && cursor.xCoarse==j && cursor.xFine==0);
bool cursorIns=(cursor.y==i && cursor.xCoarse==j && cursor.xFine==1);
bool cursorVol=(cursor.y==i && cursor.xCoarse==j && cursor.xFine==2);
// note
sprintf(id,"%s##PN_%d_%d",noteName(pat->data[i][0],pat->data[i][1]),i,j);
if (pat->data[i][0]==0 && pat->data[i][1]==0) {
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
} else {
ImGui::PushStyleColor(ImGuiCol_Text,activeColor);
}
if (cursorNote) {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,threeChars);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedNote) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedNote,ImGuiSelectableFlags_NoPadWithHalfSpacing,threeChars);
if (selectedNote) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
startSelection(j,0,i);
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
updateSelection(j,0,i);
}
ImGui::PopStyleColor();
// the following is only visible when the channel is not collapsed
if (!e->song.chanCollapse[j]) {
// instrument
if (pat->data[i][2]==-1) {
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
sprintf(id,"..##PI_%d_%d",i,j);
} else {
if (pat->data[i][2]<0 || pat->data[i][2]>=e->song.insLen) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS_ERROR]);
} else {
DivInstrumentType t=e->song.ins[pat->data[i][2]]->type;
if (t!=DIV_INS_AMIGA && t!=e->getPreferInsType(j)) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS_WARN]);
} else {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS]);
}
}
sprintf(id,"%.2X##PI_%d_%d",pat->data[i][2],i,j);
}
ImGui::SameLine(0.0f,0.0f);
if (cursorIns) {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedIns) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedIns,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
if (selectedIns) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
startSelection(j,1,i);
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
updateSelection(j,1,i);
}
ImGui::PopStyleColor();
// volume
if (pat->data[i][3]==-1) {
sprintf(id,"..##PV_%d_%d",i,j);
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
} else {
int volColor=(pat->data[i][3]*127)/chanVolMax;
if (volColor>127) volColor=127;
if (volColor<0) volColor=0;
sprintf(id,"%.2X##PV_%d_%d",pat->data[i][3],i,j);
ImGui::PushStyleColor(ImGuiCol_Text,volColors[volColor]);
}
ImGui::SameLine(0.0f,0.0f);
if (cursorVol) {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedVol) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedVol,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
if (selectedVol) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
startSelection(j,2,i);
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
updateSelection(j,2,i);
}
ImGui::PopStyleColor();
// effects
for (int k=0; k<e->song.pat[j].effectRows; k++) {
int index=4+(k<<1);
bool selectedEffect=selectedRow && (j32+index-1>=sel1XSum && j32+index-1<=sel2XSum);
bool selectedEffectVal=selectedRow && (j32+index>=sel1XSum && j32+index<=sel2XSum);
bool cursorEffect=(cursor.y==i && cursor.xCoarse==j && cursor.xFine==index-1);
bool cursorEffectVal=(cursor.y==i && cursor.xCoarse==j && cursor.xFine==index);
// effect
if (pat->data[i][index]==-1) {
sprintf(id,"..##PE%d_%d_%d",k,i,j);
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
} else {
sprintf(id,"%.2X##PE%d_%d_%d",pat->data[i][index],k,i,j);
if (pat->data[i][index]<0x10) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColors[pat->data[i][index]]]);
} else if (pat->data[i][index]<0x20) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY]);
} else if (pat->data[i][index]<0x30) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY]);
} else if (pat->data[i][index]<0x48) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY]);
} else if (pat->data[i][index]<0x90) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_INVALID]);
} else if (pat->data[i][index]<0xa0) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_MISC]);
} else if (pat->data[i][index]<0xc0) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_INVALID]);
} else if (pat->data[i][index]<0xd0) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_SPEED]);
} else if (pat->data[i][index]<0xe0) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_INVALID]);
} else {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[extFxColors[pat->data[i][index]-0xe0]]);
}
}
ImGui::SameLine(0.0f,0.0f);
if (cursorEffect) {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedEffect) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedEffect,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
if (selectedEffect) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
startSelection(j,index-1,i);
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
updateSelection(j,index-1,i);
}
// effect value
if (pat->data[i][index+1]==-1) {
sprintf(id,"..##PF%d_%d_%d",k,i,j);
} else {
sprintf(id,"%.2X##PF%d_%d_%d",pat->data[i][index+1],k,i,j);
}
ImGui::SameLine(0.0f,0.0f);
if (cursorEffectVal) {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_CURSOR_ACTIVE]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_CURSOR_HOVER]);
ImGui::Selectable(id,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
demandX=ImGui::GetCursorPosX();
ImGui::PopStyleColor(3);
} else {
if (selectedEffectVal) ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::Selectable(id,isPushing || selectedEffectVal,ImGuiSelectableFlags_NoPadWithHalfSpacing,twoChars);
if (selectedEffectVal) ImGui::PopStyleColor();
}
if (ImGui::IsItemClicked()) {
startSelection(j,index,i);
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
updateSelection(j,index,i);
}
ImGui::PopStyleColor();
}
}
}
if (isPushing) {
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
patChanX[chans]=ImGui::GetCursorPosX();
}
| 1
|
220,441
|
mrb_ary_modify(mrb_state *mrb, struct RArray* a)
{
mrb_write_barrier(mrb, (struct RBasic*)a);
ary_modify(mrb, a);
}
| 0
|
359,629
|
peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
safi_t safi, const char *direct_str)
{
int ret;
struct peer *peer;
int direct = FILTER_IN;
peer = peer_and_group_lookup_vty (vty, ip_str);
if (! peer)
return CMD_WARNING;
/* Check filter direction. */
if (strncmp (direct_str, "i", 1) == 0)
direct = FILTER_IN;
else if (strncmp (direct_str, "o", 1) == 0)
direct = FILTER_OUT;
ret = peer_distribute_unset (peer, afi, safi, direct);
return bgp_vty_return (vty, ret);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.