project
stringclasses 788
values | commit_id
stringlengths 6
81
| CVE ID
stringlengths 13
16
| CWE ID
stringclasses 126
values | func
stringlengths 14
482k
| vul
int8 0
1
|
---|---|---|---|---|---|
radare2 | 1dd65336f0f0c351d6ea853efcf73cf9c0030862 | NOT_APPLICABLE | NOT_APPLICABLE | static char *str_dup_safe(const ut8 *b, const ut8 *str, const ut8 *end) {
if (str >= b && str < end) {
int len = r_str_nlen ((const char *)str, end - str);
if (len) {
return r_str_ndup ((const char *)str, len);
}
}
return NULL;
} | 0 |
taglib | ab8a0ee8937256311e649a88e8ddd7c7f870ad59 | NOT_APPLICABLE | NOT_APPLICABLE | void Ogg::XiphComment::setComment(const String &s)
{
addField(d->commentField.isEmpty() ? "DESCRIPTION" : d->commentField, s);
} | 0 |
libxkbcommon | 4e2ee9c3f6050d773f8bbe05bc0edb17f1ff8371 | NOT_APPLICABLE | NOT_APPLICABLE | ExprResolveKeyCode(struct xkb_context *ctx, const ExprDef *expr,
xkb_keycode_t *kc)
{
xkb_keycode_t leftRtrn, rightRtrn;
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_INT) {
log_err(ctx,
"Found constant of type %s where an int was expected\n",
expr_value_type_to_string(expr->expr.value_type));
return false;
}
*kc = (xkb_keycode_t) expr->integer.ival;
return true;
case EXPR_ADD:
case EXPR_SUBTRACT:
case EXPR_MULTIPLY:
case EXPR_DIVIDE:
if (!ExprResolveKeyCode(ctx, expr->binary.left, &leftRtrn) ||
!ExprResolveKeyCode(ctx, expr->binary.right, &rightRtrn))
return false;
switch (expr->expr.op) {
case EXPR_ADD:
*kc = leftRtrn + rightRtrn;
break;
case EXPR_SUBTRACT:
*kc = leftRtrn - rightRtrn;
break;
case EXPR_MULTIPLY:
*kc = leftRtrn * rightRtrn;
break;
case EXPR_DIVIDE:
if (rightRtrn == 0) {
log_err(ctx, "Cannot divide by zero: %d / %d\n",
leftRtrn, rightRtrn);
return false;
}
*kc = leftRtrn / rightRtrn;
break;
default:
break;
}
return true;
case EXPR_NEGATE:
if (!ExprResolveKeyCode(ctx, expr->unary.child, &leftRtrn))
return false;
*kc = ~leftRtrn;
return true;
case EXPR_UNARY_PLUS:
return ExprResolveKeyCode(ctx, expr->unary.child, kc);
default:
log_wsgo(ctx, "Unknown operator %d in ResolveKeyCode\n",
expr->expr.op);
break;
}
return false;
}
| 0 |
libarchive | a550daeecf6bc689ade371349892ea17b5b97c77 | NOT_APPLICABLE | NOT_APPLICABLE | parsehex(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
else if (c >= 'a' && c <= 'f')
return c - 'a';
else if (c >= 'A' && c <= 'F')
return c - 'A';
else
return -1;
}
| 0 |
curl | curl-7_50_2~32 | NOT_APPLICABLE | NOT_APPLICABLE | static bool is_nss_error(CURLcode err)
{
switch(err) {
case CURLE_PEER_FAILED_VERIFICATION:
case CURLE_SSL_CACERT:
case CURLE_SSL_CERTPROBLEM:
case CURLE_SSL_CONNECT_ERROR:
case CURLE_SSL_ISSUER_ERROR:
return true;
default:
return false;
}
}
| 0 |
linux | bfd0a56b90005f8c8a004baf407ad90045c2b11e | NOT_APPLICABLE | NOT_APPLICABLE | static void __update_clear_spte_fast(u64 *sptep, u64 spte)
{
union split_spte *ssptep, sspte;
ssptep = (union split_spte *)sptep;
sspte = (union split_spte)spte;
ssptep->spte_low = sspte.spte_low;
/*
* If we map the spte from present to nonpresent, we should clear
* present bit firstly to avoid vcpu fetch the old high bits.
*/
smp_wmb();
ssptep->spte_high = sspte.spte_high;
count_spte_clear(sptep, spte);
}
| 0 |
server | 807945f2eb5fa22e6f233cc17b85a2e141efe2c8 | NOT_APPLICABLE | NOT_APPLICABLE | bool with_sum_func() const { return m_with_sum_func; } | 0 |
Chrome | befb46ae3385fa13975521e9a2281e35805b339e | NOT_APPLICABLE | NOT_APPLICABLE | static void pageCacheLog(const String& prefix, const String& message)
{
LOG(PageCache, "%s%s", prefix.utf8().data(), message.utf8().data());
}
| 0 |
Chrome | c552cd7b8a0862f6b3c8c6a07f98bda3721101eb | CVE-2018-16080 | CWE-20 | void Browser::AddNewContents(WebContents* source,
std::unique_ptr<WebContents> new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition))
PopupTracker::CreateForWebContents(new_contents.get(), source);
chrome::AddWebContents(this, source, std::move(new_contents), disposition,
initial_rect);
}
| 1 |
ipmitool | 9452be87181a6e83cfcc768b3ed8321763db50e4 | NOT_APPLICABLE | NOT_APPLICABLE | ipmi_1_5_authtypes(uint8_t n)
{
uint32_t i;
static char supportedTypes[128];
memset(supportedTypes, 0, sizeof(supportedTypes));
for (i = 0; ipmi_authtype_vals[i].val != 0; i++) {
if (n & ipmi_authtype_vals[i].val) {
strcat(supportedTypes, ipmi_authtype_vals[i].str);
strcat(supportedTypes, " ");
}
}
return supportedTypes;
} | 0 |
Chrome | 52f6eb4221430b6248fd5a59bec53bfef9fdd9a7 | NOT_APPLICABLE | NOT_APPLICABLE | void AddBluetoothStrings(content::WebUIDataSource* html_source) {
LocalizedString localized_strings[] = {
{"bluetoothConnected", IDS_SETTINGS_BLUETOOTH_CONNECTED},
{"bluetoothConnecting", IDS_SETTINGS_BLUETOOTH_CONNECTING},
{"bluetoothDeviceListPaired", IDS_SETTINGS_BLUETOOTH_DEVICE_LIST_PAIRED},
{"bluetoothDeviceListUnpaired",
IDS_SETTINGS_BLUETOOTH_DEVICE_LIST_UNPAIRED},
{"bluetoothConnect", IDS_SETTINGS_BLUETOOTH_CONNECT},
{"bluetoothDisconnect", IDS_SETTINGS_BLUETOOTH_DISCONNECT},
{"bluetoothToggleA11yLabel",
IDS_SETTINGS_BLUETOOTH_TOGGLE_ACCESSIBILITY_LABEL},
{"bluetoothExpandA11yLabel",
IDS_SETTINGS_BLUETOOTH_EXPAND_ACCESSIBILITY_LABEL},
{"bluetoothNoDevices", IDS_SETTINGS_BLUETOOTH_NO_DEVICES},
{"bluetoothNoDevicesFound", IDS_SETTINGS_BLUETOOTH_NO_DEVICES_FOUND},
{"bluetoothNotConnected", IDS_SETTINGS_BLUETOOTH_NOT_CONNECTED},
{"bluetoothPageTitle", IDS_SETTINGS_BLUETOOTH},
{"bluetoothPairDevicePageTitle",
IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE},
{"bluetoothRemove", IDS_SETTINGS_BLUETOOTH_REMOVE},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
chromeos::bluetooth_dialog::AddLocalizedStrings(html_source);
}
| 0 |
mupdf | 83d4dae44c71816c084a635550acc1a51529b881 | NOT_APPLICABLE | NOT_APPLICABLE | fz_drop_colorspace_store_key(fz_context *ctx, fz_colorspace *cs)
{
fz_drop_key_storable_key(ctx, &cs->key_storable);
} | 0 |
linux | 46612b751c4941c5c0472ddf04027e877ae5990f | NOT_APPLICABLE | NOT_APPLICABLE | static int __init memory_failure_init(void)
{
struct memory_failure_cpu *mf_cpu;
int cpu;
for_each_possible_cpu(cpu) {
mf_cpu = &per_cpu(memory_failure_cpu, cpu);
spin_lock_init(&mf_cpu->lock);
INIT_KFIFO(mf_cpu->fifo);
INIT_WORK(&mf_cpu->work, memory_failure_work_func);
}
return 0;
} | 0 |
linux | 4dff5c7b7093b19c19d3a100f8a3ad87cb7cd9e7 | NOT_APPLICABLE | NOT_APPLICABLE | int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)
{
struct snd_timer *timer;
int result = -EINVAL;
unsigned long flags;
if (timeri == NULL || ticks < 1)
return -EINVAL;
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) {
result = snd_timer_start_slave(timeri);
if (result >= 0)
snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START);
return result;
}
timer = timeri->timer;
if (timer == NULL)
return -EINVAL;
if (timer->card && timer->card->shutdown)
return -ENODEV;
spin_lock_irqsave(&timer->lock, flags);
if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING |
SNDRV_TIMER_IFLG_START)) {
result = -EBUSY;
goto unlock;
}
timeri->ticks = timeri->cticks = ticks;
timeri->pticks = 0;
result = snd_timer_start1(timer, timeri, ticks);
unlock:
spin_unlock_irqrestore(&timer->lock, flags);
if (result >= 0)
snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START);
return result;
} | 0 |
Chrome | 3aad1a37affb1ab70d1897f2b03eb8c077264984 | NOT_APPLICABLE | NOT_APPLICABLE | void GLES2DecoderImpl::Destroy(bool have_context) {
DCHECK(!have_context || context_->IsCurrent(NULL));
ChildList children = children_;
for (ChildList::iterator it = children.begin(); it != children.end(); ++it)
(*it)->SetParent(NULL, 0);
DCHECK(children_.empty());
SetParent(NULL, 0);
vertex_attrib_manager_.reset();
texture_units_.reset();
bound_array_buffer_ = NULL;
bound_element_array_buffer_ = NULL;
current_query_ = NULL;
current_program_ = NULL;
bound_read_framebuffer_ = NULL;
bound_draw_framebuffer_ = NULL;
bound_renderbuffer_ = NULL;
if (have_context) {
if (copy_texture_CHROMIUM_.get()) {
copy_texture_CHROMIUM_->Destroy();
copy_texture_CHROMIUM_.reset();
}
if (current_program_) {
program_manager()->UnuseProgram(shader_manager(), current_program_);
current_program_ = NULL;
}
if (attrib_0_buffer_id_) {
glDeleteBuffersARB(1, &attrib_0_buffer_id_);
}
if (fixed_attrib_buffer_id_) {
glDeleteBuffersARB(1, &fixed_attrib_buffer_id_);
}
if (offscreen_target_frame_buffer_.get())
offscreen_target_frame_buffer_->Destroy();
if (offscreen_target_color_texture_.get())
offscreen_target_color_texture_->Destroy();
if (offscreen_target_color_render_buffer_.get())
offscreen_target_color_render_buffer_->Destroy();
if (offscreen_target_depth_render_buffer_.get())
offscreen_target_depth_render_buffer_->Destroy();
if (offscreen_target_stencil_render_buffer_.get())
offscreen_target_stencil_render_buffer_->Destroy();
if (offscreen_saved_frame_buffer_.get())
offscreen_saved_frame_buffer_->Destroy();
if (offscreen_saved_color_texture_.get())
offscreen_saved_color_texture_->Destroy();
if (offscreen_resolved_frame_buffer_.get())
offscreen_resolved_frame_buffer_->Destroy();
if (offscreen_resolved_color_texture_.get())
offscreen_resolved_color_texture_->Destroy();
} else {
if (offscreen_target_frame_buffer_.get())
offscreen_target_frame_buffer_->Invalidate();
if (offscreen_target_color_texture_.get())
offscreen_target_color_texture_->Invalidate();
if (offscreen_target_color_render_buffer_.get())
offscreen_target_color_render_buffer_->Invalidate();
if (offscreen_target_depth_render_buffer_.get())
offscreen_target_depth_render_buffer_->Invalidate();
if (offscreen_target_stencil_render_buffer_.get())
offscreen_target_stencil_render_buffer_->Invalidate();
if (offscreen_saved_frame_buffer_.get())
offscreen_saved_frame_buffer_->Invalidate();
if (offscreen_saved_color_texture_.get())
offscreen_saved_color_texture_->Invalidate();
if (offscreen_resolved_frame_buffer_.get())
offscreen_resolved_frame_buffer_->Invalidate();
if (offscreen_resolved_color_texture_.get())
offscreen_resolved_color_texture_->Invalidate();
}
copy_texture_CHROMIUM_.reset();
if (query_manager_.get()) {
query_manager_->Destroy(have_context);
query_manager_.reset();
}
if (group_) {
group_->Destroy(have_context);
group_ = NULL;
}
if (context_.get()) {
context_->ReleaseCurrent(NULL);
context_ = NULL;
}
offscreen_target_frame_buffer_.reset();
offscreen_target_color_texture_.reset();
offscreen_target_color_render_buffer_.reset();
offscreen_target_depth_render_buffer_.reset();
offscreen_target_stencil_render_buffer_.reset();
offscreen_saved_frame_buffer_.reset();
offscreen_saved_color_texture_.reset();
offscreen_resolved_frame_buffer_.reset();
offscreen_resolved_color_texture_.reset();
#if defined(OS_MACOSX)
for (TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.begin();
it != texture_to_io_surface_map_.end(); ++it) {
CFRelease(it->second);
}
texture_to_io_surface_map_.clear();
#endif
}
| 0 |
tty | 0c9acb1af77a3cb8707e43f45b72c95266903cee | NOT_APPLICABLE | NOT_APPLICABLE | vcs_fasync(int fd, struct file *file, int on)
{
struct vcs_poll_data *poll = file->private_data;
if (!poll) {
/* don't allocate anything if all we want is disable fasync */
if (!on)
return 0;
poll = vcs_poll_data_get(file);
if (!poll)
return -ENOMEM;
}
return fasync_helper(fd, file, on, &poll->fasync);
} | 0 |
FFmpeg | 7ec414892ddcad88313848494b6fc5f437c9ca4a | NOT_APPLICABLE | NOT_APPLICABLE | static void fill_timing_for_id3_timestamped_stream(struct playlist *pls)
{
if (pls->id3_offset >= 0) {
pls->pkt.dts = pls->id3_mpegts_timestamp +
av_rescale_q(pls->id3_offset,
pls->ctx->streams[pls->pkt.stream_index]->time_base,
MPEG_TIME_BASE_Q);
if (pls->pkt.duration)
pls->id3_offset += pls->pkt.duration;
else
pls->id3_offset = -1;
} else {
/* there have been packets with unknown duration
* since the last id3 tag, should not normally happen */
pls->pkt.dts = AV_NOPTS_VALUE;
}
if (pls->pkt.duration)
pls->pkt.duration = av_rescale_q(pls->pkt.duration,
pls->ctx->streams[pls->pkt.stream_index]->time_base,
MPEG_TIME_BASE_Q);
pls->pkt.pts = AV_NOPTS_VALUE;
}
| 0 |
jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | NOT_APPLICABLE | NOT_APPLICABLE | static Jsi_OpCodes *code_add() { JSI_NEW_CODES(0,OP_ADD, 0); } | 0 |
FFmpeg | ba4beaf6149f7241c8bd85fe853318c2f6837ad0 | NOT_APPLICABLE | NOT_APPLICABLE | static av_cold int ape_decode_close(AVCodecContext *avctx)
{
APEContext *s = avctx->priv_data;
int i;
for (i = 0; i < APE_FILTER_LEVELS; i++)
av_freep(&s->filterbuf[i]);
av_freep(&s->decoded_buffer);
av_freep(&s->data);
s->decoded_size = s->data_size = 0;
return 0;
}
| 0 |
qemu | 1e7aed70144b4673fc26e73062064b6724795e5f | NOT_APPLICABLE | NOT_APPLICABLE | int virtio_set_status(VirtIODevice *vdev, uint8_t val)
{
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
trace_virtio_set_status(vdev, val);
if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
if (!(vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) &&
val & VIRTIO_CONFIG_S_FEATURES_OK) {
int ret = virtio_validate_features(vdev);
if (ret) {
return ret;
}
}
}
if (k->set_status) {
k->set_status(vdev, val);
}
vdev->status = val;
return 0;
}
| 0 |
Bento4 | 2f267f89f957088197f4b1fc254632d1645b415d | NOT_APPLICABLE | NOT_APPLICABLE | AP4_AtomSampleTable::GetSampleDescriptionCount()
{
return m_StsdAtom ? m_StsdAtom->GetSampleDescriptionCount() : 0;
} | 0 |
linux | a2d859e3fc97e79d907761550dbc03ff1b36479c | NOT_APPLICABLE | NOT_APPLICABLE | static inline struct sctp_chunk *sctp_make_op_error_limited(
const struct sctp_association *asoc,
const struct sctp_chunk *chunk)
{
size_t size = SCTP_DEFAULT_MAXSEGMENT;
struct sctp_sock *sp = NULL;
if (asoc) {
size = min_t(size_t, size, asoc->pathmtu);
sp = sctp_sk(asoc->base.sk);
}
size = sctp_mtu_payload(sp, size, sizeof(struct sctp_errhdr));
return sctp_make_op_error_space(asoc, chunk, size);
} | 0 |
ghostscript | 2fc463d0efbd044a8232611f0898eeb12b72a970 | NOT_APPLICABLE | NOT_APPLICABLE | check_file_permissions_reduced(i_ctx_t *i_ctx_p, const char *fname, int len,
gx_io_device *iodev, const char *permitgroup)
{
long i;
ref *permitlist = NULL;
/* an empty string (first character == 0) if '\' character is */
/* recognized as a file name separator as on DOS & Windows */
const char *win_sep2 = "\\";
bool use_windows_pathsep = (gs_file_name_check_separator(win_sep2, 1, win_sep2) == 1);
uint plen = gp_file_name_parents(fname, len);
/* we're protecting arbitrary file system accesses, not Postscript device accesses.
* Although, note that %pipe% is explicitly checked for and disallowed elsewhere
*/
if (iodev != iodev_default(imemory)) {
return 0;
}
/* Assuming a reduced file name. */
if (dict_find_string(&(i_ctx_p->userparams), permitgroup, &permitlist) <= 0)
return 0; /* if Permissions not found, just allow access */
for (i=0; i<r_size(permitlist); i++) {
ref permitstring;
const string_match_params win_filename_params = {
'*', '?', '\\', true, true /* ignore case & '/' == '\\' */
};
const byte *permstr;
uint permlen;
int cwd_len = 0;
if (array_get(imemory, permitlist, i, &permitstring) < 0 ||
r_type(&permitstring) != t_string
)
break; /* any problem, just fail */
permstr = permitstring.value.bytes;
permlen = r_size(&permitstring);
/*
* Check if any file name is permitted with "*".
*/
if (permlen == 1 && permstr[0] == '*')
return 0; /* success */
/*
* If the filename starts with parent references,
* the permission element must start with same number of parent references.
*/
if (plen != 0 && plen != gp_file_name_parents((const char *)permstr, permlen))
continue;
cwd_len = gp_file_name_cwds((const char *)permstr, permlen);
/*
* If the permission starts with "./", absolute paths
* are not permitted.
*/
if (cwd_len > 0 && gp_file_name_is_absolute(fname, len))
continue;
/*
* If the permission starts with "./", relative paths
* with no "./" are allowed as well as with "./".
* 'fname' has no "./" because it is reduced.
*/
if (string_match( (const unsigned char*) fname, len,
permstr + cwd_len, permlen - cwd_len,
use_windows_pathsep ? &win_filename_params : NULL))
return 0; /* success */
}
/* not found */
return gs_error_invalidfileaccess;
}
| 0 |
Chrome | fd2335678e96c34d14f4b20f0d9613dfbd1ccdb4 | NOT_APPLICABLE | NOT_APPLICABLE | void ParseCommandLineAndFieldTrials(const base::CommandLine& command_line,
bool is_quic_force_disabled,
const std::string& quic_user_agent_id,
net::HttpNetworkSession::Params* params) {
is_quic_force_disabled |= command_line.HasSwitch(switches::kDisableQuic);
bool is_quic_force_enabled = command_line.HasSwitch(switches::kEnableQuic);
std::string quic_trial_group =
base::FieldTrialList::FindFullName(kQuicFieldTrialName);
VariationParameters quic_trial_params;
if (!variations::GetVariationParams(kQuicFieldTrialName, &quic_trial_params))
quic_trial_params.clear();
ConfigureQuicParams(quic_trial_group, quic_trial_params,
is_quic_force_disabled, is_quic_force_enabled,
quic_user_agent_id, params);
std::string http2_trial_group =
base::FieldTrialList::FindFullName(kHttp2FieldTrialName);
VariationParameters http2_trial_params;
if (!variations::GetVariationParams(kHttp2FieldTrialName,
&http2_trial_params))
http2_trial_params.clear();
ConfigureHttp2Params(command_line, http2_trial_group, http2_trial_params,
params);
if (command_line.HasSwitch(switches::kDisableHttp2))
params->enable_http2 = false;
if (params->enable_quic) {
if (command_line.HasSwitch(switches::kQuicConnectionOptions)) {
params->quic_connection_options = net::ParseQuicConnectionOptions(
command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions));
}
if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) {
unsigned value;
if (base::StringToUint(
command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength),
&value)) {
params->quic_max_packet_length = value;
}
}
if (command_line.HasSwitch(switches::kQuicVersion)) {
quic::QuicTransportVersionVector supported_versions =
network_session_configurator::ParseQuicVersions(
command_line.GetSwitchValueASCII(switches::kQuicVersion));
if (!supported_versions.empty())
params->quic_supported_versions = supported_versions;
}
if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
std::string origins =
command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn);
for (const std::string& host_port : base::SplitString(
origins, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
if (host_port == "*")
params->origins_to_force_quic_on.insert(net::HostPortPair());
net::HostPortPair quic_origin =
net::HostPortPair::FromString(host_port);
if (!quic_origin.IsEmpty())
params->origins_to_force_quic_on.insert(quic_origin);
}
}
}
if (command_line.HasSwitch(switches::kEnableUserAlternateProtocolPorts)) {
params->enable_user_alternate_protocol_ports = true;
}
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) {
params->ignore_certificate_errors = true;
}
UMA_HISTOGRAM_BOOLEAN(
"Net.Certificate.IgnoreErrors",
command_line.HasSwitch(switches::kIgnoreCertificateErrors));
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
params->testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
}
if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
params->testing_fixed_https_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
}
if (command_line.HasSwitch(switches::kHostRules)) {
params->host_mapping_rules.SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostRules));
}
}
| 0 |
samba | c252546ceeb0925eb8a4061315e3ff0a8c55b48b | NOT_APPLICABLE | NOT_APPLICABLE | void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
{
struct map_struct *buf;
OFF_T i, len = st_p->st_size;
md_context m;
int32 remainder;
int fd;
memset(sum, 0, MAX_DIGEST_LEN);
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1)
return;
buf = map_file(fd, len, MAX_MAP_SIZE, CSUM_CHUNK);
switch (checksum_type) {
case CSUM_MD5:
md5_begin(&m);
for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
md5_update(&m, (uchar *)map_ptr(buf, i, CSUM_CHUNK),
CSUM_CHUNK);
}
remainder = (int32)(len - i);
if (remainder > 0)
md5_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
md5_result(&m, (uchar *)sum);
break;
case CSUM_MD4:
case CSUM_MD4_OLD:
case CSUM_MD4_BUSTED:
case CSUM_MD4_ARCHAIC:
mdfour_begin(&m);
for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
mdfour_update(&m, (uchar *)map_ptr(buf, i, CSUM_CHUNK),
CSUM_CHUNK);
}
/* Prior to version 27 an incorrect MD4 checksum was computed
* by failing to call mdfour_tail() for block sizes that
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
remainder = (int32)(len - i);
if (remainder > 0 || checksum_type > CSUM_MD4_BUSTED)
mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
mdfour_result(&m, (uchar *)sum);
break;
default:
rprintf(FERROR, "invalid checksum-choice for the --checksum option (%d)\n", checksum_type);
exit_cleanup(RERR_UNSUPPORTED);
}
close(fd);
unmap_file(buf);
}
| 0 |
linux | 148ca04518070910739dfc4eeda765057856403d | NOT_APPLICABLE | NOT_APPLICABLE | static int rose_clear_routes(void)
{
struct rose_neigh *s, *rose_neigh;
struct rose_node *t, *rose_node;
spin_lock_bh(&rose_node_list_lock);
spin_lock_bh(&rose_neigh_list_lock);
rose_neigh = rose_neigh_list;
rose_node = rose_node_list;
while (rose_node != NULL) {
t = rose_node;
rose_node = rose_node->next;
if (!t->loopback)
rose_remove_node(t);
}
while (rose_neigh != NULL) {
s = rose_neigh;
rose_neigh = rose_neigh->next;
if (s->use == 0 && !s->loopback) {
s->count = 0;
rose_remove_neigh(s);
}
}
spin_unlock_bh(&rose_neigh_list_lock);
spin_unlock_bh(&rose_node_list_lock);
return 0;
} | 0 |
linux | 1b5e2423164b3670e8bc9174e4762d297990deff | NOT_APPLICABLE | NOT_APPLICABLE | brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
const u8 *mac, struct station_info *sinfo)
{
struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_scb_val_le scb_val;
s32 err = 0;
struct brcmf_sta_info_le sta_info_le;
u32 sta_flags;
u32 is_tdls_peer;
s32 total_rssi;
s32 count_rssi;
int rssi;
u32 i;
brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
if (!check_vif_up(ifp->vif))
return -EIO;
if (brcmf_is_ibssmode(ifp->vif))
return brcmf_cfg80211_get_station_ibss(ifp, sinfo);
memset(&sta_info_le, 0, sizeof(sta_info_le));
memcpy(&sta_info_le, mac, ETH_ALEN);
err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
&sta_info_le,
sizeof(sta_info_le));
is_tdls_peer = !err;
if (err) {
err = brcmf_fil_iovar_data_get(ifp, "sta_info",
&sta_info_le,
sizeof(sta_info_le));
if (err < 0) {
bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
goto done;
}
}
brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
sinfo->filled = BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME);
sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
sta_flags = le32_to_cpu(sta_info_le.flags);
brcmf_convert_sta_flags(sta_flags, sinfo);
sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
if (is_tdls_peer)
sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
else
sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
if (sta_flags & BRCMF_STA_ASSOC) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME);
sinfo->connected_time = le32_to_cpu(sta_info_le.in);
brcmf_fill_bss_param(ifp, sinfo);
}
if (sta_flags & BRCMF_STA_SCBSTATS) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS);
sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
if (sinfo->tx_packets) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
sinfo->txrate.legacy =
le32_to_cpu(sta_info_le.tx_rate) / 100;
}
if (sinfo->rx_packets) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE);
sinfo->rxrate.legacy =
le32_to_cpu(sta_info_le.rx_rate) / 100;
}
if (le16_to_cpu(sta_info_le.ver) >= 4) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES);
sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES);
sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
}
total_rssi = 0;
count_rssi = 0;
for (i = 0; i < BRCMF_ANT_MAX; i++) {
if (sta_info_le.rssi[i]) {
sinfo->chain_signal_avg[count_rssi] =
sta_info_le.rssi[i];
sinfo->chain_signal[count_rssi] =
sta_info_le.rssi[i];
total_rssi += sta_info_le.rssi[i];
count_rssi++;
}
}
if (count_rssi) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
sinfo->chains = count_rssi;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
total_rssi /= count_rssi;
sinfo->signal = total_rssi;
} else if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
&ifp->vif->sme_state)) {
memset(&scb_val, 0, sizeof(scb_val));
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
&scb_val, sizeof(scb_val));
if (err) {
bphy_err(wiphy, "Could not get rssi (%d)\n",
err);
goto done;
} else {
rssi = le32_to_cpu(scb_val.val);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
sinfo->signal = rssi;
brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
}
}
}
done:
brcmf_dbg(TRACE, "Exit\n");
return err;
} | 0 |
openssl | b1d6d55ece1c26fa2829e2b819b038d7b6d692b4 | CVE-2018-0735 | CWE-320 | int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
const BIGNUM *scalar, const EC_POINT *point,
BN_CTX *ctx)
{
int i, cardinality_bits, group_top, kbit, pbit, Z_is_one;
EC_POINT *p = NULL;
EC_POINT *s = NULL;
BIGNUM *k = NULL;
BIGNUM *lambda = NULL;
BIGNUM *cardinality = NULL;
int ret = 0;
/* early exit if the input point is the point at infinity */
if (point != NULL && EC_POINT_is_at_infinity(group, point))
return EC_POINT_set_to_infinity(group, r);
if (BN_is_zero(group->order)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_UNKNOWN_ORDER);
return 0;
}
if (BN_is_zero(group->cofactor)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_UNKNOWN_COFACTOR);
return 0;
}
BN_CTX_start(ctx);
if (((p = EC_POINT_new(group)) == NULL)
|| ((s = EC_POINT_new(group)) == NULL)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_MALLOC_FAILURE);
goto err;
}
if (point == NULL) {
if (!EC_POINT_copy(p, group->generator)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_EC_LIB);
goto err;
}
} else {
if (!EC_POINT_copy(p, point)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_EC_LIB);
goto err;
}
}
EC_POINT_BN_set_flags(p, BN_FLG_CONSTTIME);
EC_POINT_BN_set_flags(r, BN_FLG_CONSTTIME);
EC_POINT_BN_set_flags(s, BN_FLG_CONSTTIME);
cardinality = BN_CTX_get(ctx);
lambda = BN_CTX_get(ctx);
k = BN_CTX_get(ctx);
if (k == NULL) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_MALLOC_FAILURE);
goto err;
}
if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
/*
* Group cardinalities are often on a word boundary.
* So when we pad the scalar, some timing diff might
* pop if it needs to be expanded due to carries.
* So expand ahead of time.
*/
cardinality_bits = BN_num_bits(cardinality);
group_top = bn_get_top(cardinality);
if ((bn_wexpand(k, group_top + 1) == NULL)
|| (bn_wexpand(lambda, group_top + 1) == NULL)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
if (!BN_copy(k, scalar)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
BN_set_flags(k, BN_FLG_CONSTTIME);
if ((BN_num_bits(k) > cardinality_bits) || (BN_is_negative(k))) {
/*-
* this is an unusual input, and we don't guarantee
* constant-timeness
*/
if (!BN_nnmod(k, k, cardinality, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
}
if (!BN_add(lambda, k, cardinality)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
BN_set_flags(lambda, BN_FLG_CONSTTIME);
if (!BN_add(k, lambda, cardinality)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
/*
* lambda := scalar + cardinality
* k := scalar + 2*cardinality
*/
kbit = BN_is_bit_set(lambda, cardinality_bits);
BN_consttime_swap(kbit, k, lambda, group_top + 1);
group_top = bn_get_top(group->field);
if ((bn_wexpand(s->X, group_top) == NULL)
|| (bn_wexpand(s->Y, group_top) == NULL)
|| (bn_wexpand(s->Z, group_top) == NULL)
|| (bn_wexpand(r->X, group_top) == NULL)
|| (bn_wexpand(r->Y, group_top) == NULL)
|| (bn_wexpand(r->Z, group_top) == NULL)
|| (bn_wexpand(p->X, group_top) == NULL)
|| (bn_wexpand(p->Y, group_top) == NULL)
|| (bn_wexpand(p->Z, group_top) == NULL)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
/*-
* Apply coordinate blinding for EC_POINT.
*
* The underlying EC_METHOD can optionally implement this function:
* ec_point_blind_coordinates() returns 0 in case of errors or 1 on
* success or if coordinate blinding is not implemented for this
* group.
*/
if (!ec_point_blind_coordinates(group, p, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_POINT_COORDINATES_BLIND_FAILURE);
goto err;
}
/* Initialize the Montgomery ladder */
if (!ec_point_ladder_pre(group, r, s, p, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_LADDER_PRE_FAILURE);
goto err;
}
/* top bit is a 1, in a fixed pos */
pbit = 1;
#define EC_POINT_CSWAP(c, a, b, w, t) do { \
BN_consttime_swap(c, (a)->X, (b)->X, w); \
BN_consttime_swap(c, (a)->Y, (b)->Y, w); \
BN_consttime_swap(c, (a)->Z, (b)->Z, w); \
t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \
(a)->Z_is_one ^= (t); \
(b)->Z_is_one ^= (t); \
} while(0)
/*-
* The ladder step, with branches, is
*
* k[i] == 0: S = add(R, S), R = dbl(R)
* k[i] == 1: R = add(S, R), S = dbl(S)
*
* Swapping R, S conditionally on k[i] leaves you with state
*
* k[i] == 0: T, U = R, S
* k[i] == 1: T, U = S, R
*
* Then perform the ECC ops.
*
* U = add(T, U)
* T = dbl(T)
*
* Which leaves you with state
*
* k[i] == 0: U = add(R, S), T = dbl(R)
* k[i] == 1: U = add(S, R), T = dbl(S)
*
* Swapping T, U conditionally on k[i] leaves you with state
*
* k[i] == 0: R, S = T, U
* k[i] == 1: R, S = U, T
*
* Which leaves you with state
*
* k[i] == 0: S = add(R, S), R = dbl(R)
* k[i] == 1: R = add(S, R), S = dbl(S)
*
* So we get the same logic, but instead of a branch it's a
* conditional swap, followed by ECC ops, then another conditional swap.
*
* Optimization: The end of iteration i and start of i-1 looks like
*
* ...
* CSWAP(k[i], R, S)
* ECC
* CSWAP(k[i], R, S)
* (next iteration)
* CSWAP(k[i-1], R, S)
* ECC
* CSWAP(k[i-1], R, S)
* ...
*
* So instead of two contiguous swaps, you can merge the condition
* bits and do a single swap.
*
* k[i] k[i-1] Outcome
* 0 0 No Swap
* 0 1 Swap
* 1 0 Swap
* 1 1 No Swap
*
* This is XOR. pbit tracks the previous bit of k.
*/
for (i = cardinality_bits - 1; i >= 0; i--) {
kbit = BN_is_bit_set(k, i) ^ pbit;
EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one);
/* Perform a single step of the Montgomery ladder */
if (!ec_point_ladder_step(group, r, s, p, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_LADDER_STEP_FAILURE);
goto err;
}
/*
* pbit logic merges this cswap with that of the
* next iteration
*/
pbit ^= kbit;
}
/* one final cswap to move the right value into r */
EC_POINT_CSWAP(pbit, r, s, group_top, Z_is_one);
#undef EC_POINT_CSWAP
/* Finalize ladder (and recover full point coordinates) */
if (!ec_point_ladder_post(group, r, s, p, ctx)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, EC_R_LADDER_POST_FAILURE);
goto err;
}
ret = 1;
err:
EC_POINT_free(p);
EC_POINT_free(s);
BN_CTX_end(ctx);
return ret;
}
| 1 |
linux | 410dd3cf4c9b36f27ed4542ee18b1af5e68645a4 | NOT_APPLICABLE | NOT_APPLICABLE | static int rock_continue(struct rock_state *rs)
{
int ret = 1;
int blocksize = 1 << rs->inode->i_blkbits;
const int min_de_size = offsetof(struct rock_ridge, u);
kfree(rs->buffer);
rs->buffer = NULL;
if ((unsigned)rs->cont_offset > blocksize - min_de_size ||
(unsigned)rs->cont_size > blocksize ||
(unsigned)(rs->cont_offset + rs->cont_size) > blocksize) {
printk(KERN_NOTICE "rock: corrupted directory entry. "
"extent=%d, offset=%d, size=%d\n",
rs->cont_extent, rs->cont_offset, rs->cont_size);
ret = -EIO;
goto out;
}
if (rs->cont_extent) {
struct buffer_head *bh;
rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL);
if (!rs->buffer) {
ret = -ENOMEM;
goto out;
}
ret = -EIO;
bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
if (bh) {
memcpy(rs->buffer, bh->b_data + rs->cont_offset,
rs->cont_size);
put_bh(bh);
rs->chr = rs->buffer;
rs->len = rs->cont_size;
rs->cont_extent = 0;
rs->cont_size = 0;
rs->cont_offset = 0;
return 0;
}
printk("Unable to read rock-ridge attributes\n");
}
out:
kfree(rs->buffer);
rs->buffer = NULL;
return ret;
}
| 0 |
Bento4 | 4d3f0bebd5f8518fd775f671c12bea58c68e814e | NOT_APPLICABLE | NOT_APPLICABLE | AP4_AtomLocator(AP4_Atom* atom, AP4_UI64 offset) :
m_Atom(atom),
m_Offset(offset) {} | 0 |
linux | 350a5c4dd2452ea999cc5e1d4a8dbf12de2f97ef | NOT_APPLICABLE | NOT_APPLICABLE | static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog,
const struct cred *f_cred)
{
const struct bpf_map *map;
struct bpf_insn *insns;
u32 off, type;
u64 imm;
u8 code;
int i;
insns = kmemdup(prog->insnsi, bpf_prog_insn_size(prog),
GFP_USER);
if (!insns)
return insns;
for (i = 0; i < prog->len; i++) {
code = insns[i].code;
if (code == (BPF_JMP | BPF_TAIL_CALL)) {
insns[i].code = BPF_JMP | BPF_CALL;
insns[i].imm = BPF_FUNC_tail_call;
/* fall-through */
}
if (code == (BPF_JMP | BPF_CALL) ||
code == (BPF_JMP | BPF_CALL_ARGS)) {
if (code == (BPF_JMP | BPF_CALL_ARGS))
insns[i].code = BPF_JMP | BPF_CALL;
if (!bpf_dump_raw_ok(f_cred))
insns[i].imm = 0;
continue;
}
if (BPF_CLASS(code) == BPF_LDX && BPF_MODE(code) == BPF_PROBE_MEM) {
insns[i].code = BPF_LDX | BPF_SIZE(code) | BPF_MEM;
continue;
}
if (code != (BPF_LD | BPF_IMM | BPF_DW))
continue;
imm = ((u64)insns[i + 1].imm << 32) | (u32)insns[i].imm;
map = bpf_map_from_imm(prog, imm, &off, &type);
if (map) {
insns[i].src_reg = type;
insns[i].imm = map->id;
insns[i + 1].imm = off;
continue;
}
}
return insns;
} | 0 |
server | 0dec71ca53729bd1a565bdc800e64008b44ffa48 | CVE-2021-46667 | CWE-190 | bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
{
if (!((options & SELECT_DISTINCT) && !group_list.elements))
hidden_bit_fields= 0;
// find_order_in_list() may need some extra space, so multiply by two.
order_group_num*= 2;
/*
We have to create array in prepared statement memory if it is a
prepared statement
*/
Query_arena *arena= thd->stmt_arena;
const uint n_elems= (n_sum_items +
n_child_sum_items +
item_list.elements +
select_n_reserved +
select_n_having_items +
select_n_where_fields +
order_group_num +
hidden_bit_fields +
fields_in_window_functions) * 5;
if (!ref_pointer_array.is_null())
{
/*
We need to take 'n_sum_items' into account when allocating the array,
and this may actually increase during the optimization phase due to
MIN/MAX rewrite in Item_in_subselect::single_value_transformer.
In the usual case we can reuse the array from the prepare phase.
If we need a bigger array, we must allocate a new one.
*/
if (ref_pointer_array.size() >= n_elems)
return false;
}
Item **array= static_cast<Item**>(arena->alloc(sizeof(Item*) * n_elems));
if (array != NULL)
ref_pointer_array= Ref_ptr_array(array, n_elems);
return array == NULL;
} | 1 |
oniguruma | d3e402928b6eb3327f8f7d59a9edfa622fec557b | NOT_APPLICABLE | NOT_APPLICABLE | onig_get_capture_range_in_callout(OnigCalloutArgs* a, int mem_num, int* begin, int* end)
{
OnigRegex reg;
const UChar* str;
StackType* stk_base;
int i;
i = mem_num;
reg = a->regex;
str = a->string;
stk_base = a->stk_base;
if (i > 0) {
if (a->mem_end_stk[i] != INVALID_STACK_INDEX) {
if (MEM_STATUS_AT(reg->bt_mem_start, i))
*begin = (int )(STACK_AT(a->mem_start_stk[i])->u.mem.pstr - str);
else
*begin = (int )((UChar* )((void* )a->mem_start_stk[i]) - str);
*end = (int )((MEM_STATUS_AT(reg->bt_mem_end, i)
? STACK_AT(a->mem_end_stk[i])->u.mem.pstr
: (UChar* )((void* )a->mem_end_stk[i])) - str);
}
else {
*begin = *end = ONIG_REGION_NOTPOS;
}
}
else
return ONIGERR_INVALID_ARGUMENT;
return ONIG_NORMAL;
} | 0 |
curl | 75dc096e01ef1e21b6c57690d99371dedb2c0b80 | NOT_APPLICABLE | NOT_APPLICABLE | CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles)
{
struct Curl_easy *data;
CURLMcode returncode=CURLM_OK;
struct Curl_tree *t;
struct timeval now = Curl_tvnow();
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
data=multi->easyp;
while(data) {
CURLMcode result;
SIGPIPE_VARIABLE(pipe_st);
sigpipe_ignore(data, &pipe_st);
result = multi_runsingle(multi, now, data);
sigpipe_restore(&pipe_st);
if(result)
returncode = result;
data = data->next; /* operate on next handle */
}
/*
* Simply remove all expired timers from the splay since handles are dealt
* with unconditionally by this function and curl_multi_timeout() requires
* that already passed/handled expire times are removed from the splay.
*
* It is important that the 'now' value is set at the entry of this function
* and not for the current time as it may have ticked a little while since
* then and then we risk this loop to remove timers that actually have not
* been handled!
*/
do {
multi->timetree = Curl_splaygetbest(now, multi->timetree, &t);
if(t)
/* the removed may have another timeout in queue */
(void)add_next_timeout(now, multi, t->payload);
} while(t);
*running_handles = multi->num_alive;
if(CURLM_OK >= returncode)
update_timer(multi);
return returncode;
} | 0 |
wildmidi | 660b513d99bced8783a4a5984ac2f742c74ebbdd | NOT_APPLICABLE | NOT_APPLICABLE | void _WM_do_midi_divisions(struct _mdi *mdi, struct _event_data *data) {
UNUSED(mdi);
UNUSED(data);
return;
}
| 0 |
Chrome | 508b89a64ab700aa09f21fc666a5588b47360eab | NOT_APPLICABLE | NOT_APPLICABLE | ScopedKeepAlive() { chrome::StartKeepAlive(); }
| 0 |
gst-plugins-ugly | d21017b52a585f145e8d62781bcc1c5fefc7ee37 | NOT_APPLICABLE | NOT_APPLICABLE | gst_asf_demux_check_chained_asf (GstASFDemux * demux)
{
guint64 off = demux->data_offset + (demux->packet * demux->packet_size);
GstFlowReturn ret = GST_FLOW_OK;
GstBuffer *buf = NULL;
gboolean header = FALSE;
/* TODO maybe we should skip index objects after the data and look
* further for a new header */
if (gst_asf_demux_pull_data (demux, off, ASF_OBJECT_HEADER_SIZE, &buf, &ret)) {
g_assert (buf != NULL);
/* check if it is a header */
if (gst_asf_demux_check_buffer_is_header (demux, buf)) {
GST_DEBUG_OBJECT (demux, "new base offset: %" G_GUINT64_FORMAT, off);
demux->base_offset = off;
header = TRUE;
}
gst_buffer_unref (buf);
}
return header;
}
| 0 |
linux | f63a8daa5812afef4f06c962351687e1ff9ccb2b | CVE-2016-6787 | CWE-264 | SYSCALL_DEFINE5(perf_event_open,
struct perf_event_attr __user *, attr_uptr,
pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
{
struct perf_event *group_leader = NULL, *output_event = NULL;
struct perf_event *event, *sibling;
struct perf_event_attr attr;
struct perf_event_context *ctx;
struct file *event_file = NULL;
struct fd group = {NULL, 0};
struct task_struct *task = NULL;
struct pmu *pmu;
int event_fd;
int move_group = 0;
int err;
int f_flags = O_RDWR;
/* for future expandability... */
if (flags & ~PERF_FLAG_ALL)
return -EINVAL;
err = perf_copy_attr(attr_uptr, &attr);
if (err)
return err;
if (!attr.exclude_kernel) {
if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
return -EACCES;
}
if (attr.freq) {
if (attr.sample_freq > sysctl_perf_event_sample_rate)
return -EINVAL;
} else {
if (attr.sample_period & (1ULL << 63))
return -EINVAL;
}
/*
* In cgroup mode, the pid argument is used to pass the fd
* opened to the cgroup directory in cgroupfs. The cpu argument
* designates the cpu on which to monitor threads from that
* cgroup.
*/
if ((flags & PERF_FLAG_PID_CGROUP) && (pid == -1 || cpu == -1))
return -EINVAL;
if (flags & PERF_FLAG_FD_CLOEXEC)
f_flags |= O_CLOEXEC;
event_fd = get_unused_fd_flags(f_flags);
if (event_fd < 0)
return event_fd;
if (group_fd != -1) {
err = perf_fget_light(group_fd, &group);
if (err)
goto err_fd;
group_leader = group.file->private_data;
if (flags & PERF_FLAG_FD_OUTPUT)
output_event = group_leader;
if (flags & PERF_FLAG_FD_NO_GROUP)
group_leader = NULL;
}
if (pid != -1 && !(flags & PERF_FLAG_PID_CGROUP)) {
task = find_lively_task_by_vpid(pid);
if (IS_ERR(task)) {
err = PTR_ERR(task);
goto err_group_fd;
}
}
if (task && group_leader &&
group_leader->attr.inherit != attr.inherit) {
err = -EINVAL;
goto err_task;
}
get_online_cpus();
event = perf_event_alloc(&attr, cpu, task, group_leader, NULL,
NULL, NULL);
if (IS_ERR(event)) {
err = PTR_ERR(event);
goto err_cpus;
}
if (flags & PERF_FLAG_PID_CGROUP) {
err = perf_cgroup_connect(pid, event, &attr, group_leader);
if (err) {
__free_event(event);
goto err_cpus;
}
}
if (is_sampling_event(event)) {
if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
err = -ENOTSUPP;
goto err_alloc;
}
}
account_event(event);
/*
* Special case software events and allow them to be part of
* any hardware group.
*/
pmu = event->pmu;
if (group_leader &&
(is_software_event(event) != is_software_event(group_leader))) {
if (is_software_event(event)) {
/*
* If event and group_leader are not both a software
* event, and event is, then group leader is not.
*
* Allow the addition of software events to !software
* groups, this is safe because software events never
* fail to schedule.
*/
pmu = group_leader->pmu;
} else if (is_software_event(group_leader) &&
(group_leader->group_flags & PERF_GROUP_SOFTWARE)) {
/*
* In case the group is a pure software group, and we
* try to add a hardware event, move the whole group to
* the hardware context.
*/
move_group = 1;
}
}
/*
* Get the target context (task or percpu):
*/
ctx = find_get_context(pmu, task, event->cpu);
if (IS_ERR(ctx)) {
err = PTR_ERR(ctx);
goto err_alloc;
}
if (task) {
put_task_struct(task);
task = NULL;
}
/*
* Look up the group leader (we will attach this event to it):
*/
if (group_leader) {
err = -EINVAL;
/*
* Do not allow a recursive hierarchy (this new sibling
* becoming part of another group-sibling):
*/
if (group_leader->group_leader != group_leader)
goto err_context;
/*
* Do not allow to attach to a group in a different
* task or CPU context:
*/
if (move_group) {
/*
* Make sure we're both on the same task, or both
* per-cpu events.
*/
if (group_leader->ctx->task != ctx->task)
goto err_context;
/*
* Make sure we're both events for the same CPU;
* grouping events for different CPUs is broken; since
* you can never concurrently schedule them anyhow.
*/
if (group_leader->cpu != event->cpu)
goto err_context;
} else {
if (group_leader->ctx != ctx)
goto err_context;
}
/*
* Only a group leader can be exclusive or pinned
*/
if (attr.exclusive || attr.pinned)
goto err_context;
}
if (output_event) {
err = perf_event_set_output(event, output_event);
if (err)
goto err_context;
}
event_file = anon_inode_getfile("[perf_event]", &perf_fops, event,
f_flags);
if (IS_ERR(event_file)) {
err = PTR_ERR(event_file);
goto err_context;
}
if (move_group) {
struct perf_event_context *gctx = group_leader->ctx;
mutex_lock(&gctx->mutex);
perf_remove_from_context(group_leader, false);
/*
* Removing from the context ends up with disabled
* event. What we want here is event in the initial
* startup state, ready to be add into new context.
*/
perf_event__state_init(group_leader);
list_for_each_entry(sibling, &group_leader->sibling_list,
group_entry) {
perf_remove_from_context(sibling, false);
perf_event__state_init(sibling);
put_ctx(gctx);
}
mutex_unlock(&gctx->mutex);
put_ctx(gctx);
}
WARN_ON_ONCE(ctx->parent_ctx);
mutex_lock(&ctx->mutex);
if (move_group) {
synchronize_rcu();
perf_install_in_context(ctx, group_leader, group_leader->cpu);
get_ctx(ctx);
list_for_each_entry(sibling, &group_leader->sibling_list,
group_entry) {
perf_install_in_context(ctx, sibling, sibling->cpu);
get_ctx(ctx);
}
}
perf_install_in_context(ctx, event, event->cpu);
perf_unpin_context(ctx);
mutex_unlock(&ctx->mutex);
put_online_cpus();
event->owner = current;
mutex_lock(¤t->perf_event_mutex);
list_add_tail(&event->owner_entry, ¤t->perf_event_list);
mutex_unlock(¤t->perf_event_mutex);
/*
* Precalculate sample_data sizes
*/
perf_event__header_size(event);
perf_event__id_header_size(event);
/*
* Drop the reference on the group_event after placing the
* new event on the sibling_list. This ensures destruction
* of the group leader will find the pointer to itself in
* perf_group_detach().
*/
fdput(group);
fd_install(event_fd, event_file);
return event_fd;
err_context:
perf_unpin_context(ctx);
put_ctx(ctx);
err_alloc:
free_event(event);
err_cpus:
put_online_cpus();
err_task:
if (task)
put_task_struct(task);
err_group_fd:
fdput(group);
err_fd:
put_unused_fd(event_fd);
return err;
}
| 1 |
linux | 072684e8c58d17e853f8e8b9f6d9ce2e58d2b036 | NOT_APPLICABLE | NOT_APPLICABLE | static void hidg_free(struct usb_function *f)
{
struct f_hidg *hidg;
struct f_hid_opts *opts;
hidg = func_to_hidg(f);
opts = container_of(f->fi, struct f_hid_opts, func_inst);
kfree(hidg->report_desc);
kfree(hidg);
mutex_lock(&opts->lock);
--opts->refcnt;
mutex_unlock(&opts->lock);
}
| 0 |
linux | 9c52057c698fb96f8f07e7a4bcf4801a092bda89 | NOT_APPLICABLE | NOT_APPLICABLE | long btrfs_ioctl_trans_end(struct file *file)
{
struct inode *inode = fdentry(file)->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
trans = file->private_data;
if (!trans)
return -EINVAL;
file->private_data = NULL;
btrfs_end_transaction(trans, root);
atomic_dec(&root->fs_info->open_ioctl_trans);
mnt_drop_write_file(file);
return 0;
}
| 0 |
gdk-pixbuf | 31a6cff3dfc6944aad4612a9668b8ad39122e48b | NOT_APPLICABLE | NOT_APPLICABLE | tiff_load_read (thandle_t handle, tdata_t buf, tsize_t size)
{
TiffContext *context = (TiffContext *)handle;
if (context->pos + size > context->used)
return 0;
memcpy (buf, context->buffer + context->pos, size);
context->pos += size;
return size;
} | 0 |
Chrome | 0bb3f5c715eb66bb5c1fb05fd81d902ca57f33ca | NOT_APPLICABLE | NOT_APPLICABLE | void SiteInstanceImpl::LockToOriginIfNeeded() {
DCHECK(HasSite());
process_->SetIsUsed();
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
auto lock_state = policy->CheckOriginLock(process_->GetID(), site_);
if (ShouldLockToOrigin(GetBrowserContext(), process_, site_)) {
CHECK(!process_->IsForGuestsOnly());
switch (lock_state) {
case CheckOriginLockResult::NO_LOCK: {
process_->LockToOrigin(site_);
break;
}
case CheckOriginLockResult::HAS_WRONG_LOCK:
base::debug::SetCrashKeyString(bad_message::GetRequestedSiteURLKey(),
site_.spec());
base::debug::SetCrashKeyString(
bad_message::GetKilledProcessOriginLockKey(),
policy->GetOriginLock(process_->GetID()).spec());
CHECK(false) << "Trying to lock a process to " << site_
<< " but the process is already locked to "
<< policy->GetOriginLock(process_->GetID());
break;
case CheckOriginLockResult::HAS_EQUAL_LOCK:
break;
default:
NOTREACHED();
}
} else {
if (lock_state != CheckOriginLockResult::NO_LOCK) {
base::debug::SetCrashKeyString(bad_message::GetRequestedSiteURLKey(),
site_.spec());
base::debug::SetCrashKeyString(
bad_message::GetKilledProcessOriginLockKey(),
policy->GetOriginLock(process_->GetID()).spec());
CHECK(false) << "Trying to commit non-isolated site " << site_
<< " in process locked to "
<< policy->GetOriginLock(process_->GetID());
}
}
}
| 0 |
libsndfile | dbe14f00030af5d3577f4cabbf9861db59e9c378 | NOT_APPLICABLE | NOT_APPLICABLE | sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
{ SD2_RSRC rsrc ;
STR_RSRC str_rsrc [] =
{ { RSRC_STR, 1000, "_sample-size", "", 0 },
{ RSRC_STR, 1001, "_sample-rate", "", 0 },
{ RSRC_STR, 1002, "_channels", "", 0 },
{ RSRC_BIN, 1000, "_Markers", "", 8 }
} ;
int k, str_offset, data_offset, next_str ;
psf_use_rsrc (psf, SF_TRUE) ;
memset (&rsrc, 0, sizeof (rsrc)) ;
rsrc.sample_rate = psf->sf.samplerate ;
rsrc.sample_size = psf->bytewidth ;
rsrc.channels = psf->sf.channels ;
rsrc.rsrc_data = psf->header ;
rsrc.rsrc_len = sizeof (psf->header) ;
memset (rsrc.rsrc_data, 0xea, rsrc.rsrc_len) ;
snprintf (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ;
snprintf (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ;
snprintf (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ;
for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++)
{ if (str_rsrc [k].value_len == 0)
{ str_rsrc [k].value_len = strlen (str_rsrc [k].value) ;
str_rsrc [k].value [0] = str_rsrc [k].value_len - 1 ;
} ;
/* Turn name string into a pascal string. */
str_rsrc [k].name [0] = strlen (str_rsrc [k].name) - 1 ;
} ;
rsrc.data_offset = 0x100 ;
/*
** Calculate data length :
** length of strings, plus the length of the sdML chunk.
*/
rsrc.data_length = 0 ;
for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++)
rsrc.data_length += str_rsrc [k].value_len + 4 ;
rsrc.map_offset = rsrc.data_offset + rsrc.data_length ;
/* Very start of resource fork. */
write_int (rsrc.rsrc_data, 0, rsrc.data_offset) ;
write_int (rsrc.rsrc_data, 4, rsrc.map_offset) ;
write_int (rsrc.rsrc_data, 8, rsrc.data_length) ;
write_char (rsrc.rsrc_data, 0x30, strlen (psf->file.name.c)) ;
write_str (rsrc.rsrc_data, 0x31, psf->file.name.c, strlen (psf->file.name.c)) ;
write_short (rsrc.rsrc_data, 0x50, 0) ;
write_marker (rsrc.rsrc_data, 0x52, Sd2f_MARKER) ;
write_marker (rsrc.rsrc_data, 0x56, lsf1_MARKER) ;
/* Very start of resource map. */
write_int (rsrc.rsrc_data, rsrc.map_offset + 0, rsrc.data_offset) ;
write_int (rsrc.rsrc_data, rsrc.map_offset + 4, rsrc.map_offset) ;
write_int (rsrc.rsrc_data, rsrc.map_offset + 8, rsrc.data_length) ;
/* These I don't currently understand. */
if (1)
{ write_char (rsrc.rsrc_data, rsrc.map_offset+ 16, 1) ;
/* Next resource map. */
write_int (rsrc.rsrc_data, rsrc.map_offset + 17, 0x12345678) ;
/* File ref number. */
write_short (rsrc.rsrc_data, rsrc.map_offset + 21, 0xabcd) ;
/* Fork attributes. */
write_short (rsrc.rsrc_data, rsrc.map_offset + 23, 0) ;
} ;
/* Resource type offset. */
rsrc.type_offset = rsrc.map_offset + 30 ;
write_short (rsrc.rsrc_data, rsrc.map_offset + 24, rsrc.type_offset - rsrc.map_offset - 2) ;
/* Type index max. */
rsrc.type_count = 2 ;
write_short (rsrc.rsrc_data, rsrc.map_offset + 28, rsrc.type_count - 1) ;
rsrc.item_offset = rsrc.type_offset + rsrc.type_count * 8 ;
rsrc.str_count = ARRAY_LEN (str_rsrc) ;
rsrc.string_offset = rsrc.item_offset + (rsrc.str_count + 1) * 12 - rsrc.map_offset ;
write_short (rsrc.rsrc_data, rsrc.map_offset + 26, rsrc.string_offset) ;
/* Write 'STR ' resource type. */
rsrc.str_count = 3 ;
write_marker (rsrc.rsrc_data, rsrc.type_offset, STR_MARKER) ;
write_short (rsrc.rsrc_data, rsrc.type_offset + 4, rsrc.str_count - 1) ;
write_short (rsrc.rsrc_data, rsrc.type_offset + 6, 0x12) ;
/* Write 'sdML' resource type. */
write_marker (rsrc.rsrc_data, rsrc.type_offset + 8, sdML_MARKER) ;
write_short (rsrc.rsrc_data, rsrc.type_offset + 12, 0) ;
write_short (rsrc.rsrc_data, rsrc.type_offset + 14, 0x36) ;
str_offset = rsrc.map_offset + rsrc.string_offset ;
next_str = 0 ;
data_offset = rsrc.data_offset ;
for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++)
{ write_str (rsrc.rsrc_data, str_offset, str_rsrc [k].name, strlen (str_rsrc [k].name)) ;
write_short (rsrc.rsrc_data, rsrc.item_offset + k * 12, str_rsrc [k].id) ;
write_short (rsrc.rsrc_data, rsrc.item_offset + k * 12 + 2, next_str) ;
str_offset += strlen (str_rsrc [k].name) ;
next_str += strlen (str_rsrc [k].name) ;
write_int (rsrc.rsrc_data, rsrc.item_offset + k * 12 + 4, data_offset - rsrc.data_offset) ;
write_int (rsrc.rsrc_data, data_offset, str_rsrc [k].value_len) ;
write_str (rsrc.rsrc_data, data_offset + 4, str_rsrc [k].value, str_rsrc [k].value_len) ;
data_offset += 4 + str_rsrc [k].value_len ;
} ;
/* Finally, calculate and set map length. */
rsrc.map_length = str_offset - rsrc.map_offset ;
write_int (rsrc.rsrc_data, 12, rsrc.map_length) ;
write_int (rsrc.rsrc_data, rsrc.map_offset + 12, rsrc.map_length) ;
rsrc.rsrc_len = rsrc.map_offset + rsrc.map_length ;
psf_fwrite (rsrc.rsrc_data, rsrc.rsrc_len, 1, psf) ;
psf_use_rsrc (psf, SF_FALSE) ;
if (psf->error)
return psf->error ;
return 0 ;
} /* sd2_write_rsrc_fork */
| 0 |
php-src | a33759fd275b32ed0bbe89796fe2953b3cb0b41f | NOT_APPLICABLE | NOT_APPLICABLE | private void
cvt_64(union VALUETYPE *p, const struct magic *m)
{
DO_CVT(q, (uint64_t)); | 0 |
Chrome | 2649de11c562aa96d336c06136a1a20c01711be0 | NOT_APPLICABLE | NOT_APPLICABLE | AppViewGuestDelegate* ExtensionsAPIClient::CreateAppViewGuestDelegate() const {
return NULL;
}
| 0 |
haproxy | 3f0e1ec70173593f4c2b3681b26c04a4ed5fc588 | NOT_APPLICABLE | NOT_APPLICABLE | static int h2c_ack_settings(struct h2c *h2c)
{
struct buffer *res;
char str[9];
int ret = -1;
if (h2c_mux_busy(h2c, NULL)) {
h2c->flags |= H2_CF_DEM_MBUSY;
return 0;
}
res = h2_get_buf(h2c, &h2c->mbuf);
if (!res) {
h2c->flags |= H2_CF_MUX_MALLOC;
h2c->flags |= H2_CF_DEM_MROOM;
return 0;
}
memcpy(str,
"\x00\x00\x00" /* length : 0 (no data) */
"\x04" "\x01" /* type : 4, flags : ACK */
"\x00\x00\x00\x00" /* stream ID */, 9);
ret = bo_istput(res, ist2(str, 9));
if (unlikely(ret <= 0)) {
if (!ret) {
h2c->flags |= H2_CF_MUX_MFULL;
h2c->flags |= H2_CF_DEM_MROOM;
return 0;
}
else {
h2c_error(h2c, H2_ERR_INTERNAL_ERROR);
return 0;
}
}
return ret;
}
| 0 |
php-src | a5a15965da23c8e97657278fc8dfbf1dfb20c016 | NOT_APPLICABLE | NOT_APPLICABLE | SPL_METHOD(SplFileObject, setFlags)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intern->flags) == FAILURE) {
return;
}
} /* }}} */ | 0 |
libvirt | 4c4d0e2da07b5a035b26a0ff13ec27070f7c7b1a | CVE-2021-3559 | CWE-119 | virNodeDeviceGetMdevTypesCaps(const char *sysfspath,
virMediatedDeviceTypePtr **mdev_types,
size_t *nmdev_types)
{
virMediatedDeviceTypePtr *types = NULL;
size_t ntypes = 0;
size_t i;
/* this could be a refresh, so clear out the old data */
for (i = 0; i < *nmdev_types; i++)
virMediatedDeviceTypeFree(*mdev_types[i]);
VIR_FREE(*mdev_types);
*nmdev_types = 0;
if (virMediatedDeviceGetMdevTypes(sysfspath, &types, &ntypes) < 0)
return -1;
*mdev_types = g_steal_pointer(&types);
*nmdev_types = ntypes;
return 0;
} | 1 |
vim | 53575521406739cf20bbe4e384d88e7dca11f040 | NOT_APPLICABLE | NOT_APPLICABLE | typebuf_maplen(void)
{
return typebuf.tb_maplen;
} | 0 |
tensorflow | e84c975313e8e8e38bb2ea118196369c45c51378 | NOT_APPLICABLE | NOT_APPLICABLE | explicit BoostedTreesSparseCalculateBestFeatureSplitOp(
OpKernelConstruction* const context)
: OpKernel(context) {
// TODO(crawles): Using logits_dim_ for multi-class split.
OP_REQUIRES_OK(context, context->GetAttr("logits_dimension", &logits_dim_));
// TODO(tanzheny): Using this for equality split.
OP_REQUIRES_OK(context, context->GetAttr("split_type", &split_type_));
} | 0 |
clamav-devel | 3d664817f6ef833a17414a4ecea42004c35cc42f | NOT_APPLICABLE | NOT_APPLICABLE | int cli_bytecode_runlsig(cli_ctx *cctx, struct cli_target_info *tinfo,
const struct cli_all_bc *bcs, unsigned bc_idx,
const char **virname, const uint32_t* lsigcnt,
const uint32_t *lsigsuboff, fmap_t *map)
{
int ret;
struct cli_bc_ctx ctx;
const struct cli_bc *bc = &bcs->all_bcs[bc_idx-1];
struct cli_pe_hook_data pehookdata;
memset(&ctx, 0, sizeof(ctx));
cli_bytecode_context_setfuncid(&ctx, bc, 0);
ctx.hooks.match_counts = lsigcnt;
ctx.hooks.match_offsets = lsigsuboff;
cli_bytecode_context_setctx(&ctx, cctx);
cli_bytecode_context_setfile(&ctx, map);
if (tinfo && tinfo->status == 1) {
ctx.sections = tinfo->exeinfo.section;
memset(&pehookdata, 0, sizeof(pehookdata));
pehookdata.offset = tinfo->exeinfo.offset;
pehookdata.ep = tinfo->exeinfo.ep;
pehookdata.nsections = tinfo->exeinfo.nsections;
pehookdata.hdr_size = tinfo->exeinfo.hdr_size;
ctx.hooks.pedata = &pehookdata;
ctx.resaddr = tinfo->exeinfo.res_addr;
}
if (bc->hook_lsig_id) {
cli_dbgmsg("hook lsig id %d matched (bc %d)\n", bc->hook_lsig_id, bc->id);
/* this is a bytecode for a hook, defer running it until hook is
* executed, so that it has all the info for the hook */
if (cctx->hook_lsig_matches)
cli_bitset_set(cctx->hook_lsig_matches, bc->hook_lsig_id-1);
/* save match counts */
memcpy(&ctx.lsigcnt, lsigcnt, 64*4);
memcpy(&ctx.lsigoff, lsigsuboff, 64*4);
cli_bytecode_context_clear(&ctx);
return CL_SUCCESS;
}
cli_dbgmsg("Running bytecode for logical signature match\n");
ret = cli_bytecode_run(bcs, bc, &ctx);
if (ret != CL_SUCCESS) {
cli_warnmsg("Bytcode %u failed to run: %s\n", bc->id, cl_strerror(ret));
cli_bytecode_context_clear(&ctx);
return CL_SUCCESS;
}
if (ctx.virname) {
int rc;
cli_dbgmsg("Bytecode found virus: %s\n", ctx.virname);
if (virname)
*virname = ctx.virname;
if (!strncmp(*virname, "BC.Heuristics", 13))
rc = cli_found_possibly_unwanted(cctx);
else
rc = CL_VIRUS;
cli_bytecode_context_clear(&ctx);
return rc;
}
ret = cli_bytecode_context_getresult_int(&ctx);
cli_dbgmsg("Bytecode %u returned code: %u\n", bc->id, ret);
cli_bytecode_context_clear(&ctx);
return CL_SUCCESS;
} | 0 |
linux | 427215d85e8d1476da1a86b8d67aceb485eb3631 | NOT_APPLICABLE | NOT_APPLICABLE | static void __attach_mnt(struct mount *mnt, struct mount *parent)
{
hlist_add_head_rcu(&mnt->mnt_hash,
m_hash(&parent->mnt, mnt->mnt_mountpoint));
list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
} | 0 |
linux-2.6 | 8a47077a0b5aa2649751c46e7a27884e6686ccbf | NOT_APPLICABLE | NOT_APPLICABLE | static void addrconf_rs_timer(unsigned long data)
{
struct inet6_ifaddr *ifp = (struct inet6_ifaddr *) data;
if (ifp->idev->cnf.forwarding)
goto out;
if (ifp->idev->if_flags & IF_RA_RCVD) {
/*
* Announcement received after solicitation
* was sent
*/
goto out;
}
spin_lock(&ifp->lock);
if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) {
struct in6_addr all_routers;
/* The wait after the last probe can be shorter */
addrconf_mod_timer(ifp, AC_RS,
(ifp->probes == ifp->idev->cnf.rtr_solicits) ?
ifp->idev->cnf.rtr_solicit_delay :
ifp->idev->cnf.rtr_solicit_interval);
spin_unlock(&ifp->lock);
ipv6_addr_all_routers(&all_routers);
ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers);
} else {
spin_unlock(&ifp->lock);
/*
* Note: we do not support deprecated "all on-link"
* assumption any longer.
*/
printk(KERN_DEBUG "%s: no IPv6 routers present\n",
ifp->idev->dev->name);
}
out:
in6_ifa_put(ifp);
} | 0 |
linux | 4d06dd537f95683aba3651098ae288b7cbff8274 | NOT_APPLICABLE | NOT_APPLICABLE | int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset)
{
struct usbnet *dev = netdev_priv(skb_in->dev);
struct usb_cdc_ncm_ndp16 *ndp16;
int ret = -EINVAL;
if ((ndpoffset + sizeof(struct usb_cdc_ncm_ndp16)) > skb_in->len) {
netif_dbg(dev, rx_err, dev->net, "invalid NDP offset <%u>\n",
ndpoffset);
goto error;
}
ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb_in->data + ndpoffset);
if (le16_to_cpu(ndp16->wLength) < USB_CDC_NCM_NDP16_LENGTH_MIN) {
netif_dbg(dev, rx_err, dev->net, "invalid DPT16 length <%u>\n",
le16_to_cpu(ndp16->wLength));
goto error;
}
ret = ((le16_to_cpu(ndp16->wLength) -
sizeof(struct usb_cdc_ncm_ndp16)) /
sizeof(struct usb_cdc_ncm_dpe16));
ret--; /* we process NDP entries except for the last one */
if ((sizeof(struct usb_cdc_ncm_ndp16) +
ret * (sizeof(struct usb_cdc_ncm_dpe16))) > skb_in->len) {
netif_dbg(dev, rx_err, dev->net, "Invalid nframes = %d\n", ret);
ret = -EINVAL;
}
error:
return ret;
}
| 0 |
Android | 2c75e1c3b98e4e94f50c63e2b7694be5f948477c | CVE-2016-6720 | CWE-200 | status_t OMXNodeInstance::emptyBuffer(
OMX::buffer_id buffer,
OMX_U32 rangeOffset, OMX_U32 rangeLength,
OMX_U32 flags, OMX_TICKS timestamp, int fenceFd) {
Mutex::Autolock autoLock(mLock);
if (getGraphicBufferSource() != NULL) {
android_errorWriteLog(0x534e4554, "29422020");
return INVALID_OPERATION;
}
OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer, kPortIndexInput);
if (header == NULL) {
ALOGE("b/25884056");
return BAD_VALUE;
}
BufferMeta *buffer_meta =
static_cast<BufferMeta *>(header->pAppPrivate);
sp<ABuffer> backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */);
sp<ABuffer> codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */);
if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource
&& backup->capacity() >= sizeof(VideoNativeMetadata)
&& codec->capacity() >= sizeof(VideoGrallocMetadata)
&& ((VideoNativeMetadata *)backup->base())->eType
== kMetadataBufferTypeANWBuffer) {
VideoNativeMetadata &backupMeta = *(VideoNativeMetadata *)backup->base();
VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base();
CLOG_BUFFER(emptyBuffer, "converting ANWB %p to handle %p",
backupMeta.pBuffer, backupMeta.pBuffer->handle);
codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL;
codecMeta.eType = kMetadataBufferTypeGrallocSource;
header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0;
header->nOffset = 0;
} else {
if (rangeOffset > header->nAllocLen
|| rangeLength > header->nAllocLen - rangeOffset) {
CLOG_ERROR(emptyBuffer, OMX_ErrorBadParameter, FULL_BUFFER(NULL, header, fenceFd));
if (fenceFd >= 0) {
::close(fenceFd);
}
return BAD_VALUE;
}
header->nFilledLen = rangeLength;
header->nOffset = rangeOffset;
buffer_meta->CopyToOMX(header);
}
return emptyBuffer_l(header, flags, timestamp, (intptr_t)buffer, fenceFd);
}
| 1 |
libde265 | 697aa4f7c774abd6374596e6707a6f4f54265355 | NOT_APPLICABLE | NOT_APPLICABLE | void derive_temporal_luma_vector_prediction(base_context* ctx,
de265_image* img,
const slice_segment_header* shdr,
int xP,int yP,
int nPbW,int nPbH,
int refIdxL,
int X, // which MV (L0/L1) to get
MotionVector* out_mvLXCol,
uint8_t* out_availableFlagLXCol)
{
// --- no temporal MVP -> exit ---
if (shdr->slice_temporal_mvp_enabled_flag == 0) {
out_mvLXCol->x = 0;
out_mvLXCol->y = 0;
*out_availableFlagLXCol = 0;
return;
}
// --- find collocated reference image ---
int Log2CtbSizeY = img->get_sps().Log2CtbSizeY;
int colPic; // TODO: this is the same for the whole slice. We can precompute it.
if (shdr->slice_type == SLICE_TYPE_B &&
shdr->collocated_from_l0_flag == 0)
{
logtrace(LogMotion,"collocated L1 ref_idx=%d\n",shdr->collocated_ref_idx);
colPic = shdr->RefPicList[1][ shdr->collocated_ref_idx ];
}
else
{
logtrace(LogMotion,"collocated L0 ref_idx=%d\n",shdr->collocated_ref_idx);
colPic = shdr->RefPicList[0][ shdr->collocated_ref_idx ];
}
// check whether collocated reference picture exists
if (!ctx->has_image(colPic)) {
out_mvLXCol->x = 0;
out_mvLXCol->y = 0;
*out_availableFlagLXCol = 0;
ctx->add_warning(DE265_WARNING_NONEXISTING_REFERENCE_PICTURE_ACCESSED, false);
return;
}
// --- get collocated MV either at bottom-right corner or from center of PB ---
int xColPb,yColPb;
int yColBr = yP + nPbH; // bottom right collocated motion vector position
int xColBr = xP + nPbW;
/* If neighboring pixel at bottom-right corner is in the same CTB-row and inside the image,
use this (reduced down to 16 pixels resolution) as collocated MV position.
Note: see 2014, Sze, Sect. 5.2.1.2 why candidate C0 is excluded when on another CTB-row.
This is to reduce the memory bandwidth requirements.
*/
if ((yP>>Log2CtbSizeY) == (yColBr>>Log2CtbSizeY) &&
xColBr < img->get_sps().pic_width_in_luma_samples &&
yColBr < img->get_sps().pic_height_in_luma_samples)
{
xColPb = xColBr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid
yColPb = yColBr & ~0x0F;
derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X,
out_mvLXCol, out_availableFlagLXCol);
}
else
{
out_mvLXCol->x = 0;
out_mvLXCol->y = 0;
*out_availableFlagLXCol = 0;
}
if (*out_availableFlagLXCol==0) {
int xColCtr = xP+(nPbW>>1);
int yColCtr = yP+(nPbH>>1);
xColPb = xColCtr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid
yColPb = yColCtr & ~0x0F;
derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X,
out_mvLXCol, out_availableFlagLXCol);
}
} | 0 |
irssi-proxy | 85bbc05b21678e80423815d2ef1dfe26208491ab | NOT_APPLICABLE | NOT_APPLICABLE | static GIOStatus irssi_ssl_close(GIOChannel *handle, GError **gerr)
{
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
return chan->giochan->funcs->io_close(handle, gerr);
}
| 0 |
Android | 30cec963095366536ca0b1306089154e09bfe1a9 | NOT_APPLICABLE | NOT_APPLICABLE | void bta_av_rc_browse_closed(tBTA_AV_DATA* p_data) {
tBTA_AV_CB* p_cb = &bta_av_cb;
tBTA_AV_RC_CONN_CHG* p_msg = (tBTA_AV_RC_CONN_CHG*)p_data;
tBTA_AV_RC_BROWSE_CLOSE rc_browse_close;
LOG_INFO(LOG_TAG, "%s: peer_addr: %s rc_handle:%d", __func__,
p_msg->peer_addr.ToString().c_str(), p_msg->handle);
rc_browse_close.rc_handle = p_msg->handle;
rc_browse_close.peer_addr = p_msg->peer_addr;
tBTA_AV bta_av_data;
bta_av_data.rc_browse_close = rc_browse_close;
(*p_cb->p_cback)(BTA_AV_RC_BROWSE_CLOSE_EVT, &bta_av_data);
}
| 0 |
linux | 5d81de8e8667da7135d3a32a964087c0faf5483f | NOT_APPLICABLE | NOT_APPLICABLE | int cifs_closedir(struct inode *inode, struct file *file)
{
int rc = 0;
unsigned int xid;
struct cifsFileInfo *cfile = file->private_data;
struct cifs_tcon *tcon;
struct TCP_Server_Info *server;
char *buf;
cifs_dbg(FYI, "Closedir inode = 0x%p\n", inode);
if (cfile == NULL)
return rc;
xid = get_xid();
tcon = tlink_tcon(cfile->tlink);
server = tcon->ses->server;
cifs_dbg(FYI, "Freeing private data in close dir\n");
spin_lock(&cifs_file_list_lock);
if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) {
cfile->invalidHandle = true;
spin_unlock(&cifs_file_list_lock);
if (server->ops->close_dir)
rc = server->ops->close_dir(xid, tcon, &cfile->fid);
else
rc = -ENOSYS;
cifs_dbg(FYI, "Closing uncompleted readdir with rc %d\n", rc);
/* not much we can do if it fails anyway, ignore rc */
rc = 0;
} else
spin_unlock(&cifs_file_list_lock);
buf = cfile->srch_inf.ntwrk_buf_start;
if (buf) {
cifs_dbg(FYI, "closedir free smb buf in srch struct\n");
cfile->srch_inf.ntwrk_buf_start = NULL;
if (cfile->srch_inf.smallBuf)
cifs_small_buf_release(buf);
else
cifs_buf_release(buf);
}
cifs_put_tlink(cfile->tlink);
kfree(file->private_data);
file->private_data = NULL;
/* BB can we lock the filestruct while this is going on? */
free_xid(xid);
return rc;
}
| 0 |
linux | 2172fa709ab32ca60e86179dc67d0857be8e2c98 | NOT_APPLICABLE | NOT_APPLICABLE | int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
{
return security_sid_to_context_core(sid, scontext, scontext_len, 0);
}
| 0 |
linux-2.6 | e6b8bc09ba2075cd91fbffefcd2778b1a00bd76f | NOT_APPLICABLE | NOT_APPLICABLE | static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
struct inode *inode, struct ext4_dir_entry_2 *de,
struct buffer_head *bh)
{
struct inode *dir = dentry->d_parent->d_inode;
const char *name = dentry->d_name.name;
int namelen = dentry->d_name.len;
unsigned int offset = 0;
unsigned short reclen;
int nlen, rlen, err;
char *top;
reclen = EXT4_DIR_REC_LEN(namelen);
if (!de) {
de = (struct ext4_dir_entry_2 *)bh->b_data;
top = bh->b_data + dir->i_sb->s_blocksize - reclen;
while ((char *) de <= top) {
if (!ext4_check_dir_entry("ext4_add_entry", dir, de,
bh, offset)) {
brelse(bh);
return -EIO;
}
if (ext4_match(namelen, name, de)) {
brelse(bh);
return -EEXIST;
}
nlen = EXT4_DIR_REC_LEN(de->name_len);
rlen = ext4_rec_len_from_disk(de->rec_len);
if ((de->inode? rlen - nlen: rlen) >= reclen)
break;
de = (struct ext4_dir_entry_2 *)((char *)de + rlen);
offset += rlen;
}
if ((char *) de > top)
return -ENOSPC;
}
BUFFER_TRACE(bh, "get_write_access");
err = ext4_journal_get_write_access(handle, bh);
if (err) {
ext4_std_error(dir->i_sb, err);
brelse(bh);
return err;
}
/* By now the buffer is marked for journaling */
nlen = EXT4_DIR_REC_LEN(de->name_len);
rlen = ext4_rec_len_from_disk(de->rec_len);
if (de->inode) {
struct ext4_dir_entry_2 *de1 = (struct ext4_dir_entry_2 *)((char *)de + nlen);
de1->rec_len = ext4_rec_len_to_disk(rlen - nlen);
de->rec_len = ext4_rec_len_to_disk(nlen);
de = de1;
}
de->file_type = EXT4_FT_UNKNOWN;
if (inode) {
de->inode = cpu_to_le32(inode->i_ino);
ext4_set_de_type(dir->i_sb, de, inode->i_mode);
} else
de->inode = 0;
de->name_len = namelen;
memcpy(de->name, name, namelen);
/*
* XXX shouldn't update any times until successful
* completion of syscall, but too many callers depend
* on this.
*
* XXX similarly, too many callers depend on
* ext4_new_inode() setting the times, but error
* recovery deletes the inode, so the worst that can
* happen is that the times are slightly out of date
* and/or different from the directory change time.
*/
dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
ext4_update_dx_flag(dir);
dir->i_version++;
ext4_mark_inode_dirty(handle, dir);
BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
err = ext4_handle_dirty_metadata(handle, dir, bh);
if (err)
ext4_std_error(dir->i_sb, err);
brelse(bh);
return 0;
} | 0 |
linux | 8fff105e13041e49b82f92eef034f363a6b1c071 | NOT_APPLICABLE | NOT_APPLICABLE | static inline u32 armv8pmu_pmcr_read(void)
{
u32 val;
asm volatile("mrs %0, pmcr_el0" : "=r" (val));
return val;
}
| 0 |
php-src | cab1c3b3708eead315e033359d07049b23b147a3 | NOT_APPLICABLE | NOT_APPLICABLE | static void php_snmp_object_free_storage(void *object TSRMLS_DC)
{
php_snmp_object *intern = (php_snmp_object *)object;
if (!intern) {
return;
}
netsnmp_session_free(&(intern->session));
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
} | 0 |
libreswan | 2899351224fe2940aec37d7656e1e392c0fe07f0 | NOT_APPLICABLE | NOT_APPLICABLE | stf_status ikev2parent_outI1(int whack_sock,
struct connection *c,
struct state *predecessor,
lset_t policy,
unsigned long try,
enum crypto_importance importance
#ifdef HAVE_LABELED_IPSEC
, struct xfrm_user_sec_ctx_ike * uctx
#endif
)
{
struct state *st = new_state();
struct db_sa *sadb;
int groupnum;
int policy_index = POLICY_ISAKMP(policy,
c->spd.this.xauth_server,
c->spd.this.xauth_client);
/* set up new state */
get_cookie(TRUE, st->st_icookie, COOKIE_SIZE, &c->spd.that.host_addr);
initialize_new_state(st, c, policy, try, whack_sock, importance);
st->st_ikev2 = TRUE;
change_state(st, STATE_PARENT_I1);
st->st_msgid_lastack = INVALID_MSGID;
st->st_msgid_nextuse = 0;
st->st_try = try;
if (HAS_IPSEC_POLICY(policy)) {
#ifdef HAVE_LABELED_IPSEC
st->sec_ctx = NULL;
if ( uctx != NULL)
libreswan_log(
"Labeled ipsec is not supported with ikev2 yet");
#endif
add_pending(dup_any(
whack_sock), st, c, policy, 1,
predecessor == NULL ? SOS_NOBODY : predecessor->st_serialno
#ifdef HAVE_LABELED_IPSEC
, st->sec_ctx
#endif
);
}
if (predecessor == NULL)
libreswan_log("initiating v2 parent SA");
else
libreswan_log("initiating v2 parent SA to replace #%lu",
predecessor->st_serialno);
if (predecessor != NULL) {
update_pending(predecessor, st);
whack_log(RC_NEW_STATE + STATE_PARENT_I1,
"%s: initiate, replacing #%lu",
enum_name(&state_names, st->st_state),
predecessor->st_serialno);
} else {
whack_log(RC_NEW_STATE + STATE_PARENT_I1,
"%s: initiate",
enum_name(&state_names, st->st_state));
}
/*
* now, we need to initialize st->st_oakley, specifically, the group
* number needs to be initialized.
*/
groupnum = 0;
st->st_sadb = &oakley_sadb[policy_index];
sadb = oakley_alg_makedb(st->st_connection->alg_info_ike,
st->st_sadb, 0);
if (sadb != NULL)
st->st_sadb = sadb;
sadb = st->st_sadb = sa_v2_convert(st->st_sadb);
{
unsigned int pc_cnt;
/* look at all the proposals */
if (st->st_sadb->prop_disj != NULL) {
for (pc_cnt = 0;
pc_cnt < st->st_sadb->prop_disj_cnt && groupnum ==
0;
pc_cnt++) {
struct db_v2_prop *vp =
&st->st_sadb->prop_disj[pc_cnt];
unsigned int pr_cnt;
/* look at all the proposals */
if (vp->props != NULL) {
for (pr_cnt = 0;
pr_cnt < vp->prop_cnt &&
groupnum == 0;
pr_cnt++) {
unsigned int ts_cnt;
struct db_v2_prop_conj *vpc =
&vp->props[pr_cnt];
for (ts_cnt = 0;
ts_cnt < vpc->trans_cnt &&
groupnum == 0; ts_cnt++) {
struct db_v2_trans *tr
=
&vpc->
trans[
ts_cnt
];
if (tr != NULL &&
tr->transform_type
==
IKEv2_TRANS_TYPE_DH)
{
groupnum =
tr->
transid;
}
}
}
}
}
}
}
if (groupnum == 0)
groupnum = OAKLEY_GROUP_MODP2048;
st->st_oakley.group = lookup_group(groupnum);
st->st_oakley.groupnum = groupnum;
/* now. we need to go calculate the nonce, and the KE */
{
struct ke_continuation *ke = alloc_thing(
struct ke_continuation,
"ikev2_outI1 KE");
stf_status e;
ke->md = alloc_md();
ke->md->from_state = STATE_IKEv2_BASE;
ke->md->svm = ikev2_parent_firststate();
ke->md->st = st;
set_suspended(st, ke->md);
if (!st->st_sec_in_use) {
pcrc_init(&ke->ke_pcrc);
ke->ke_pcrc.pcrc_func = ikev2_parent_outI1_continue;
e = build_ke(&ke->ke_pcrc, st, st->st_oakley.group,
importance);
if ( (e != STF_SUSPEND &&
e != STF_INLINE) || (e == STF_TOOMUCHCRYPTO)) {
loglog(RC_CRYPTOFAILED,
"system too busy - Enabling dcookies [TODO]");
delete_state(st);
}
} else {
e =
ikev2_parent_outI1_tail(
(struct pluto_crypto_req_cont *)ke,
NULL);
}
reset_globals();
return e;
}
}
| 0 |
Chrome | bf6a6765d44b09c64b8c75d749efb84742a250e7 | NOT_APPLICABLE | NOT_APPLICABLE | FPDF_SYSTEMTIME PDFiumEngine::Form_GetLocalTime(FPDF_FORMFILLINFO* param) {
base::Time time = base::Time::Now();
base::Time::Exploded exploded;
time.LocalExplode(&exploded);
FPDF_SYSTEMTIME rv;
rv.wYear = exploded.year;
rv.wMonth = exploded.month;
rv.wDayOfWeek = exploded.day_of_week;
rv.wDay = exploded.day_of_month;
rv.wHour = exploded.hour;
rv.wMinute = exploded.minute;
rv.wSecond = exploded.second;
rv.wMilliseconds = exploded.millisecond;
return rv;
}
| 0 |
linux | 32452a3eb8b64e01e2be717f518c0be046975b9d | NOT_APPLICABLE | NOT_APPLICABLE |
static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
void *key)
{
struct io_kiocb *req = wqe_to_req(wait);
struct io_poll_iocb *poll = container_of(wait, struct io_poll_iocb,
wait);
__poll_t mask = key_to_poll(key);
if (unlikely(mask & POLLFREE)) {
io_poll_mark_cancelled(req);
/* we have to kick tw in case it's not already */
io_poll_execute(req, 0, poll->events);
/*
* If the waitqueue is being freed early but someone is already
* holds ownership over it, we have to tear down the request as
* best we can. That means immediately removing the request from
* its waitqueue and preventing all further accesses to the
* waitqueue via the request.
*/
list_del_init(&poll->wait.entry);
/*
* Careful: this *must* be the last step, since as soon
* as req->head is NULL'ed out, the request can be
* completed and freed, since aio_poll_complete_work()
* will no longer need to take the waitqueue lock.
*/
smp_store_release(&poll->head, NULL);
return 1;
}
/* for instances that support it check for an event match first */
if (mask && !(mask & poll->events))
return 0;
if (io_poll_get_ownership(req)) {
/* optional, saves extra locking for removal in tw handler */
if (mask && poll->events & EPOLLONESHOT) {
list_del_init(&poll->wait.entry);
poll->head = NULL;
if (wqe_is_double(wait))
req->flags &= ~REQ_F_DOUBLE_POLL;
else
req->flags &= ~REQ_F_SINGLE_POLL;
}
__io_poll_execute(req, mask, poll->events);
}
return 1; | 0 |
Chrome | 1228817ab04a14df53b5a8446085f9c03bf6e964 | CVE-2013-2921 | CWE-399 | void DelegatedFrameHost::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback,
const SkColorType color_type) {
bool format_support = ((color_type == kRGB_565_SkColorType) ||
(color_type == kN32_SkColorType));
DCHECK(format_support);
if (!CanCopyToBitmap()) {
callback.Run(false, SkBitmap());
return;
}
const gfx::Size& dst_size_in_pixel =
client_->ConvertViewSizeToPixel(dst_size);
scoped_ptr<cc::CopyOutputRequest> request =
cc::CopyOutputRequest::CreateRequest(base::Bind(
&DelegatedFrameHost::CopyFromCompositingSurfaceHasResult,
dst_size_in_pixel,
color_type,
callback));
gfx::Rect src_subrect_in_pixel =
ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect);
request->set_area(src_subrect_in_pixel);
client_->RequestCopyOfOutput(request.Pass());
}
| 1 |
monkey | 15f72c1ee5e0afad20232bdf0fcecab8d62a5d89 | NOT_APPLICABLE | NOT_APPLICABLE | void _mkp_exit()
{
}
| 0 |
linux-2.6 | 89f5b7da2a6bad2e84670422ab8192382a5aeb9f | NOT_APPLICABLE | NOT_APPLICABLE | static int insert_pfn(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn, pgprot_t prot)
{
struct mm_struct *mm = vma->vm_mm;
int retval;
pte_t *pte, entry;
spinlock_t *ptl;
retval = -ENOMEM;
pte = get_locked_pte(mm, addr, &ptl);
if (!pte)
goto out;
retval = -EBUSY;
if (!pte_none(*pte))
goto out_unlock;
/* Ok, finally just insert the thing.. */
entry = pte_mkspecial(pfn_pte(pfn, prot));
set_pte_at(mm, addr, pte, entry);
update_mmu_cache(vma, addr, entry); /* XXX: why not for insert_page? */
retval = 0;
out_unlock:
pte_unmap_unlock(pte, ptl);
out:
return retval;
} | 0 |
Chrome | 3290c948762c47292fb388de8318859ee22b6688 | NOT_APPLICABLE | NOT_APPLICABLE | void MenuGtk::Popup(GtkWidget* widget, gint button_type, guint32 timestamp) {
gtk_menu_popup(GTK_MENU(menu_.get()), NULL, NULL,
MenuPositionFunc,
widget,
button_type, timestamp);
}
| 0 |
tensorflow | b619c6f865715ca3b15ef1842b5b95edbaa710ad | CVE-2021-41203 | CWE-369 | void TensorSliceReader::LoadShard(int shard) const {
CHECK_LT(shard, sss_.size());
if (sss_[shard] || !status_.ok()) {
return; // Already loaded, or invalid.
}
string value;
SavedTensorSlices sts;
const string fname = fnames_[shard];
VLOG(1) << "Reading meta data from file " << fname << "...";
Table* table;
Status s = open_function_(fname, &table);
if (!s.ok()) {
status_ = errors::DataLoss("Unable to open table file ", fname, ": ",
s.ToString());
return;
}
sss_[shard].reset(table);
if (!(table->Get(kSavedTensorSlicesKey, &value) &&
ParseProtoUnlimited(&sts, value))) {
status_ = errors::Internal(
"Failed to find the saved tensor slices at the beginning of the "
"checkpoint file: ",
fname);
return;
}
status_ = CheckVersions(sts.meta().versions(), TF_CHECKPOINT_VERSION,
TF_CHECKPOINT_VERSION_MIN_PRODUCER, "Checkpoint",
"checkpoint");
if (!status_.ok()) return;
for (const SavedSliceMeta& ssm : sts.meta().tensor()) {
TensorShape ssm_shape(ssm.shape());
for (const TensorSliceProto& tsp : ssm.slice()) {
TensorSlice ss_slice(tsp);
status_ = RegisterTensorSlice(ssm.name(), ssm_shape, ssm.type(), fname,
ss_slice, &tensors_);
if (!status_.ok()) return;
}
}
} | 1 |
linux | 8914a595110a6eca69a5e275b323f5d09e18f4f9 | NOT_APPLICABLE | NOT_APPLICABLE | static void bnx2x_init_tx_ring_one(struct bnx2x_fp_txdata *txdata)
{
int i;
for (i = 1; i <= NUM_TX_RINGS; i++) {
struct eth_tx_next_bd *tx_next_bd =
&txdata->tx_desc_ring[TX_DESC_CNT * i - 1].next_bd;
tx_next_bd->addr_hi =
cpu_to_le32(U64_HI(txdata->tx_desc_mapping +
BCM_PAGE_SIZE*(i % NUM_TX_RINGS)));
tx_next_bd->addr_lo =
cpu_to_le32(U64_LO(txdata->tx_desc_mapping +
BCM_PAGE_SIZE*(i % NUM_TX_RINGS)));
}
*txdata->tx_cons_sb = cpu_to_le16(0);
SET_FLAG(txdata->tx_db.data.header.header, DOORBELL_HDR_DB_TYPE, 1);
txdata->tx_db.data.zero_fill1 = 0;
txdata->tx_db.data.prod = 0;
txdata->tx_pkt_prod = 0;
txdata->tx_pkt_cons = 0;
txdata->tx_bd_prod = 0;
txdata->tx_bd_cons = 0;
txdata->tx_pkt = 0;
} | 0 |
Chrome | 517ac71c9ee27f856f9becde8abea7d1604af9d4 | NOT_APPLICABLE | NOT_APPLICABLE | static int dbpageClose(sqlite3_vtab_cursor *pCursor){
DbpageCursor *pCsr = (DbpageCursor *)pCursor;
if( pCsr->pPage1 ) sqlite3PagerUnrefPageOne(pCsr->pPage1);
sqlite3_free(pCsr);
return SQLITE_OK;
}
| 0 |
linux-2.6 | 233548a2fd934a0220db8b1521c0bc88c82e5e53 | NOT_APPLICABLE | NOT_APPLICABLE | static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,
int id, struct uvc_entity *entity)
{
unsigned int i;
if (entity == NULL)
entity = list_entry(&dev->entities, struct uvc_entity, list);
list_for_each_entry_continue(entity, &dev->entities, list) {
switch (UVC_ENTITY_TYPE(entity)) {
case TT_STREAMING:
if (entity->output.bSourceID == id)
return entity;
break;
case VC_PROCESSING_UNIT:
if (entity->processing.bSourceID == id)
return entity;
break;
case VC_SELECTOR_UNIT:
for (i = 0; i < entity->selector.bNrInPins; ++i)
if (entity->selector.baSourceID[i] == id)
return entity;
break;
case VC_EXTENSION_UNIT:
for (i = 0; i < entity->extension.bNrInPins; ++i)
if (entity->extension.baSourceID[i] == id)
return entity;
break;
}
}
return NULL;
} | 0 |
Chrome | 3bfe67c9c4b45eb713326aae7a67c8f7390dae08 | NOT_APPLICABLE | NOT_APPLICABLE | static int checkConstraintExprNode(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_COLUMN ){
assert( pExpr->iColumn>=0 || pExpr->iColumn==-1 );
if( pExpr->iColumn>=0 ){
if( pWalker->u.aiCol[pExpr->iColumn]>=0 ){
pWalker->eCode |= CKCNSTRNT_COLUMN;
}
}else{
pWalker->eCode |= CKCNSTRNT_ROWID;
}
}
return WRC_Continue;
}
| 0 |
cyrus-imapd | 6bd33275368edfa71ae117de895488584678ac79 | NOT_APPLICABLE | NOT_APPLICABLE | EXPORTED void mboxlist_open(const char *fname)
{
int ret, flags;
char *tofree = NULL;
if (!fname)
fname = config_getstring(IMAPOPT_MBOXLIST_DB_PATH);
/* create db file name */
if (!fname) {
tofree = strconcat(config_dir, FNAME_MBOXLIST, (char *)NULL);
fname = tofree;
}
flags = CYRUSDB_CREATE;
if (config_getswitch(IMAPOPT_IMPROVED_MBOXLIST_SORT)) {
flags |= CYRUSDB_MBOXSORT;
}
ret = cyrusdb_open(DB, fname, flags, &mbdb);
if (ret != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(ret));
/* Exiting TEMPFAIL because Sendmail thinks this
EC_OSFILE == permanent failure. */
fatal("can't read mailboxes file", EC_TEMPFAIL);
}
free(tofree);
mboxlist_dbopen = 1;
}
| 0 |
gnupg | ff53cf06e966dce0daba5f2c84e03ab9db2c3c8b | NOT_APPLICABLE | NOT_APPLICABLE | elg_get_nbits( int algo, MPI *pkey )
{
if( !is_ELGAMAL(algo) )
return 0;
return mpi_get_nbits( pkey[0] );
} | 0 |
Chrome | 87c724d81f0210494211cd36814c4cb2cf4c4bd1 | NOT_APPLICABLE | NOT_APPLICABLE | void GpuDataManager::UpdateGpuBlacklist(
GpuBlacklist* gpu_blacklist, bool preliminary) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(gpu_blacklist);
scoped_ptr<GpuBlacklist> updated_list(gpu_blacklist);
uint16 updated_version_major, updated_version_minor;
if (!updated_list->GetVersion(
&updated_version_major, &updated_version_minor))
return;
uint16 current_version_major, current_version_minor;
bool succeed = gpu_blacklist_->GetVersion(
¤t_version_major, ¤t_version_minor);
DCHECK(succeed);
if (updated_version_major < current_version_major ||
(updated_version_major == current_version_major &&
updated_version_minor <= current_version_minor))
return;
gpu_blacklist_.reset(updated_list.release());
UpdateGpuFeatureFlags();
if (preliminary)
preliminary_gpu_feature_flags_ = gpu_feature_flags_;
VLOG(1) << "Using software rendering list version "
<< updated_version_major << "." << updated_version_minor;
}
| 0 |
linux | 680d04e0ba7e926233e3b9cee59125ce181f66ba | NOT_APPLICABLE | NOT_APPLICABLE | static int vmci_transport_connect(struct vsock_sock *vsk)
{
int err;
bool old_pkt_proto = false;
struct sock *sk = &vsk->sk;
if (vmci_transport_old_proto_override(&old_pkt_proto) &&
old_pkt_proto) {
err = vmci_transport_send_conn_request(
sk, vmci_trans(vsk)->queue_pair_size);
if (err < 0) {
sk->sk_state = SS_UNCONNECTED;
return err;
}
} else {
int supported_proto_versions =
vmci_transport_new_proto_supported_versions();
err = vmci_transport_send_conn_request2(
sk, vmci_trans(vsk)->queue_pair_size,
supported_proto_versions);
if (err < 0) {
sk->sk_state = SS_UNCONNECTED;
return err;
}
vsk->sent_request = true;
}
return err;
}
| 0 |
qemu | d251157ac1928191af851d199a9ff255d330bec9 | NOT_APPLICABLE | NOT_APPLICABLE | pvscsi_reset(DeviceState *dev)
{
PCIDevice *d = PCI_DEVICE(dev);
PVSCSIState *s = PVSCSI(d);
trace_pvscsi_state("reset");
pvscsi_reset_adapter(s);
}
| 0 |
bind9 | d5243a5231c0fe11cfb29e0cf1eb3d34d6ff15ea | NOT_APPLICABLE | NOT_APPLICABLE | ns_client_shuttingdown(ns_client_t *client) {
return (client->newstate == NS_CLIENTSTATE_FREED);
} | 0 |
linux | 51ebd3181572af8d5076808dab2682d800f6da5d | NOT_APPLICABLE | NOT_APPLICABLE | static int ip6_route_multipath(struct fib6_config *cfg, int add)
{
struct fib6_config r_cfg;
struct rtnexthop *rtnh;
int remaining;
int attrlen;
int err = 0, last_err = 0;
beginning:
rtnh = (struct rtnexthop *)cfg->fc_mp;
remaining = cfg->fc_mp_len;
/* Parse a Multipath Entry */
while (rtnh_ok(rtnh, remaining)) {
memcpy(&r_cfg, cfg, sizeof(*cfg));
if (rtnh->rtnh_ifindex)
r_cfg.fc_ifindex = rtnh->rtnh_ifindex;
attrlen = rtnh_attrlen(rtnh);
if (attrlen > 0) {
struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
nla = nla_find(attrs, attrlen, RTA_GATEWAY);
if (nla) {
nla_memcpy(&r_cfg.fc_gateway, nla, 16);
r_cfg.fc_flags |= RTF_GATEWAY;
}
}
err = add ? ip6_route_add(&r_cfg) : ip6_route_del(&r_cfg);
if (err) {
last_err = err;
/* If we are trying to remove a route, do not stop the
* loop when ip6_route_del() fails (because next hop is
* already gone), we should try to remove all next hops.
*/
if (add) {
/* If add fails, we should try to delete all
* next hops that have been already added.
*/
add = 0;
goto beginning;
}
}
rtnh = rtnh_next(rtnh, &remaining);
}
return last_err;
} | 0 |
libgd | 4f65a3e4eedaffa1efcf9ee1eb08f0b504fbc31a | NOT_APPLICABLE | NOT_APPLICABLE | gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor)
{
float _angle = ((float) (-degrees / 180.0f) * (float)M_PI);
const int src_w = gdImageSX(src);
const int src_h = gdImageSY(src);
const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f);
const unsigned int new_height = (unsigned int)(abs((int)(src_w * sin(_angle))) + abs((int)(src_h * cos(_angle))) + 0.5f);
const gdFixed f_0_5 = gd_ftofx(0.5f);
const gdFixed f_H = gd_itofx(src_h/2);
const gdFixed f_W = gd_itofx(src_w/2);
const gdFixed f_cos = gd_ftofx(cos(-_angle));
const gdFixed f_sin = gd_ftofx(sin(-_angle));
unsigned int dst_offset_x;
unsigned int dst_offset_y = 0;
unsigned int i;
gdImagePtr dst;
/* impact perf a bit, but not that much. Implementation for palette
images can be done at a later point.
*/
if (src->trueColor == 0) {
gdImagePaletteToTrueColor(src);
}
dst = gdImageCreateTrueColor(new_width, new_height);
if (!dst) {
return NULL;
}
dst->saveAlphaFlag = 1;
for (i = 0; i < new_height; i++) {
unsigned int j;
dst_offset_x = 0;
for (j = 0; j < new_width; j++) {
gdFixed f_i = gd_itofx((int)i - (int)new_height / 2);
gdFixed f_j = gd_itofx((int)j - (int)new_width / 2);
gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
long m = gd_fxtoi(f_m);
long n = gd_fxtoi(f_n);
if ((m > 0) && (m < src_h-1) && (n > 0) && (n < src_w-1)) {
if (dst_offset_y < new_height) {
dst->tpixels[dst_offset_y][dst_offset_x++] = src->tpixels[m][n];
}
} else {
if (dst_offset_y < new_height) {
dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor;
}
}
}
dst_offset_y++;
}
return dst;
}
| 0 |
Chrome | 6c6888565ff1fde9ef21ef17c27ad4c8304643d2 | NOT_APPLICABLE | NOT_APPLICABLE | void RunOrPostGetMostVisitedURLsCallback(
base::TaskRunner* task_runner,
bool include_forced_urls,
const TopSitesImpl::GetMostVisitedURLsCallback& callback,
const MostVisitedURLList& all_urls,
const MostVisitedURLList& nonforced_urls) {
const MostVisitedURLList& urls =
include_forced_urls ? all_urls : nonforced_urls;
if (task_runner->RunsTasksInCurrentSequence())
callback.Run(urls);
else
task_runner->PostTask(FROM_HERE, base::Bind(callback, urls));
}
| 0 |
ncurses | 790a85dbd4a81d5f5d8dd02a44d84f01512ef443 | NOT_APPLICABLE | NOT_APPLICABLE | trace_normalized_cost(NCURSES_SP_DCLx const char *capname, const char *cap, int affcnt)
{
int result = normalized_cost(NCURSES_SP_ARGx cap, affcnt);
TR(TRACE_CHARPUT | TRACE_MOVE,
("NormalizedCost %s %d %s", capname, result, _nc_visbuf(cap)));
return result;
} | 0 |
FFmpeg | 2b46ebdbff1d8dec7a3d8ea280a612b91a582869 | NOT_APPLICABLE | NOT_APPLICABLE | static int asf_read_properties(AVFormatContext *s, const GUIDParseTable *g)
{
ASFContext *asf = s->priv_data;
AVIOContext *pb = s->pb;
time_t creation_time;
avio_rl64(pb); // read object size
avio_skip(pb, 16); // skip File ID
avio_skip(pb, 8); // skip File size
creation_time = avio_rl64(pb);
if (!(asf->b_flags & ASF_FLAG_BROADCAST)) {
struct tm tmbuf;
struct tm *tm;
char buf[64];
creation_time /= 10000000;
creation_time -= 11644473600;
tm = gmtime_r(&creation_time, &tmbuf);
if (tm) {
if (!strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
buf[0] = '\0';
} else
buf[0] = '\0';
if (buf[0]) {
if (av_dict_set(&s->metadata, "creation_time", buf, 0) < 0)
av_log(s, AV_LOG_WARNING, "av_dict_set failed.\n");
}
}
asf->nb_packets = avio_rl64(pb);
asf->duration = avio_rl64(pb) / 10000; // stream duration
avio_skip(pb, 8); // skip send duration
asf->preroll = avio_rl64(pb);
asf->duration -= asf->preroll;
asf->b_flags = avio_rl32(pb);
avio_skip(pb, 4); // skip minimal packet size
asf->packet_size = avio_rl32(pb);
avio_skip(pb, 4); // skip max_bitrate
return 0;
}
| 0 |
postsrsd | 077be98d8c8a9847e4ae0c7dc09e7474cbe27db2 | NOT_APPLICABLE | NOT_APPLICABLE | static char hex2num(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return 0;
} | 0 |
FreeRDP | 445a5a42c500ceb80f8fa7f2c11f3682538033f3 | NOT_APPLICABLE | NOT_APPLICABLE | BOOL update_bounds_equals(rdpBounds* bounds1, rdpBounds* bounds2)
{
if ((bounds1->left == bounds2->left) && (bounds1->top == bounds2->top) &&
(bounds1->right == bounds2->right) && (bounds1->bottom == bounds2->bottom))
return TRUE;
return FALSE;
}
| 0 |
Chrome | 84fbaf8414b4911ef122557d1518b50f79c2eaef | NOT_APPLICABLE | NOT_APPLICABLE | void SetLastVisibleWebContents(content::WebContents* web_contents) {
g_last_visible_web_contents = web_contents;
}
| 0 |
squirrel | 23a0620658714b996d20da3d4dd1a0dcf9b0bd98 | NOT_APPLICABLE | NOT_APPLICABLE | SQClass::SQClass(SQSharedState *ss,SQClass *base)
{
_base = base;
_typetag = 0;
_hook = NULL;
_udsize = 0;
_locked = false;
_constructoridx = -1;
if(_base) {
_constructoridx = _base->_constructoridx;
_udsize = _base->_udsize;
_defaultvalues.copy(base->_defaultvalues);
_methods.copy(base->_methods);
_COPY_VECTOR(_metamethods,base->_metamethods,MT_LAST);
__ObjAddRef(_base);
}
_members = base?base->_members->Clone() : SQTable::Create(ss,0);
__ObjAddRef(_members);
INIT_CHAIN();
ADD_TO_CHAIN(&_sharedstate->_gc_chain, this);
} | 0 |
mbedtls | 33f66ba6fd234114aa37f0209dac031bb2870a9b | NOT_APPLICABLE | NOT_APPLICABLE | static void ecdsa_restart_ver_init( mbedtls_ecdsa_restart_ver_ctx *ctx )
{
mbedtls_mpi_init( &ctx->u1 );
mbedtls_mpi_init( &ctx->u2 );
ctx->state = ecdsa_ver_init;
}
| 0 |
linux | 5b6698b0e4a37053de35cc24ee695b98a7eb712b | NOT_APPLICABLE | NOT_APPLICABLE | static void batadv_frag_clear_chain(struct hlist_head *head)
{
struct batadv_frag_list_entry *entry;
struct hlist_node *node;
hlist_for_each_entry_safe(entry, node, head, list) {
hlist_del(&entry->list);
kfree_skb(entry->skb);
kfree(entry);
}
}
| 0 |
savannah | 3fcd042d26d70856e826a42b5f93dc4854d80bf0 | NOT_APPLICABLE | NOT_APPLICABLE | name_is_valid (char const *name)
{
int i;
bool is_valid = true;
for (i = 0; i < ARRAY_SIZE (invalid_names); i++)
{
if (! invalid_names[i])
break;
if (! strcmp (invalid_names[i], name))
return false;
}
is_valid = filename_is_safe (name);
/* Allow any filename if we are in the filesystem root. */
if (! is_valid && cwd_is_root (name))
is_valid = true;
if (! is_valid)
{
say ("Ignoring potentially dangerous file name %s\n", quotearg (name));
if (i < ARRAY_SIZE (invalid_names))
invalid_names[i] = name;
}
return is_valid;
}
| 0 |
Chrome | 2ccbb407dccc976ae4bdbaa5ff2f777f4eb0723b | NOT_APPLICABLE | NOT_APPLICABLE | void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands(
const NativeWebKeyboardEvent& key_event,
const ui::LatencyInfo& latency,
const std::vector<EditCommand>* commands,
bool* update_event) {
TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent");
if (owner_delegate_ &&
!owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) {
return;
}
if (ShouldDropInputEvents())
return;
if (!process_->HasConnection())
return;
if (KeyPressListenersHandleEvent(key_event)) {
if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown)
suppress_events_until_keydown_ = true;
return;
}
if (!WebInputEvent::IsKeyboardEventType(key_event.GetType()))
return;
if (suppress_events_until_keydown_) {
if (key_event.GetType() == WebKeyboardEvent::kKeyUp ||
key_event.GetType() == WebKeyboardEvent::kChar)
return;
DCHECK(key_event.GetType() == WebKeyboardEvent::kRawKeyDown ||
key_event.GetType() == WebKeyboardEvent::kKeyDown);
suppress_events_until_keydown_ = false;
}
bool is_shortcut = false;
if (delegate_ && !key_event.skip_in_browser) {
if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown)
suppress_events_until_keydown_ = true;
switch (delegate_->PreHandleKeyboardEvent(key_event)) {
case KeyboardEventProcessingResult::HANDLED:
return;
#if defined(USE_AURA)
case KeyboardEventProcessingResult::HANDLED_DONT_UPDATE_EVENT:
if (update_event)
*update_event = false;
return;
#endif
case KeyboardEventProcessingResult::NOT_HANDLED:
break;
case KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT:
is_shortcut = true;
break;
}
if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown)
suppress_events_until_keydown_ = false;
}
if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event))
return;
NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event,
latency);
key_event_with_latency.event.is_browser_shortcut = is_shortcut;
DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency);
if (commands && !commands->empty()) {
GetWidgetInputHandler()->SetEditCommandsForNextKeyEvent(*commands);
}
input_router_->SendKeyboardEvent(key_event_with_latency);
}
| 0 |
linux | 942080643bce061c3dd9d5718d3b745dcb39a8bc | NOT_APPLICABLE | NOT_APPLICABLE | void ecryptfs_write_crypt_stat_flags(char *page_virt,
struct ecryptfs_crypt_stat *crypt_stat,
size_t *written)
{
u32 flags = 0;
int i;
for (i = 0; i < ((sizeof(ecryptfs_flag_map)
/ sizeof(struct ecryptfs_flag_map_elem))); i++)
if (crypt_stat->flags & ecryptfs_flag_map[i].local_flag)
flags |= ecryptfs_flag_map[i].file_flag;
/* Version is in top 8 bits of the 32-bit flag vector */
flags |= ((((u8)crypt_stat->file_version) << 24) & 0xFF000000);
put_unaligned_be32(flags, page_virt);
(*written) = 4;
}
| 0 |
Chrome | 19b8593007150b9a78da7d13f6e5f8feb10881a7 | NOT_APPLICABLE | NOT_APPLICABLE | MetricsLog::~MetricsLog() {
}
| 0 |
libvncserver | ca2a5ac02fbbadd0a21fabba779c1ea69173d10b | NOT_APPLICABLE | NOT_APPLICABLE | HandleFileDownloadRequest(rfbClientPtr cl, rfbTightClientPtr rtcp)
{
int n = 0;
char path[PATH_MAX]; /* PATH_MAX has the value 4096 and is defined in limits.h */
rfbClientToServerTightMsg msg;
memset(path, 0, sizeof(path));
memset(&msg, 0, sizeof(rfbClientToServerTightMsg));
if(cl == NULL) {
rfbLog("File [%s]: Method [%s]: Unexpected error:: rfbClientPtr is null\n",
__FILE__, __FUNCTION__);
return;
}
if((n = rfbReadExact(cl, ((char *)&msg)+1, sz_rfbFileDownloadRequestMsg-1)) <= 0) {
if (n < 0)
rfbLog("File [%s]: Method [%s]: Error while reading dir name length\n",
__FILE__, __FUNCTION__);
rfbCloseClient(cl);
return;
}
msg.fdr.fNameSize = Swap16IfLE(msg.fdr.fNameSize);
msg.fdr.position = Swap16IfLE(msg.fdr.position);
if ((msg.fdr.fNameSize == 0) ||
(msg.fdr.fNameSize > (PATH_MAX - 1))) {
rfbLog("File [%s]: Method [%s]: Error: path length is greater than"
" PATH_MAX\n", __FILE__, __FUNCTION__);
HandleFileDownloadLengthError(cl, msg.fdr.fNameSize);
return;
}
if((n = rfbReadExact(cl, rtcp->rcft.rcfd.fName, msg.fdr.fNameSize)) <= 0) {
if (n < 0)
rfbLog("File [%s]: Method [%s]: Error while reading dir name length\n",
__FILE__, __FUNCTION__);
rfbCloseClient(cl);
return;
}
rtcp->rcft.rcfd.fName[msg.fdr.fNameSize] = '\0';
if(ConvertPath(rtcp->rcft.rcfd.fName) == NULL) {
rfbLog("File [%s]: Method [%s]: Unexpected error: path is NULL",
__FILE__, __FUNCTION__);
/* This condition can come only if the file path is greater than
PATH_MAX. So sending file path length error msg back to client.
*/
SendFileDownloadLengthErrMsg(cl);
return;
}
HandleFileDownload(cl, rtcp);
} | 0 |
Android | aeea52da00d210587fb3ed895de3d5f2e0264c88 | NOT_APPLICABLE | NOT_APPLICABLE | void Session_GetConfig(preproc_session_t *session, effect_config_t *config)
{
memset(config, 0, sizeof(effect_config_t));
config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
config->inputCfg.channels = audio_channel_in_mask_from_count(session->inChannelCount);
config->outputCfg.channels = audio_channel_in_mask_from_count(session->outChannelCount);
config->inputCfg.mask = config->outputCfg.mask =
(EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
}
| 0 |
krb5 | 50fe4074f188c2d4da0c421e96553acea8378db2 | NOT_APPLICABLE | NOT_APPLICABLE | certauth_pkinit_eku_initvt(krb5_context context, int maj_ver, int min_ver,
krb5_plugin_vtable vtable)
{
krb5_certauth_vtable vt;
if (maj_ver != 1)
return KRB5_PLUGIN_VER_NOTSUPP;
vt = (krb5_certauth_vtable)vtable;
vt->name = "pkinit_eku";
vt->authorize = pkinit_eku_authorize;
return 0;
}
| 0 |
Chrome | e4ebe078840e65d673722e94f8251b334030b5e8 | NOT_APPLICABLE | NOT_APPLICABLE | NavigationHandleImpl* NavigatorImpl::GetNavigationHandleForFrameHost(
RenderFrameHostImpl* render_frame_host) {
return render_frame_host->navigation_handle();
}
| 0 |
Subsets and Splits