project
string | commit_id
string | target
int64 | func
string | cwe
string | big_vul_idx
string | idx
int64 | hash
string | size
float64 | message
string | dataset
string |
|---|---|---|---|---|---|---|---|---|---|---|
server
|
9e39d0ae44595dbd1570805d97c9c874778a6be8
| 1
|
void ha_maria::drop_table(const char *name)
{
DBUG_ASSERT(file->s->temporary);
(void) ha_close();
(void) maria_delete_table_files(name, 1, MY_WME);
}
|
CWE-400
| null | 216,906
|
295943262298198796313787629901594498584
| 6
|
MDEV-25787 Bug report: crash on SELECT DISTINCT thousands_blob_fields
fix a debug assert to account for not opened temp tables
|
other
|
server
|
b3c3291f0b7c1623cb20663f7cf31b7f749768bc
| 1
|
bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
{
TABLE *table;
const char *key;
uint key_length;
const char *alias= table_list->alias.str;
uint flags= ot_ctx->get_flags();
MDL_ticket *mdl_ticket;
TABLE_SHARE *share;
uint gts_flags;
bool from_share= false;
#ifdef WITH_PARTITION_STORAGE_ENGINE
int part_names_error=0;
#endif
DBUG_ENTER("open_table");
/*
The table must not be opened already. The table can be pre-opened for
some statements if it is a temporary table.
open_temporary_table() must be used to open temporary tables.
*/
DBUG_ASSERT(!table_list->table);
/* an open table operation needs a lot of the stack space */
if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias))
DBUG_RETURN(TRUE);
if (!(flags & MYSQL_OPEN_IGNORE_KILLED) && thd->killed)
{
thd->send_kill_message();
DBUG_RETURN(TRUE);
}
/*
Check if we're trying to take a write lock in a read only transaction.
Note that we allow write locks on log tables as otherwise logging
to general/slow log would be disabled in read only transactions.
*/
if (table_list->mdl_request.is_write_lock_request() &&
thd->tx_read_only &&
!(flags & (MYSQL_LOCK_LOG_TABLE | MYSQL_OPEN_HAS_MDL_LOCK)))
{
my_error(ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, MYF(0));
DBUG_RETURN(true);
}
if (!table_list->db.str)
{
my_error(ER_NO_DB_ERROR, MYF(0));
DBUG_RETURN(true);
}
key_length= get_table_def_key(table_list, &key);
/*
If we're in pre-locked or LOCK TABLES mode, let's try to find the
requested table in the list of pre-opened and locked tables. If the
table is not there, return an error - we can't open not pre-opened
tables in pre-locked/LOCK TABLES mode.
TODO: move this block into a separate function.
*/
if (thd->locked_tables_mode &&
! (flags & MYSQL_OPEN_GET_NEW_TABLE))
{ // Using table locks
TABLE *best_table= 0;
int best_distance= INT_MIN;
for (table=thd->open_tables; table ; table=table->next)
{
if (table->s->table_cache_key.length == key_length &&
!memcmp(table->s->table_cache_key.str, key, key_length))
{
if (!my_strcasecmp(system_charset_info, table->alias.c_ptr(), alias) &&
table->query_id != thd->query_id && /* skip tables already used */
(thd->locked_tables_mode == LTM_LOCK_TABLES ||
table->query_id == 0))
{
int distance= ((int) table->reginfo.lock_type -
(int) table_list->lock_type);
/*
Find a table that either has the exact lock type requested,
or has the best suitable lock. In case there is no locked
table that has an equal or higher lock than requested,
we us the closest matching lock to be able to produce an error
message about wrong lock mode on the table. The best_table
is changed if bd < 0 <= d or bd < d < 0 or 0 <= d < bd.
distance < 0 - No suitable lock found
distance > 0 - we have lock mode higher then we require
distance == 0 - we have lock mode exactly which we need
*/
if ((best_distance < 0 && distance > best_distance) ||
(distance >= 0 && distance < best_distance))
{
best_distance= distance;
best_table= table;
if (best_distance == 0)
{
/*
We have found a perfect match and can finish iterating
through open tables list. Check for table use conflict
between calling statement and SP/trigger is done in
lock_tables().
*/
break;
}
}
}
}
}
if (best_table)
{
table= best_table;
table->query_id= thd->query_id;
table->init(thd, table_list);
DBUG_PRINT("info",("Using locked table"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
#endif
goto reset;
}
if (is_locked_view(thd, table_list))
{
if (table_list->sequence)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
DBUG_RETURN(true);
}
DBUG_RETURN(FALSE); // VIEW
}
/*
No table in the locked tables list. In case of explicit LOCK TABLES
this can happen if a user did not include the table into the list.
In case of pre-locked mode locked tables list is generated automatically,
so we may only end up here if the table did not exist when
locked tables list was created.
*/
if (thd->locked_tables_mode == LTM_PRELOCKED)
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db.str, table_list->alias.str);
else
my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias);
DBUG_RETURN(TRUE);
}
/*
Non pre-locked/LOCK TABLES mode, and the table is not temporary.
This is the normal use case.
*/
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
{
/*
We are not under LOCK TABLES and going to acquire write-lock/
modify the base table. We need to acquire protection against
global read lock until end of this statement in order to have
this statement blocked by active FLUSH TABLES WITH READ LOCK.
We don't need to acquire this protection under LOCK TABLES as
such protection already acquired at LOCK TABLES time and
not released until UNLOCK TABLES.
We don't block statements which modify only temporary tables
as these tables are not preserved by any form of
backup which uses FLUSH TABLES WITH READ LOCK.
TODO: The fact that we sometimes acquire protection against
GRL only when we encounter table to be write-locked
slightly increases probability of deadlock.
This problem will be solved once Alik pushes his
temporary table refactoring patch and we can start
pre-acquiring metadata locks at the beggining of
open_tables() call.
*/
if (table_list->mdl_request.is_write_lock_request() &&
! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
MYSQL_OPEN_FORCE_SHARED_MDL |
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) &&
! ot_ctx->has_protection_against_grl())
{
MDL_request protection_request;
MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
if (thd->global_read_lock.can_acquire_protection())
DBUG_RETURN(TRUE);
protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
MDL_STATEMENT);
/*
Install error handler which if possible will convert deadlock error
into request to back-off and restart process of opening tables.
*/
thd->push_internal_handler(&mdl_deadlock_handler);
bool result= thd->mdl_context.acquire_lock(&protection_request,
ot_ctx->get_timeout());
thd->pop_internal_handler();
if (result)
DBUG_RETURN(TRUE);
ot_ctx->set_has_protection_against_grl();
}
if (open_table_get_mdl_lock(thd, ot_ctx, &table_list->mdl_request,
flags, &mdl_ticket) ||
mdl_ticket == NULL)
{
DEBUG_SYNC(thd, "before_open_table_wait_refresh");
DBUG_RETURN(TRUE);
}
DEBUG_SYNC(thd, "after_open_table_mdl_shared");
}
else
{
/*
Grab reference to the MDL lock ticket that was acquired
by the caller.
*/
mdl_ticket= table_list->mdl_request.ticket;
}
if (table_list->open_strategy == TABLE_LIST::OPEN_IF_EXISTS)
{
if (!ha_table_exists(thd, &table_list->db, &table_list->table_name))
DBUG_RETURN(FALSE);
}
else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB)
DBUG_RETURN(FALSE);
/* Table exists. Let us try to open it. */
if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
gts_flags= GTS_TABLE;
else if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
gts_flags= GTS_VIEW;
else
gts_flags= GTS_TABLE | GTS_VIEW;
retry_share:
share= tdc_acquire_share(thd, table_list, gts_flags, &table);
if (unlikely(!share))
{
/*
Hide "Table doesn't exist" errors if the table belongs to a view.
The check for thd->is_error() is necessary to not push an
unwanted error in case the error was already silenced.
@todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (thd->is_error())
{
if (table_list->parent_l)
{
thd->clear_error();
my_error(ER_WRONG_MRG_TABLE, MYF(0));
}
else if (table_list->belong_to_view)
{
TABLE_LIST *view= table_list->belong_to_view;
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0),
view->view_db.str, view->view_name.str);
}
}
DBUG_RETURN(TRUE);
}
/*
Check if this TABLE_SHARE-object corresponds to a view. Note, that there is
no need to check TABLE_SHARE::tdc.flushed as we do for regular tables,
because view shares are always up to date.
*/
if (share->is_view)
{
/*
If parent_l of the table_list is non null then a merge table
has this view as child table, which is not supported.
*/
if (table_list->parent_l)
{
my_error(ER_WRONG_MRG_TABLE, MYF(0));
goto err_lock;
}
if (table_list->sequence)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str,
table_list->alias.str);
goto err_lock;
}
/*
This table is a view. Validate its metadata version: in particular,
that it was a view when the statement was prepared.
*/
if (check_and_update_table_version(thd, table_list, share))
goto err_lock;
/* Open view */
if (mysql_make_view(thd, share, table_list, false))
goto err_lock;
/* TODO: Don't free this */
tdc_release_share(share);
DBUG_ASSERT(table_list->view);
DBUG_RETURN(FALSE);
}
#ifdef WITH_WSREP
if (!((flags & MYSQL_OPEN_IGNORE_FLUSH) ||
(thd->wsrep_applier)))
#else
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
#endif
{
if (share->tdc->flushed)
{
DBUG_PRINT("info", ("Found old share version: %lld current: %lld",
share->tdc->version, tdc_refresh_version()));
/*
We already have an MDL lock. But we have encountered an old
version of table in the table definition cache which is possible
when someone changes the table version directly in the cache
without acquiring a metadata lock (e.g. this can happen during
"rolling" FLUSH TABLE(S)).
Release our reference to share, wait until old version of
share goes away and then try to get new version of table share.
*/
if (table)
tc_release_table(table);
else
tdc_release_share(share);
MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
bool wait_result;
thd->push_internal_handler(&mdl_deadlock_handler);
wait_result= tdc_wait_for_old_version(thd, table_list->db.str,
table_list->table_name.str,
ot_ctx->get_timeout(),
mdl_ticket->get_deadlock_weight());
thd->pop_internal_handler();
if (wait_result)
DBUG_RETURN(TRUE);
goto retry_share;
}
if (thd->open_tables && thd->open_tables->s->tdc->flushed)
{
/*
If the version changes while we're opening the tables,
we have to back off, close all the tables opened-so-far,
and try to reopen them. Note: refresh_version is currently
changed only during FLUSH TABLES.
*/
if (table)
tc_release_table(table);
else
tdc_release_share(share);
(void)ot_ctx->request_backoff_action(Open_table_context::OT_REOPEN_TABLES,
NULL);
DBUG_RETURN(TRUE);
}
}
if (table)
{
DBUG_ASSERT(table->file != NULL);
MYSQL_REBIND_TABLE(table->file);
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
#endif
}
else
{
enum open_frm_error error;
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
goto err_lock;
error= open_table_from_share(thd, share, &table_list->alias,
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
thd->open_options, table, FALSE,
IF_PARTITIONING(table_list->partition_names,0));
if (unlikely(error))
{
my_free(table);
if (error == OPEN_FRM_DISCOVER)
(void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
table_list);
else if (share->crashed)
{
if (!(flags & MYSQL_OPEN_IGNORE_REPAIR))
(void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR,
table_list);
else
table_list->crashed= 1; /* Mark that table was crashed */
}
goto err_lock;
}
if (open_table_entry_fini(thd, share, table))
{
closefrm(table);
my_free(table);
goto err_lock;
}
/* Add table to the share's used tables list. */
tc_add_table(thd, table);
from_share= true;
}
table->mdl_ticket= mdl_ticket;
table->reginfo.lock_type=TL_READ; /* Assume read */
table->init(thd, table_list);
table->next= thd->open_tables; /* Link into simple list */
thd->set_open_tables(table);
reset:
/*
Check that there is no reference to a condition from an earlier query
(cf. Bug#58553).
*/
DBUG_ASSERT(table->file->pushed_cond == NULL);
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
table_list->table= table;
if (!from_share && table->vcol_fix_expr(thd))
goto err_lock;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (unlikely(table->part_info))
{
/* Partitions specified were incorrect.*/
if (part_names_error)
{
table->file->print_error(part_names_error, MYF(0));
DBUG_RETURN(true);
}
}
else if (table_list->partition_names)
{
/* Don't allow PARTITION () clause on a nonpartitioned table */
my_error(ER_PARTITION_CLAUSE_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(true);
}
#endif
if (table_list->sequence && table->s->table_type != TABLE_TYPE_SEQUENCE)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
DBUG_RETURN(true);
}
DBUG_RETURN(FALSE);
err_lock:
tdc_release_share(share);
DBUG_PRINT("exit", ("failed"));
DBUG_RETURN(TRUE);
}
|
CWE-416
| null | 216,938
|
182517812383076277954919868268872014094
| 476
|
MDEV-24176 fixup: GCC -Wmaybe-uninitialized
|
other
|
server
|
5ba77222e9fe7af8ff403816b5338b18b342053c
| 1
|
Field *create_tmp_field_from_field(THD *thd, Field *org_field,
const char *name, TABLE *table,
Item_field *item)
{
Field *new_field;
new_field= org_field->make_new_field(thd->mem_root, table,
table == org_field->table);
if (new_field)
{
new_field->init(table);
new_field->orig_table= org_field->orig_table;
if (item)
item->result_field= new_field;
else
new_field->field_name= name;
new_field->flags|= (org_field->flags & NO_DEFAULT_VALUE_FLAG);
if (org_field->maybe_null() || (item && item->maybe_null))
new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join
if (org_field->type() == MYSQL_TYPE_VAR_STRING ||
org_field->type() == MYSQL_TYPE_VARCHAR)
table->s->db_create_options|= HA_OPTION_PACK_RECORD;
else if (org_field->type() == FIELD_TYPE_DOUBLE)
((Field_double *) new_field)->not_fixed= TRUE;
new_field->vcol_info= 0;
new_field->cond_selectivity= 1.0;
new_field->next_equal_field= NULL;
new_field->option_list= NULL;
new_field->option_struct= NULL;
}
return new_field;
}
|
CWE-89
| null | 216,949
|
164261972443783551951315550437760179257
| 32
|
MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
if the view has algorithm=temptable it is not updatable,
so DEFAULT() for its fields is meaningless,
and thus it's NULL or 0/'' for NOT NULL columns.
|
other
|
server
|
ecb6f9c894d3ebafeff1c6eb3b65cd248062296f
| 1
|
multi_update::initialize_tables(JOIN *join)
{
TABLE_LIST *table_ref;
DBUG_ENTER("initialize_tables");
if (unlikely((thd->variables.option_bits & OPTION_SAFE_UPDATES) &&
error_if_full_join(join)))
DBUG_RETURN(1);
main_table=join->join_tab->table;
table_to_update= 0;
/* Any update has at least one pair (field, value) */
DBUG_ASSERT(fields->elements);
/*
Only one table may be modified by UPDATE of an updatable view.
For an updatable view first_table_for_update indicates this
table.
For a regular multi-update it refers to some updated table.
*/
TABLE *first_table_for_update= ((Item_field *) fields->head())->field->table;
/* Create a temporary table for keys to all tables, except main table */
for (table_ref= update_tables; table_ref; table_ref= table_ref->next_local)
{
TABLE *table=table_ref->table;
uint cnt= table_ref->shared;
List<Item> temp_fields;
ORDER group;
TMP_TABLE_PARAM *tmp_param;
if (ignore)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
if (table == main_table) // First table in join
{
if (safe_update_on_fly(thd, join->join_tab, table_ref, all_tables))
{
table_to_update= table; // Update table on the fly
has_vers_fields= table->vers_check_update(*fields);
continue;
}
}
table->prepare_for_position();
join->map2table[table->tablenr]->keep_current_rowid= true;
/*
enable uncacheable flag if we update a view with check option
and check option has a subselect, otherwise, the check option
can be evaluated after the subselect was freed as independent
(See full_local in JOIN::join_free()).
*/
if (table_ref->check_option && !join->select_lex->uncacheable)
{
SELECT_LEX_UNIT *tmp_unit;
SELECT_LEX *sl;
for (tmp_unit= join->select_lex->first_inner_unit();
tmp_unit;
tmp_unit= tmp_unit->next_unit())
{
for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
{
if (sl->master_unit()->item)
{
join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
goto loop_end;
}
}
}
}
loop_end:
if (table == first_table_for_update && table_ref->check_option)
{
table_map unupdated_tables= table_ref->check_option->used_tables() &
~first_table_for_update->map;
List_iterator<TABLE_LIST> ti(*leaves);
TABLE_LIST *tbl_ref;
while ((tbl_ref= ti++) && unupdated_tables)
{
if (unupdated_tables & tbl_ref->table->map)
unupdated_tables&= ~tbl_ref->table->map;
else
continue;
if (unupdated_check_opt_tables.push_back(tbl_ref->table))
DBUG_RETURN(1);
}
}
tmp_param= tmp_table_param+cnt;
/*
Create a temporary table to store all fields that are changed for this
table. The first field in the temporary table is a pointer to the
original row so that we can find and update it. For the updatable
VIEW a few following fields are rowids of tables used in the CHECK
OPTION condition.
*/
List_iterator_fast<TABLE> tbl_it(unupdated_check_opt_tables);
TABLE *tbl= table;
do
{
LEX_CSTRING field_name;
field_name.str= tbl->alias.c_ptr();
field_name.length= strlen(field_name.str);
/*
Signal each table (including tables referenced by WITH CHECK OPTION
clause) for which we will store row position in the temporary table
that we need a position to be read first.
*/
tbl->prepare_for_position();
join->map2table[tbl->tablenr]->keep_current_rowid= true;
Item_temptable_rowid *item=
new (thd->mem_root) Item_temptable_rowid(tbl);
if (!item)
DBUG_RETURN(1);
item->fix_fields(thd, 0);
if (temp_fields.push_back(item, thd->mem_root))
DBUG_RETURN(1);
} while ((tbl= tbl_it++));
temp_fields.append(fields_for_table[cnt]);
/* Make an unique key over the first field to avoid duplicated updates */
bzero((char*) &group, sizeof(group));
group.direction= ORDER::ORDER_ASC;
group.item= (Item**) temp_fields.head_ref();
tmp_param->quick_group= 1;
tmp_param->field_count= temp_fields.elements;
tmp_param->func_count= temp_fields.elements - 1;
calc_group_buffer(tmp_param, &group);
/* small table, ignore SQL_BIG_TABLES */
my_bool save_big_tables= thd->variables.big_tables;
thd->variables.big_tables= FALSE;
tmp_tables[cnt]=create_tmp_table(thd, tmp_param, temp_fields,
(ORDER*) &group, 0, 0,
TMP_TABLE_ALL_COLUMNS, HA_POS_ERROR, &empty_clex_str);
thd->variables.big_tables= save_big_tables;
if (!tmp_tables[cnt])
DBUG_RETURN(1);
tmp_tables[cnt]->file->extra(HA_EXTRA_WRITE_CACHE);
}
join->tmp_table_keep_current_rowid= TRUE;
DBUG_RETURN(0);
}
|
CWE-617
| null | 216,965
|
322966484405015890266186752836981150795
| 146
|
MDEV-28095 crash in multi-update and implicit grouping
disallow implicit grouping in multi-update.
explicit GROUP BY is not allowed by the grammar.
|
other
|
monit
|
328f60773057641c4b2075fab9820145e95b728c
| 1
|
static void do_viewlog(HttpRequest req, HttpResponse res) {
if (is_readonly(req)) {
send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page");
return;
}
do_head(res, "_viewlog", "View log", 100);
if ((Run.flags & Run_Log) && ! (Run.flags & Run_UseSyslog)) {
FILE *f = fopen(Run.files.log, "r");
if (f) {
size_t n;
char buf[512];
StringBuffer_append(res->outputbuffer, "<br><p><form><textarea cols=120 rows=30 readonly>");
while ((n = fread(buf, sizeof(char), sizeof(buf) - 1, f)) > 0) {
buf[n] = 0;
StringBuffer_append(res->outputbuffer, "%s", buf);
}
fclose(f);
StringBuffer_append(res->outputbuffer, "</textarea></form>");
} else {
StringBuffer_append(res->outputbuffer, "Error opening logfile: %s", STRERROR);
}
} else {
StringBuffer_append(res->outputbuffer,
"<b>Cannot view logfile:</b><br>");
if (! (Run.flags & Run_Log))
StringBuffer_append(res->outputbuffer, "Monit was started without logging");
else
StringBuffer_append(res->outputbuffer, "Monit uses syslog");
}
do_foot(res);
}
|
CWE-79
| null | 217,176
|
44007244262753941920243993940600065355
| null | null |
other
|
gpac
|
ad18ece95fa064efc0995c4ab2c985f77fb166ec
| 0
|
GF_Err gf_isom_rtp_packet_begin(GF_ISOFile *the_file, u32 trackNumber,
s32 relativeTime,
u8 PackingBit,
u8 eXtensionBit,
u8 MarkerBit,
u8 PayloadType,
u8 B_frame,
u8 IsRepeatedPacket,
u16 SequenceNumber)
{
GF_TrackBox *trak;
GF_HintSampleEntryBox *entry;
GF_RTPPacket *pck;
u32 dataRefIndex;
GF_Err e;
trak = gf_isom_get_track_from_file(the_file, trackNumber);
if (!trak || !CheckHintFormat(trak, GF_ISOM_HINT_RTP)) return GF_BAD_PARAM;
e = Media_GetSampleDesc(trak->Media, trak->Media->information->sampleTable->currentEntryIndex, (GF_SampleEntryBox **) &entry, &dataRefIndex);
if (e) return e;
if (!entry->hint_sample) return GF_BAD_PARAM;
pck = (GF_RTPPacket *) gf_isom_hint_pck_new(entry->type);
pck->P_bit = PackingBit ? 1 : 0;
pck->X_bit = eXtensionBit ? 1 : 0;
pck->M_bit = MarkerBit ? 1 : 0;
pck->payloadType = PayloadType;
pck->SequenceNumber = SequenceNumber;
pck->B_bit = B_frame ? 1 : 0;
pck->R_bit = IsRepeatedPacket ? 1 : 0;
pck->relativeTransTime = relativeTime;
return gf_list_add(entry->hint_sample->packetTable, pck);
}
| null | null | 219,901
|
135210532758408519809735309262837501503
| 35
|
fixed #1904
|
other
|
glewlwyd
|
125281f1c0d4b6a8b49f7e55a757205a2ef01fbe
| 0
|
int callback_glewlwyd_delete_scope (const struct _u_request * request, struct _u_response * response, void * user_data) {
struct config_elements * config = (struct config_elements *)user_data;
json_t * j_search_scope;
j_search_scope = get_scope(config, u_map_get(request->map_url, "scope"));
if (check_result_value(j_search_scope, G_OK)) {
if (delete_scope(config, u_map_get(request->map_url, "scope")) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_delete_scope - Error delete_scope");
response->status = 500;
} else {
y_log_message(Y_LOG_LEVEL_INFO, "Event - Scope '%s' removed", u_map_get(request->map_url, "scope"));
}
} else if (check_result_value(j_search_scope, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_delete_scope - Error get_scope");
response->status = 500;
}
json_decref(j_search_scope);
return U_CALLBACK_CONTINUE;
}
| null | null | 219,991
|
21879157829563128577889659573080658049
| 21
|
Fix update session when auth fail
|
other
|
pcre2
|
d4fa336fbcc388f89095b184ba6d99422cfc676c
| 0
|
static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_common *common, struct backtrack_common *current)
{
DEFINE_COMPILER;
PCRE2_SPTR cc = current->cc;
BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
PCRE2_UCHAR type;
type = cc[ref ? 1 + IMM2_SIZE : 1 + 2 * IMM2_SIZE];
if ((type & 0x1) == 0)
{
/* Maximize case. */
set_jumps(current->topbacktracks, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(ref_iterator_backtrack)->matchingpath);
return;
}
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(ref_iterator_backtrack)->matchingpath);
set_jumps(current->topbacktracks, LABEL());
free_stack(common, ref ? 2 : 3);
}
| null | null | 223,373
|
288436804787057463427568100308425798209
| 24
|
Fix incorrect value reading in JIT.
|
other
|
pcre2
|
d4fa336fbcc388f89095b184ba6d99422cfc676c
| 0
|
static BOOL check_opcode_types(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend)
{
int count;
PCRE2_SPTR slot;
PCRE2_SPTR assert_back_end = cc - 1;
PCRE2_SPTR assert_na_end = cc - 1;
/* Calculate important variables (like stack size) and checks whether all opcodes are supported. */
while (cc < ccend)
{
switch(*cc)
{
case OP_SET_SOM:
common->has_set_som = TRUE;
common->might_be_empty = TRUE;
cc += 1;
break;
case OP_REFI:
#ifdef SUPPORT_UNICODE
if (common->iref_ptr == 0)
{
common->iref_ptr = common->ovector_start;
common->ovector_start += 3 * sizeof(sljit_sw);
}
#endif /* SUPPORT_UNICODE */
/* Fall through. */
case OP_REF:
common->optimized_cbracket[GET2(cc, 1)] = 0;
cc += 1 + IMM2_SIZE;
break;
case OP_ASSERT_NA:
case OP_ASSERTBACK_NA:
slot = bracketend(cc);
if (slot > assert_na_end)
assert_na_end = slot;
cc += 1 + LINK_SIZE;
break;
case OP_CBRAPOS:
case OP_SCBRAPOS:
common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0;
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
case OP_COND:
case OP_SCOND:
/* Only AUTO_CALLOUT can insert this opcode. We do
not intend to support this case. */
if (cc[1 + LINK_SIZE] == OP_CALLOUT || cc[1 + LINK_SIZE] == OP_CALLOUT_STR)
return FALSE;
cc += 1 + LINK_SIZE;
break;
case OP_CREF:
common->optimized_cbracket[GET2(cc, 1)] = 0;
cc += 1 + IMM2_SIZE;
break;
case OP_DNREF:
case OP_DNREFI:
case OP_DNCREF:
count = GET2(cc, 1 + IMM2_SIZE);
slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
while (count-- > 0)
{
common->optimized_cbracket[GET2(slot, 0)] = 0;
slot += common->name_entry_size;
}
cc += 1 + 2 * IMM2_SIZE;
break;
case OP_RECURSE:
/* Set its value only once. */
if (common->recursive_head_ptr == 0)
{
common->recursive_head_ptr = common->ovector_start;
common->ovector_start += sizeof(sljit_sw);
}
cc += 1 + LINK_SIZE;
break;
case OP_CALLOUT:
case OP_CALLOUT_STR:
if (common->capture_last_ptr == 0)
{
common->capture_last_ptr = common->ovector_start;
common->ovector_start += sizeof(sljit_sw);
}
cc += (*cc == OP_CALLOUT) ? PRIV(OP_lengths)[OP_CALLOUT] : GET(cc, 1 + 2*LINK_SIZE);
break;
case OP_ASSERTBACK:
slot = bracketend(cc);
if (slot > assert_back_end)
assert_back_end = slot;
cc += 1 + LINK_SIZE;
break;
case OP_THEN_ARG:
common->has_then = TRUE;
common->control_head_ptr = 1;
/* Fall through. */
case OP_COMMIT_ARG:
case OP_PRUNE_ARG:
if (cc < assert_na_end)
return FALSE;
/* Fall through */
case OP_MARK:
if (common->mark_ptr == 0)
{
common->mark_ptr = common->ovector_start;
common->ovector_start += sizeof(sljit_sw);
}
cc += 1 + 2 + cc[1];
break;
case OP_THEN:
common->has_then = TRUE;
common->control_head_ptr = 1;
cc += 1;
break;
case OP_SKIP:
if (cc < assert_back_end)
common->has_skip_in_assert_back = TRUE;
if (cc < assert_na_end)
return FALSE;
cc += 1;
break;
case OP_SKIP_ARG:
common->control_head_ptr = 1;
common->has_skip_arg = TRUE;
if (cc < assert_back_end)
common->has_skip_in_assert_back = TRUE;
if (cc < assert_na_end)
return FALSE;
cc += 1 + 2 + cc[1];
break;
case OP_PRUNE:
case OP_COMMIT:
case OP_ASSERT_ACCEPT:
if (cc < assert_na_end)
return FALSE;
cc++;
break;
default:
cc = next_opcode(common, cc);
if (cc == NULL)
return FALSE;
break;
}
}
return TRUE;
}
| null | null | 223,433
|
104144699881640659915549001222013190335
| 160
|
Fix incorrect value reading in JIT.
|
other
|
tensorflow
|
08d7b00c0a5a20926363849f611729f53f3ec022
| 0
|
Status Pool3DShape(shape_inference::InferenceContext* c) {
ShapeHandle input_shape;
TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 5, &input_shape));
string data_format;
Status s = c->GetAttr("data_format", &data_format);
std::vector<int32> strides;
TF_RETURN_IF_ERROR(c->GetAttr("strides", &strides));
if (strides.size() != 5) {
return errors::InvalidArgument(
"Pool3D ops require the stride attribute to contain 5 values, but "
"got: ",
strides.size());
}
std::vector<int32> kernel_sizes;
TF_RETURN_IF_ERROR(c->GetAttr("ksize", &kernel_sizes));
if (kernel_sizes.size() != 5) {
return errors::InvalidArgument(
"Pool3D requires the ksize attribute to contain 5 values, but got: ",
kernel_sizes.size());
}
int32_t stride_planes, stride_rows, stride_cols;
int32_t kernel_planes, kernel_rows, kernel_cols;
if (s.ok() && data_format == "NCDHW") {
// Convert input_shape to NDHWC.
auto dim = [&](char dimension) {
return c->Dim(input_shape, GetTensorDimIndex<3>(FORMAT_NCHW, dimension));
};
input_shape =
c->MakeShape({{dim('N'), dim('0'), dim('1'), dim('2'), dim('C')}});
stride_planes = strides[2];
stride_rows = strides[3];
stride_cols = strides[4];
kernel_planes = kernel_sizes[2];
kernel_rows = kernel_sizes[3];
kernel_cols = kernel_sizes[4];
} else {
stride_planes = strides[1];
stride_rows = strides[2];
stride_cols = strides[3];
kernel_planes = kernel_sizes[1];
kernel_rows = kernel_sizes[2];
kernel_cols = kernel_sizes[3];
}
DimensionHandle batch_size_dim = c->Dim(input_shape, 0);
DimensionHandle in_planes_dim = c->Dim(input_shape, 1);
DimensionHandle in_rows_dim = c->Dim(input_shape, 2);
DimensionHandle in_cols_dim = c->Dim(input_shape, 3);
DimensionHandle output_depth_dim = c->Dim(input_shape, 4);
Padding padding;
TF_RETURN_IF_ERROR(c->GetAttr("padding", &padding));
// TODO(mrry,shlens): Raise an error if the stride would cause
// information in the input to be ignored. This will require a change
// in the kernel implementation.
DimensionHandle output_planes, output_rows, output_cols;
TF_RETURN_IF_ERROR(GetWindowedOutputSizeFromDims(
c, in_planes_dim, kernel_planes, stride_planes, padding, &output_planes));
TF_RETURN_IF_ERROR(GetWindowedOutputSizeFromDims(
c, in_rows_dim, kernel_rows, stride_rows, padding, &output_rows));
TF_RETURN_IF_ERROR(GetWindowedOutputSizeFromDims(
c, in_cols_dim, kernel_cols, stride_cols, padding, &output_cols));
ShapeHandle output_shape;
if (data_format == "NCDHW") {
output_shape = c->MakeShape({batch_size_dim, output_depth_dim,
output_planes, output_rows, output_cols});
} else {
output_shape = c->MakeShape({batch_size_dim, output_planes, output_rows,
output_cols, output_depth_dim});
}
c->set_output(0, output_shape);
return Status::OK();
}
| null | null | 224,560
|
304736669889278191184353852888637820897
| 81
|
Fix Segfault in Concat V2 shape function.
PiperOrigin-RevId: 412120654
Change-Id: I3ff915faea694f9ad8b00024e9af2de9909011be
|
other
|
tensorflow
|
08d7b00c0a5a20926363849f611729f53f3ec022
| 0
|
Status MaxPoolShape(shape_inference::InferenceContext* c) {
return MaxPoolShapeImpl(c, /*supports_explicit_padding=*/false);
}
| null | null | 224,592
|
30835260043464724133923419352917564078
| 3
|
Fix Segfault in Concat V2 shape function.
PiperOrigin-RevId: 412120654
Change-Id: I3ff915faea694f9ad8b00024e9af2de9909011be
|
other
|
v4l2loopback
|
e4cd225557486c420f6a34411f98c575effd43dd
| 0
|
static int v4l2loopback_lookup_cb(int id, void *ptr, void *data)
{
struct v4l2_loopback_device *device = ptr;
struct v4l2loopback_lookup_cb_data *cbdata = data;
if (cbdata && device && device->vdev) {
if (device->vdev->num == cbdata->device_nr) {
cbdata->device = device;
cbdata->device_nr = id;
return 1;
}
}
return 0;
}
| null | null | 225,397
|
36502877497827830444652809109457004050
| 13
|
add explicit format specifier to printf() invocations
CWE-134
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
void mfra_box_del(GF_Box *s)
{
GF_MovieFragmentRandomAccessBox *ptr = (GF_MovieFragmentRandomAccessBox *)s;
if (ptr == NULL) return;
gf_list_del(ptr->tfra_list);
gf_free(ptr);
}
| null | null | 225,645
|
166982083698724780356123058557769692020
| 7
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Box *chnl_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_ChannelLayoutBox, GF_ISOM_BOX_TYPE_CHNL);
return (GF_Box *)tmp;
| null | null | 225,676
|
186095885763030695620676670739985269725
| 5
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Err moof_box_size(GF_Box *s)
{
u32 pos=0;
GF_MovieFragmentBox *ptr = (GF_MovieFragmentBox *) s;
if (!s) return GF_BAD_PARAM;
//Header First
gf_isom_check_position(s, (GF_Box *)ptr->mfhd, &pos);
//then PSSH
gf_isom_check_position_list(s, ptr->PSSHs, &pos);
//then the track list
gf_isom_check_position_list(s, ptr->TrackList, &pos);
return GF_OK;
}
| null | null | 225,775
|
170536732827198318297117963545294843728
| 13
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Err fdsa_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem)
{
GF_HintSample *ptr = (GF_HintSample *)s;
switch(a->type) {
case GF_ISOM_BOX_TYPE_FDPA:
BOX_FIELD_LIST_ASSIGN(packetTable)
return GF_OK;
case GF_ISOM_BOX_TYPE_EXTR:
BOX_FIELD_ASSIGN(extra_data, GF_ExtraDataBox)
break;
}
return GF_OK;
| null | null | 225,915
|
16231677898973218848028614039180259892
| 13
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Err dmlp_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TrueHDConfigBox *ptr = (GF_TrueHDConfigBox *)s;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->format_info);
gf_bs_write_int(bs, ptr->peak_data_rate, 15);
gf_bs_write_int(bs, 0, 1);
gf_bs_write_u32(bs, 0);
return GF_OK;
| null | null | 225,955
|
308675745644893964270987579311863228889
| 13
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Err trep_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_TrackExtensionPropertiesBox *ptr = (GF_TrackExtensionPropertiesBox *)s;
ISOM_DECREASE_SIZE(ptr, 4);
ptr->trackID = gf_bs_read_u32(bs);
return gf_isom_box_array_read(s, bs);
| null | null | 225,964
|
258224393003018232474259052067579314663
| 9
|
fixed #2092
|
other
|
gpac
|
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
| 0
|
GF_Err uuid_box_read(GF_Box *s, GF_BitStream *bs)
{
u32 bytesToRead;
GF_UnknownUUIDBox *ptr = (GF_UnknownUUIDBox *)s;
if (ptr->size > 0xFFFFFFFF) return GF_ISOM_INVALID_FILE;
bytesToRead = (u32) (ptr->size);
if (bytesToRead) {
ptr->data = (char*)gf_malloc(bytesToRead);
if (ptr->data == NULL ) return GF_OUT_OF_MEM;
ptr->dataSize = bytesToRead;
gf_bs_read_data(bs, ptr->data, ptr->dataSize);
}
return GF_OK;
}
| null | null | 226,254
|
207621800233513202130834349487536635483
| 15
|
fixed #2092
|
other
|
tensorflow
|
a5b89cd68c02329d793356bda85d079e9e69b4e7
| 0
|
Status VerifyWrappableInCallOp(const OpDef& opdef, EagerOperation* op) {
absl::flat_hash_set<string> opdef_attrs;
for (const auto& attr : opdef.attr()) {
opdef_attrs.insert(attr.name());
}
const auto& node_def = op->MutableAttrs()->BuildNodeDef();
for (const auto& attr : node_def.attr()) {
if (opdef_attrs.find(attr.first) == opdef_attrs.end()) {
return errors::Unimplemented("EagerOperation: ", op->Name(),
" has a private attr '", attr.first, "'.");
}
}
return Status::OK();
}
| null | null | 229,323
|
266764428931017137644739313304821897063
| 14
|
Fix empty resource handle vulnerability.
Some ops that attempt to extract a resource handle from user input
can lead to nullptr dereferences. This returns an error in such
a case.
PiperOrigin-RevId: 445571938
|
other
|
gpac
|
37592ad86c6ca934d34740012213e467acc4a3b0
| 0
|
GF_EXPORT
u32 gf_isom_get_supported_box_type(u32 idx)
{
return box_registry[idx].box_4cc;
| null | null | 232,326
|
51306403104286674450982607568575956051
| 4
|
fixed #2163
|
other
|
pjproject
|
9fae8f43accef8ea65d4a8ae9cdf297c46cfe29a
| 0
|
static pj_status_t get_name_len(int rec_counter, const pj_uint8_t *pkt,
const pj_uint8_t *start, const pj_uint8_t *max,
int *parsed_len, int *name_len)
{
const pj_uint8_t *p;
pj_status_t status;
/* Limit the number of recursion */
if (rec_counter > 10) {
/* Too many name recursion */
return PJLIB_UTIL_EDNSINNAMEPTR;
}
*name_len = *parsed_len = 0;
p = start;
while (*p) {
if ((*p & 0xc0) == 0xc0) {
/* Compression is found! */
int ptr_len = 0;
int dummy;
pj_uint16_t offset;
/* Get the 14bit offset */
pj_memcpy(&offset, p, 2);
offset ^= pj_htons((pj_uint16_t)(0xc0 << 8));
offset = pj_ntohs(offset);
/* Check that offset is valid */
if (offset >= max - pkt)
return PJLIB_UTIL_EDNSINNAMEPTR;
/* Get the name length from that offset. */
status = get_name_len(rec_counter+1, pkt, pkt + offset, max,
&dummy, &ptr_len);
if (status != PJ_SUCCESS)
return status;
*parsed_len += 2;
*name_len += ptr_len;
return PJ_SUCCESS;
} else {
unsigned label_len = *p;
/* Check that label length is valid.
* Each label consists of an octet length (of size 1) followed
* by the octet of the specified length (label_len). Then it
* must be followed by either another label's octet length or
* a zero length octet (that terminates the sequence).
*/
if (p+1+label_len+1 > max)
return PJLIB_UTIL_EDNSINNAMEPTR;
p += (label_len + 1);
*parsed_len += (label_len + 1);
if (*p != 0)
++label_len;
*name_len += label_len;
}
}
++p;
(*parsed_len)++;
return PJ_SUCCESS;
}
| null | null | 235,641
|
304724818714881251816694868849317017205
| 67
|
Merge pull request from GHSA-p6g5-v97c-w5q4
* Prevent heap buffer overflow when parsing DNS packets
* Make sure packet parsing doesn't advance beyond max/end
* Update checks
* Remove check
Co-authored-by: sauwming <[email protected]>
|
other
|
lsquic
|
a74702c630e108125e71898398737baec8f02238
| 0
|
lsquic_qeh_settings (struct qpack_enc_hdl *qeh, unsigned max_table_size,
unsigned dyn_table_size, unsigned max_risked_streams, int server)
{
enum lsqpack_enc_opts enc_opts;
assert(qeh->qeh_flags & QEH_INITIALIZED);
if (qeh->qeh_flags & QEH_HAVE_SETTINGS)
{
LSQ_WARN("settings already set");
return -1;
}
enc_opts = LSQPACK_ENC_OPT_STAGE_2
| (server ? LSQPACK_ENC_OPT_SERVER : 0);
qeh->qeh_tsu_sz = sizeof(qeh->qeh_tsu_buf);
if (QENC_MIN_DYN_TABLE_SIZE > dyn_table_size)
dyn_table_size = 0;
if (0 != lsqpack_enc_init(&qeh->qeh_encoder, (void *) qeh->qeh_conn,
max_table_size, dyn_table_size, max_risked_streams, enc_opts,
qeh->qeh_tsu_buf, &qeh->qeh_tsu_sz))
{
LSQ_INFO("could not initialize QPACK encoder");
return -1;
}
LSQ_DEBUG("%zu-byte post-init TSU", qeh->qeh_tsu_sz);
qeh->qeh_flags |= QEH_HAVE_SETTINGS;
qeh->qeh_max_prefix_size =
lsqpack_enc_header_block_prefix_size(&qeh->qeh_encoder);
LSQ_DEBUG("have settings: max table size=%u; dyn table size=%u; max risked "
"streams=%u", max_table_size, dyn_table_size, max_risked_streams);
if (qeh->qeh_enc_sm_out)
qeh_begin_out(qeh);
return 0;
}
| null | null | 237,885
|
325482743200506242883264217964767124086
| 35
|
Release 3.1.0
|
other
|
linux
|
64620e0a1e712a778095bd35cbb277dc2259281f
| 0
|
static struct bpf_verifier_state *push_stack(struct bpf_verifier_env *env,
int insn_idx, int prev_insn_idx,
bool speculative)
{
struct bpf_verifier_state *cur = env->cur_state;
struct bpf_verifier_stack_elem *elem;
int err;
elem = kzalloc(sizeof(struct bpf_verifier_stack_elem), GFP_KERNEL);
if (!elem)
goto err;
elem->insn_idx = insn_idx;
elem->prev_insn_idx = prev_insn_idx;
elem->next = env->head;
elem->log_pos = env->log.len_used;
env->head = elem;
env->stack_size++;
err = copy_verifier_state(&elem->st, cur);
if (err)
goto err;
elem->st.speculative |= speculative;
if (env->stack_size > BPF_COMPLEXITY_LIMIT_JMP_SEQ) {
verbose(env, "The sequence of %d jumps is too complex.\n",
env->stack_size);
goto err;
}
if (elem->st.parent) {
++elem->st.parent->branches;
/* WARN_ON(branches > 2) technically makes sense here,
* but
* 1. speculative states will bump 'branches' for non-branch
* instructions
* 2. is_state_visited() heuristics may decide not to create
* a new state for a sequence of branches and all such current
* and cloned states will be pointing to a single parent state
* which might have large 'branches' count.
*/
}
return &elem->st;
err:
free_verifier_state(env->cur_state, true);
env->cur_state = NULL;
/* pop all elements and return */
while (!pop_stack(env, NULL, NULL, false));
return NULL;
}
| null | null | 238,457
|
173869822630090312186700757827861033657
| 47
|
bpf: Fix out of bounds access for ringbuf helpers
Both bpf_ringbuf_submit() and bpf_ringbuf_discard() have ARG_PTR_TO_ALLOC_MEM
in their bpf_func_proto definition as their first argument. They both expect
the result from a prior bpf_ringbuf_reserve() call which has a return type of
RET_PTR_TO_ALLOC_MEM_OR_NULL.
Meaning, after a NULL check in the code, the verifier will promote the register
type in the non-NULL branch to a PTR_TO_MEM and in the NULL branch to a known
zero scalar. Generally, pointer arithmetic on PTR_TO_MEM is allowed, so the
latter could have an offset.
The ARG_PTR_TO_ALLOC_MEM expects a PTR_TO_MEM register type. However, the non-
zero result from bpf_ringbuf_reserve() must be fed into either bpf_ringbuf_submit()
or bpf_ringbuf_discard() but with the original offset given it will then read
out the struct bpf_ringbuf_hdr mapping.
The verifier missed to enforce a zero offset, so that out of bounds access
can be triggered which could be used to escalate privileges if unprivileged
BPF was enabled (disabled by default in kernel).
Fixes: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it")
Reported-by: <[email protected]> (SecCoder Security Lab)
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: John Fastabend <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
|
other
|
linux
|
64620e0a1e712a778095bd35cbb277dc2259281f
| 0
|
struct btf *bpf_get_btf_vmlinux(void)
{
if (!btf_vmlinux && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) {
mutex_lock(&bpf_verifier_lock);
if (!btf_vmlinux)
btf_vmlinux = btf_parse_vmlinux();
mutex_unlock(&bpf_verifier_lock);
}
return btf_vmlinux;
}
| null | null | 238,482
|
234269330592057921775920421239627309464
| 10
|
bpf: Fix out of bounds access for ringbuf helpers
Both bpf_ringbuf_submit() and bpf_ringbuf_discard() have ARG_PTR_TO_ALLOC_MEM
in their bpf_func_proto definition as their first argument. They both expect
the result from a prior bpf_ringbuf_reserve() call which has a return type of
RET_PTR_TO_ALLOC_MEM_OR_NULL.
Meaning, after a NULL check in the code, the verifier will promote the register
type in the non-NULL branch to a PTR_TO_MEM and in the NULL branch to a known
zero scalar. Generally, pointer arithmetic on PTR_TO_MEM is allowed, so the
latter could have an offset.
The ARG_PTR_TO_ALLOC_MEM expects a PTR_TO_MEM register type. However, the non-
zero result from bpf_ringbuf_reserve() must be fed into either bpf_ringbuf_submit()
or bpf_ringbuf_discard() but with the original offset given it will then read
out the struct bpf_ringbuf_hdr mapping.
The verifier missed to enforce a zero offset, so that out of bounds access
can be triggered which could be used to escalate privileges if unprivileged
BPF was enabled (disabled by default in kernel).
Fixes: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it")
Reported-by: <[email protected]> (SecCoder Security Lab)
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: John Fastabend <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
|
other
|
vim
|
44db8213d38c39877d2148eff6a72f4beccfb94e
| 0
|
free_yank(long n)
{
if (y_current->y_array != NULL)
{
long i;
for (i = n; --i >= 0; )
vim_free(y_current->y_array[i]);
VIM_CLEAR(y_current->y_array);
}
}
| null | null | 240,265
|
78294369507246526050725916519240901596
| 11
|
patch 8.2.4219: reading before the start of the line
Problem: Reading before the start of the line.
Solution: Check boundary before trying to read the character.
|
other
|
gpac
|
77510778516803b7f7402d7423c6d6bef50254c3
| 0
|
GF_Box *tfdt_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TFBaseMediaDecodeTimeBox, GF_ISOM_BOX_TYPE_TFDT);
return (GF_Box *)tmp;
}
| null | null | 244,352
|
327319138272772957392040715484687607045
| 5
|
fixed #2255
|
other
|
gpac
|
b43f9d1a4b4e33d08edaef6d313e6ce4bdf554d3
| 0
|
static s32 naludmx_parse_nal_avc(GF_NALUDmxCtx *ctx, char *data, u32 size, u32 nal_type, Bool *skip_nal, Bool *is_slice, Bool *is_islice)
{
s32 ps_idx = 0;
s32 res = 0;
if (!size) return -1;
gf_bs_reassign_buffer(ctx->bs_r, data, size);
*skip_nal = GF_FALSE;
res = gf_avc_parse_nalu(ctx->bs_r, ctx->avc_state);
if (res < 0) {
if (res == -1) {
GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[%s] Warning: Error parsing NAL unit\n", ctx->log_name));
}
*skip_nal = GF_TRUE;
}
ctx->nb_nalus++;
switch (nal_type) {
case GF_AVC_NALU_SVC_SUBSEQ_PARAM:
case GF_AVC_NALU_SEQ_PARAM:
ps_idx = ctx->avc_state->last_ps_idx;
if (ps_idx<0) {
if (ctx->avc_state->sps[0].profile_idc) {
GF_LOG(ctx->avc_state->sps[0].profile_idc ? GF_LOG_WARNING : GF_LOG_ERROR, GF_LOG_MEDIA, ("[%s] Error parsing Sequence Param Set\n", ctx->log_name));
}
} else {
naludmx_queue_param_set(ctx, data, size, GF_AVC_NALU_SEQ_PARAM, ps_idx);
}
*skip_nal = GF_TRUE;
return 0;
case GF_AVC_NALU_PIC_PARAM:
ps_idx = ctx->avc_state->last_ps_idx;
if (ps_idx<0) {
GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[%s] Error parsing Picture Param Set\n", ctx->log_name));
} else {
naludmx_queue_param_set(ctx, data, size, GF_AVC_NALU_PIC_PARAM, ps_idx);
}
*skip_nal = GF_TRUE;
return 0;
case GF_AVC_NALU_SEQ_PARAM_EXT:
ps_idx = ctx->avc_state->last_ps_idx;
if (ps_idx<0) {
GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[%s] Error parsing Sequence Param Set Extension\n", ctx->log_name));
} else {
naludmx_queue_param_set(ctx, data, size, GF_AVC_NALU_SEQ_PARAM_EXT, ps_idx);
}
*skip_nal = GF_TRUE;
return 0;
case GF_AVC_NALU_SEI:
if (ctx->avc_state->sps_active_idx != -1) {
naludmx_push_prefix(ctx, data, size, GF_TRUE);
*skip_nal = GF_TRUE;
if (ctx->nosei) {
ctx->sei_buffer_size = 0;
} else {
ctx->nb_sei++;
}
}
return 0;
case GF_AVC_NALU_ACCESS_UNIT:
ctx->nb_aud++;
if (!ctx->audelim) {
*skip_nal = GF_TRUE;
} else if (!ctx->opid) {
ctx->has_initial_aud = GF_TRUE;
memcpy(ctx->init_aud, data, 2);
}
return 1;
/*remove*/
case GF_AVC_NALU_FILLER_DATA:
case GF_AVC_NALU_END_OF_SEQ:
case GF_AVC_NALU_END_OF_STREAM:
*skip_nal = GF_TRUE;
return 0;
//update stats
case GF_AVC_NALU_NON_IDR_SLICE:
case GF_AVC_NALU_DP_A_SLICE:
case GF_AVC_NALU_DP_B_SLICE:
case GF_AVC_NALU_DP_C_SLICE:
case GF_AVC_NALU_IDR_SLICE:
*is_slice = GF_TRUE;
switch (ctx->avc_state->s_info.slice_type) {
case GF_AVC_TYPE_P:
case GF_AVC_TYPE2_P:
ctx->nb_p++;
break;
case GF_AVC_TYPE_I:
case GF_AVC_TYPE2_I:
ctx->nb_i++;
*is_islice = GF_TRUE;
break;
case GF_AVC_TYPE_B:
case GF_AVC_TYPE2_B:
ctx->nb_b++;
break;
case GF_AVC_TYPE_SP:
case GF_AVC_TYPE2_SP:
ctx->nb_sp++;
break;
case GF_AVC_TYPE_SI:
case GF_AVC_TYPE2_SI:
ctx->nb_si++;
break;
}
break;
case GF_AVC_NALU_SVC_SLICE:
if (!ctx->explicit) {
u32 i;
for (i = 0; i < gf_list_count(ctx->pps); i ++) {
GF_NALUFFParam *slc = (GF_NALUFFParam*)gf_list_get(ctx->pps, i);
if (ctx->avc_state->s_info.pps && ctx->avc_state->s_info.pps->id == slc->id) {
/* This PPS is used by an SVC NAL unit, it should be moved to the SVC Config Record) */
gf_list_rem(ctx->pps, i);
i--;
if (!ctx->pps_svc) ctx->pps_svc = gf_list_new(ctx->pps_svc);
gf_list_add(ctx->pps_svc, slc);
ctx->ps_modified = GF_TRUE;
}
}
}
*is_slice = GF_TRUE;
//we disable temporal scalability when parsing mvc - never used and many encoders screw up POC in enhancemen
if (ctx->is_mvc && (res>=0)) {
res=0;
ctx->avc_state->s_info.poc = ctx->last_poc;
}
if (ctx->avc_state->s_info.sps) {
switch (ctx->avc_state->s_info.slice_type) {
case GF_AVC_TYPE_P:
case GF_AVC_TYPE2_P:
ctx->avc_state->s_info.sps->nb_ep++;
break;
case GF_AVC_TYPE_I:
case GF_AVC_TYPE2_I:
ctx->avc_state->s_info.sps->nb_ei++;
break;
case GF_AVC_TYPE_B:
case GF_AVC_TYPE2_B:
ctx->avc_state->s_info.sps->nb_eb++;
break;
}
}
break;
case GF_AVC_NALU_SLICE_AUX:
*is_slice = GF_TRUE;
break;
case GF_AVC_NALU_DV_RPU:
if (ctx->dv_mode==DVMODE_CLEAN) {
*skip_nal = GF_TRUE;
} else {
ctx->nb_dv_rpu ++;
if (ctx->nb_dv_rpu==1)
naludmx_set_dolby_vision(ctx);
}
break;
case GF_AVC_NALU_DV_EL:
if ((ctx->dv_mode==DVMODE_CLEAN) || (ctx->dv_mode==DVMODE_SINGLE)) {
*skip_nal = GF_TRUE;
} else {
ctx->nb_dv_el ++;
if (ctx->nb_dv_el==1)
naludmx_set_dolby_vision(ctx);
}
break;
}
return res;
}
| null | null | 246,661
|
285879938566855088663728116790540514120
| 176
|
fixed #2223
|
other
|
envoy
|
e9f936d85dc1edc34fabd0a1725ec180f2316353
| 0
|
TestUtilOptions(const std::string& client_ctx_yaml, const std::string& server_ctx_yaml,
bool expect_success, Network::Address::IpVersion version)
: TestUtilOptionsBase(expect_success, version), client_ctx_yaml_(client_ctx_yaml),
server_ctx_yaml_(server_ctx_yaml), expect_no_cert_(false), expect_no_cert_chain_(false),
expect_private_key_method_(false),
expected_server_close_event_(Network::ConnectionEvent::RemoteClose) {
if (expect_success) {
setExpectedServerStats("ssl.handshake");
} else {
setExpectedServerStats("ssl.fail_verify_error");
}
}
| null | null | 247,628
|
234130020991233082719629057316482677014
| 12
|
CVE-2022-21654
tls allows re-use when some cert validation settings have changed
Signed-off-by: Yan Avlasov <[email protected]>
|
other
|
libconfuse
|
d73777c2c3566fb2647727bb56d9a2295b81669b
| 0
|
DLLIMPORT signed long cfg_getnint(cfg_t *cfg, const char *name, unsigned int index)
{
return cfg_opt_getnint(cfg_getopt(cfg, name), index);
}
| null | null | 248,280
|
308027921853121269984384081000598713054
| 4
|
Fix #163: unterminated username used with getpwnam()
Signed-off-by: Joachim Wiberg <[email protected]>
|
other
|
gpac
|
dae9900580a8888969481cd72035408091edb11b
| 0
|
static GF_Err WriteInterleaved(MovieWriter *mw, GF_BitStream *bs, Bool drift_inter)
{
GF_Err e;
u32 i;
s32 moov_meta_pos=-1;
GF_Box *a, *cprt_box=NULL;
u64 firstSize, finalSize, offset, finalOffset;
GF_List *writers = gf_list_new();
GF_ISOFile *movie = mw->movie;
//first setup the writers
e = SetupWriters(mw, writers, 1);
if (e) goto exit;
if (movie->is_jp2) {
gf_bs_write_u32(bs, 12);
gf_bs_write_u32(bs, GF_ISOM_BOX_TYPE_JP);
gf_bs_write_u32(bs, 0x0D0A870A);
}
if (movie->brand) {
e = gf_isom_box_size((GF_Box *)movie->brand);
if (e) goto exit;
e = gf_isom_box_write((GF_Box *)movie->brand, bs);
if (e) goto exit;
}
if (movie->pdin) {
e = gf_isom_box_size((GF_Box *)movie->pdin);
if (e) goto exit;
e = gf_isom_box_write((GF_Box *)movie->pdin, bs);
if (e) goto exit;
}
//write all boxes before moov
i=0;
while ((a = (GF_Box*)gf_list_enum(movie->TopBoxes, &i))) {
switch (a->type) {
case GF_ISOM_BOX_TYPE_MOOV:
case GF_ISOM_BOX_TYPE_META:
moov_meta_pos = i-1;
break;
case GF_ISOM_BOX_TYPE_FTYP:
case GF_ISOM_BOX_TYPE_PDIN:
case GF_ISOM_BOX_TYPE_MDAT:
break;
case GF_ISOM_BOX_TYPE_FREE:
//for backward compat with old arch, keep copyright before moov
if (((GF_FreeSpaceBox*)a)->dataSize>4) {
GF_FreeSpaceBox *fr = (GF_FreeSpaceBox*) a;
if ((fr->dataSize>20) && !strncmp(fr->data, "IsoMedia File", 13)) {
cprt_box = a;
break;
}
}
default:
if (moov_meta_pos<0) {
e = gf_isom_box_size(a);
if (e) goto exit;
e = gf_isom_box_write(a, bs);
if (e) goto exit;
}
break;
}
}
e = DoInterleave(mw, writers, bs, 1, gf_bs_get_position(bs), drift_inter);
if (e) goto exit;
firstSize = GetMoovAndMetaSize(movie, writers);
offset = firstSize;
if (movie->mdat && movie->mdat->dataSize) offset += 8 + (movie->mdat->dataSize > 0xFFFFFFFF ? 8 : 0);
e = ShiftOffset(movie, writers, offset);
if (e) goto exit;
//get the size and see if it has changed (eg, we moved to 64 bit offsets)
finalSize = GetMoovAndMetaSize(movie, writers);
if (firstSize != finalSize) {
finalOffset = finalSize;
if (movie->mdat && movie->mdat->dataSize) finalOffset += 8 + (movie->mdat->dataSize > 0xFFFFFFFF ? 8 : 0);
//OK, now we're sure about the final size -> shift the offsets
//we don't need to re-emulate, as the only thing that changed is the offset
//so just shift the offset
e = ShiftOffset(movie, writers, finalOffset - offset);
if (e) goto exit;
/*firstSize = */GetMoovAndMetaSize(movie, writers);
}
//get real sample offsets for meta items
if (movie->meta) {
store_meta_item_sample_ref_offsets(movie, writers, movie->meta);
}
//now write our stuff
e = WriteMoovAndMeta(movie, writers, bs);
if (e) goto exit;
/*we have 8 extra bytes for large size (not computed in gf_isom_box_size) */
if (movie->mdat && movie->mdat->dataSize) {
if (movie->mdat->dataSize > 0xFFFFFFFF) movie->mdat->dataSize += 8;
e = gf_isom_box_size((GF_Box *)movie->mdat);
if (e) goto exit;
e = gf_isom_box_write((GF_Box *)movie->mdat, bs);
if (e) goto exit;
}
//we don't need the offset as we are writing...
ResetWriters(writers);
e = DoInterleave(mw, writers, bs, 0, 0, drift_inter);
if (e) goto exit;
//then the rest
i=0;
while ((a = (GF_Box*)gf_list_enum(movie->TopBoxes, &i))) {
if ((i-1 < (u32) moov_meta_pos) && (a != cprt_box))
continue;
switch (a->type) {
case GF_ISOM_BOX_TYPE_MOOV:
case GF_ISOM_BOX_TYPE_META:
case GF_ISOM_BOX_TYPE_FTYP:
case GF_ISOM_BOX_TYPE_PDIN:
case GF_ISOM_BOX_TYPE_MDAT:
break;
default:
e = gf_isom_box_size(a);
if (e) goto exit;
e = gf_isom_box_write(a, bs);
if (e) goto exit;
}
}
exit:
CleanWriters(writers);
gf_list_del(writers);
return e;
}
| null | null | 249,983
|
307394486074364590508342463208104042512
| 132
|
fixed #1659
|
other
|
tinyexr
|
a685e3332f61cd4e59324bf3f669d36973d64270
| 0
|
static void bitmapFromData(const unsigned short data[/*nData*/], int nData,
unsigned char bitmap[BITMAP_SIZE],
unsigned short &minNonZero,
unsigned short &maxNonZero) {
for (int i = 0; i < BITMAP_SIZE; ++i) bitmap[i] = 0;
for (int i = 0; i < nData; ++i) bitmap[data[i] >> 3] |= (1 << (data[i] & 7));
bitmap[0] &= ~1; // zero is not explicitly stored in
// the bitmap; we assume that the
// data always contain zeroes
minNonZero = BITMAP_SIZE - 1;
maxNonZero = 0;
for (int i = 0; i < BITMAP_SIZE; ++i) {
if (bitmap[i]) {
if (minNonZero > i) minNonZero = i;
if (maxNonZero < i) maxNonZero = i;
}
}
}
| null | null | 252,293
|
66767018618529288295644787485579012879
| 21
|
Make line_no with too large value(2**20) invalid. Fixes #124
|
other
|
tinyexr
|
a685e3332f61cd4e59324bf3f669d36973d64270
| 0
|
mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index,
mz_zip_archive_file_stat *pStat) {
mz_uint n;
const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
if ((!p) || (!pStat)) return MZ_FALSE;
// Unpack the central directory record.
pStat->m_file_index = file_index;
pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(
&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index);
pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS);
pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS);
pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS);
pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS);
#ifndef MINIZ_NO_TIME
pStat->m_time =
mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS),
MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS));
#endif
pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS);
pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS);
pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS);
pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS);
// Copy as much of the filename and comment as possible.
n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1);
memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n);
pStat->m_filename[n] = '\0';
n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS);
n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1);
pStat->m_comment_size = n;
memcpy(pStat->m_comment,
p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE +
MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) +
MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS),
n);
pStat->m_comment[n] = '\0';
return MZ_TRUE;
}
| null | null | 252,384
|
172031456147728808119195234287572319435
| 44
|
Make line_no with too large value(2**20) invalid. Fixes #124
|
other
|
linux
|
d6f5e358452479fa8a773b5c6ccc9e4ec5a20880
| 0
|
crypt_message(struct TCP_Server_Info *server, int num_rqst,
struct smb_rqst *rqst, int enc)
{
struct smb2_transform_hdr *tr_hdr =
(struct smb2_transform_hdr *)rqst[0].rq_iov[0].iov_base;
unsigned int assoc_data_len = sizeof(struct smb2_transform_hdr) - 20;
int rc = 0;
struct scatterlist *sg;
u8 sign[SMB2_SIGNATURE_SIZE] = {};
u8 key[SMB3_ENC_DEC_KEY_SIZE];
struct aead_request *req;
char *iv;
unsigned int iv_len;
DECLARE_CRYPTO_WAIT(wait);
struct crypto_aead *tfm;
unsigned int crypt_len = le32_to_cpu(tr_hdr->OriginalMessageSize);
rc = smb2_get_enc_key(server, le64_to_cpu(tr_hdr->SessionId), enc, key);
if (rc) {
cifs_server_dbg(VFS, "%s: Could not get %scryption key\n", __func__,
enc ? "en" : "de");
return rc;
}
rc = smb3_crypto_aead_allocate(server);
if (rc) {
cifs_server_dbg(VFS, "%s: crypto alloc failed\n", __func__);
return rc;
}
tfm = enc ? server->secmech.ccmaesencrypt :
server->secmech.ccmaesdecrypt;
if ((server->cipher_type == SMB2_ENCRYPTION_AES256_CCM) ||
(server->cipher_type == SMB2_ENCRYPTION_AES256_GCM))
rc = crypto_aead_setkey(tfm, key, SMB3_GCM256_CRYPTKEY_SIZE);
else
rc = crypto_aead_setkey(tfm, key, SMB3_GCM128_CRYPTKEY_SIZE);
if (rc) {
cifs_server_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc);
return rc;
}
rc = crypto_aead_setauthsize(tfm, SMB2_SIGNATURE_SIZE);
if (rc) {
cifs_server_dbg(VFS, "%s: Failed to set authsize %d\n", __func__, rc);
return rc;
}
req = aead_request_alloc(tfm, GFP_KERNEL);
if (!req) {
cifs_server_dbg(VFS, "%s: Failed to alloc aead request\n", __func__);
return -ENOMEM;
}
if (!enc) {
memcpy(sign, &tr_hdr->Signature, SMB2_SIGNATURE_SIZE);
crypt_len += SMB2_SIGNATURE_SIZE;
}
sg = init_sg(num_rqst, rqst, sign);
if (!sg) {
cifs_server_dbg(VFS, "%s: Failed to init sg\n", __func__);
rc = -ENOMEM;
goto free_req;
}
iv_len = crypto_aead_ivsize(tfm);
iv = kzalloc(iv_len, GFP_KERNEL);
if (!iv) {
cifs_server_dbg(VFS, "%s: Failed to alloc iv\n", __func__);
rc = -ENOMEM;
goto free_sg;
}
if ((server->cipher_type == SMB2_ENCRYPTION_AES128_GCM) ||
(server->cipher_type == SMB2_ENCRYPTION_AES256_GCM))
memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES_GCM_NONCE);
else {
iv[0] = 3;
memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES_CCM_NONCE);
}
aead_request_set_crypt(req, sg, sg, crypt_len, iv);
aead_request_set_ad(req, assoc_data_len);
aead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
crypto_req_done, &wait);
rc = crypto_wait_req(enc ? crypto_aead_encrypt(req)
: crypto_aead_decrypt(req), &wait);
if (!rc && enc)
memcpy(&tr_hdr->Signature, sign, SMB2_SIGNATURE_SIZE);
kfree(iv);
free_sg:
kfree(sg);
free_req:
kfree(req);
return rc;
}
| null | null | 253,580
|
186046911004554397138179611634707323797
| 103
|
cifs: fix NULL ptr dereference in smb2_ioctl_query_info()
When calling smb2_ioctl_query_info() with invalid
smb_query_info::flags, a NULL ptr dereference is triggered when trying
to kfree() uninitialised rqst[n].rq_iov array.
This also fixes leaked paths that are created in SMB2_open_init()
which required SMB2_open_free() to properly free them.
Here is a small C reproducer that triggers it
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define die(s) perror(s), exit(1)
#define QUERY_INFO 0xc018cf07
int main(int argc, char *argv[])
{
int fd;
if (argc < 2)
exit(1);
fd = open(argv[1], O_RDONLY);
if (fd == -1)
die("open");
if (ioctl(fd, QUERY_INFO, (uint32_t[]) { 0, 0, 0, 4, 0, 0}) == -1)
die("ioctl");
close(fd);
return 0;
}
mount.cifs //srv/share /mnt -o ...
gcc repro.c && ./a.out /mnt/f0
[ 1832.124468] CIFS: VFS: \\w22-dc.zelda.test\test Invalid passthru query flags: 0x4
[ 1832.125043] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
[ 1832.125764] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
[ 1832.126241] CPU: 3 PID: 1133 Comm: a.out Not tainted 5.17.0-rc8 #2
[ 1832.126630] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
[ 1832.127322] RIP: 0010:smb2_ioctl_query_info+0x7a3/0xe30 [cifs]
[ 1832.127749] Code: 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 6c 05 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 74 24 28 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 cb 04 00 00 49 8b 3e e8 bb fc fa ff 48 89 da 48
[ 1832.128911] RSP: 0018:ffffc90000957b08 EFLAGS: 00010256
[ 1832.129243] RAX: dffffc0000000000 RBX: ffff888117e9b850 RCX: ffffffffa020580d
[ 1832.129691] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffffa043a2c0
[ 1832.130137] RBP: ffff888117e9b878 R08: 0000000000000001 R09: 0000000000000003
[ 1832.130585] R10: fffffbfff4087458 R11: 0000000000000001 R12: ffff888117e9b800
[ 1832.131037] R13: 00000000ffffffea R14: 0000000000000000 R15: ffff888117e9b8a8
[ 1832.131485] FS: 00007fcee9900740(0000) GS:ffff888151a00000(0000) knlGS:0000000000000000
[ 1832.131993] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1832.132354] CR2: 00007fcee9a1ef5e CR3: 0000000114cd2000 CR4: 0000000000350ee0
[ 1832.132801] Call Trace:
[ 1832.132962] <TASK>
[ 1832.133104] ? smb2_query_reparse_tag+0x890/0x890 [cifs]
[ 1832.133489] ? cifs_mapchar+0x460/0x460 [cifs]
[ 1832.133822] ? rcu_read_lock_sched_held+0x3f/0x70
[ 1832.134125] ? cifs_strndup_to_utf16+0x15b/0x250 [cifs]
[ 1832.134502] ? lock_downgrade+0x6f0/0x6f0
[ 1832.134760] ? cifs_convert_path_to_utf16+0x198/0x220 [cifs]
[ 1832.135170] ? smb2_check_message+0x1080/0x1080 [cifs]
[ 1832.135545] cifs_ioctl+0x1577/0x3320 [cifs]
[ 1832.135864] ? lock_downgrade+0x6f0/0x6f0
[ 1832.136125] ? cifs_readdir+0x2e60/0x2e60 [cifs]
[ 1832.136468] ? rcu_read_lock_sched_held+0x3f/0x70
[ 1832.136769] ? __rseq_handle_notify_resume+0x80b/0xbe0
[ 1832.137096] ? __up_read+0x192/0x710
[ 1832.137327] ? __ia32_sys_rseq+0xf0/0xf0
[ 1832.137578] ? __x64_sys_openat+0x11f/0x1d0
[ 1832.137850] __x64_sys_ioctl+0x127/0x190
[ 1832.138103] do_syscall_64+0x3b/0x90
[ 1832.138378] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 1832.138702] RIP: 0033:0x7fcee9a253df
[ 1832.138937] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 1832.140107] RSP: 002b:00007ffeba94a8a0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 1832.140606] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcee9a253df
[ 1832.141058] RDX: 00007ffeba94a910 RSI: 00000000c018cf07 RDI: 0000000000000003
[ 1832.141503] RBP: 00007ffeba94a930 R08: 00007fcee9b24db0 R09: 00007fcee9b45c4e
[ 1832.141948] R10: 00007fcee9918d40 R11: 0000000000000246 R12: 00007ffeba94aa48
[ 1832.142396] R13: 0000000000401176 R14: 0000000000403df8 R15: 00007fcee9b78000
[ 1832.142851] </TASK>
[ 1832.142994] Modules linked in: cifs cifs_arc4 cifs_md4 bpf_preload [last unloaded: cifs]
Cc: [email protected]
Signed-off-by: Paulo Alcantara (SUSE) <[email protected]>
Signed-off-by: Steve French <[email protected]>
|
other
|
v4l2loopback
|
64a216af4c09c9ba9326057d7e78994271827eff
| 0
|
static ssize_t attr_show_buffers(struct device *cd,
struct device_attribute *attr, char *buf)
{
struct v4l2_loopback_device *dev = v4l2loopback_cd2dev(cd);
return sprintf(buf, "%d\n", dev->used_buffers);
}
| null | null | 254,034
|
302510839924811667823050305726390461566
| 7
|
add explicit format specifier to printf() invocations
CWE-134
|
other
|
v4l2loopback
|
64a216af4c09c9ba9326057d7e78994271827eff
| 0
|
static void check_timers(struct v4l2_loopback_device *dev)
{
if (!dev->ready_for_capture)
return;
if (dev->timeout_jiffies > 0 && !timer_pending(&dev->timeout_timer))
mod_timer(&dev->timeout_timer, jiffies + dev->timeout_jiffies);
if (dev->sustain_framerate && !timer_pending(&dev->sustain_timer))
mod_timer(&dev->sustain_timer, jiffies + dev->frame_jiffies * 3 / 2);
}
| null | null | 254,039
|
258213869169538679594764324325310375204
| 10
|
add explicit format specifier to printf() invocations
CWE-134
|
other
|
lighttpd1.4
|
971773f1fae600074b46ef64f3ca1f76c227985f
| 0
|
static void wstunnel_handler_ctx_free(void *gwhctx) {
handler_ctx *hctx = (handler_ctx *)gwhctx;
chunk_buffer_release(hctx->frame.payload);
}
| null | null | 257,685
|
326260538769215832414829214874738730090
| 4
|
[mod_wstunnel] fix crash with bad hybivers (fixes #3165)
(thx Michał Dardas)
x-ref:
"mod_wstunnel null pointer dereference"
https://redmine.lighttpd.net/issues/3165
|
other
|
lighttpd1.4
|
971773f1fae600074b46ef64f3ca1f76c227985f
| 0
|
static int get_key_number(uint32_t *ret, const buffer *b) {
const char * const s = b->ptr;
size_t j = 0;
unsigned long n;
uint32_t sp = 0;
char tmp[10 + 1]; /* #define UINT32_MAX_STRLEN 10 */
for (size_t i = 0, used = buffer_clen(b); i < used; ++i) {
if (light_isdigit(s[i])) {
tmp[j] = s[i];
if (++j >= sizeof(tmp)) return -1;
}
else if (s[i] == ' ') ++sp; /* count num spaces */
}
tmp[j] = '\0';
n = strtoul(tmp, NULL, 10);
if (n > UINT32_MAX || 0 == sp || !light_isdigit(*tmp)) return -1;
*ret = (uint32_t)n / sp;
return 0;
}
| null | null | 257,688
|
326082521741250107155386054424849194304
| 20
|
[mod_wstunnel] fix crash with bad hybivers (fixes #3165)
(thx Michał Dardas)
x-ref:
"mod_wstunnel null pointer dereference"
https://redmine.lighttpd.net/issues/3165
|
other
|
njs
|
eafe4c7a326b163612f10861392622b5da5b1792
| 0
|
njs_array_iterator_prototype_next(njs_vm_t *vm, njs_value_t *args,
njs_uint_t nargs, njs_index_t tag)
{
njs_int_t ret;
njs_bool_t check;
njs_value_t *this;
njs_object_t *object;
njs_object_prop_t *prop_value, *prop_done;
this = njs_argument(args, 0);
check = njs_is_object_value(this)
&& (njs_is_object_data(this, NJS_DATA_TAG_ARRAY_ITERATOR)
|| !njs_is_valid(njs_object_value(this)));
if (njs_slow_path(!check)) {
njs_type_error(vm, "Method [Array Iterator].prototype.next"
" called on incompatible receiver");
return NJS_ERROR;
}
object = njs_object_alloc(vm);
if (njs_slow_path(object == NULL)) {
return NJS_ERROR;
}
njs_set_object(&vm->retval, object);
prop_value = njs_object_property_add(vm, &vm->retval,
njs_value_arg(&string_value), 0);
if (njs_slow_path(prop_value == NULL)) {
return NJS_ERROR;
}
prop_done = njs_object_property_add(vm, &vm->retval,
njs_value_arg(&string_done), 0);
if (njs_slow_path(prop_done == NULL)) {
return NJS_ERROR;
}
ret = njs_array_iterator_next(vm, this, &prop_value->value);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
if (njs_slow_path(ret == NJS_DECLINED)) {
njs_set_undefined(&prop_value->value);
njs_set_boolean(&prop_done->value, 1);
return NJS_OK;
}
njs_set_boolean(&prop_done->value, 0);
return NJS_OK;
}
| null | null | 262,726
|
120148118506687339042254072251119100086
| 56
|
Fixed Array.prototype.lastIndexOf() with unicode string as "this".
Previously, when lastIndexOf() was called with unicode string as "this"
argument and a negative "fromIndex" argument null-pointer dererence
might occur because njs_string_offset() was called with invalid index
value whereas njs_string_offset() should always be called with valid
index argument.
The fix is to verify that from index is valid.
This closes #482 issue on Github.
|
other
|
linux
|
99c23da0eed4fd20cae8243f2b51e10e66aa0951
| 0
|
static void sco_sock_set_timer(struct sock *sk, long timeout)
{
if (!sco_pi(sk)->conn)
return;
BT_DBG("sock %p state %d timeout %ld", sk, sk->sk_state, timeout);
cancel_delayed_work(&sco_pi(sk)->conn->timeout_work);
schedule_delayed_work(&sco_pi(sk)->conn->timeout_work, timeout);
}
| null | null | 263,506
|
209388870755621065800599141288357787719
| 9
|
Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()
The sco_send_frame() also takes lock_sock() during memcpy_from_msg()
call that may be endlessly blocked by a task with userfaultd
technique, and this will result in a hung task watchdog trigger.
Just like the similar fix for hci_sock_sendmsg() in commit
92c685dc5de0 ("Bluetooth: reorganize functions..."), this patch moves
the memcpy_from_msg() out of lock_sock() for addressing the hang.
This should be the last piece for fixing CVE-2021-3640 after a few
already queued fixes.
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
|
other
|
tensorflow
|
eb921122119a6b6e470ee98b89e65d721663179d
| 0
|
TfLiteStatus Gather(TfLiteContext* context, const TfLiteGatherParams& params,
const TfLiteTensor* input, const TfLiteTensor* positions,
TfLiteTensor* output) {
const PositionsT* indexes = GetTensorData<PositionsT>(positions);
bool indices_has_only_positive_elements = true;
const size_t num_indices = positions->bytes / sizeof(PositionsT);
for (size_t i = 0; i < num_indices; i++) {
if (indexes[i] < 0) {
indices_has_only_positive_elements = false;
break;
}
}
TF_LITE_ENSURE(context, indices_has_only_positive_elements);
tflite::GatherParams op_params;
op_params.axis = params.axis;
op_params.batch_dims = params.batch_dims;
optimized_ops::Gather(op_params, GetTensorShape(input),
GetTensorData<InputT>(input), GetTensorShape(positions),
GetTensorData<PositionsT>(positions),
GetTensorShape(output), GetTensorData<InputT>(output));
return kTfLiteOk;
}
| null | null | 265,432
|
201071679938864636818163736764619902183
| 23
|
Prevent heap OOB read in TFLite's `gather.cc`.
Passing negative indices is illegal but there was a missing check so that resulted in OOB accesses.
PiperOrigin-RevId: 387231300
Change-Id: I3111b54b2f232638d795be17efc46abe4ede6bf8
|
other
|
radare2
|
193f4fe01d7f626e2ea937450f2e0c4604420e9d
| 0
|
R_IPI bool r_bin_file_set_obj(RBin *bin, RBinFile *bf, RBinObject *obj) {
r_return_val_if_fail (bin && bf, false);
bin->file = bf->file;
bin->cur = bf;
bin->narch = bf->narch;
if (obj) {
bf->o = obj;
} else {
obj = bf->o;
}
RBinPlugin *plugin = r_bin_file_cur_plugin (bf);
if (bin->minstrlen < 1) {
bin->minstrlen = plugin? plugin->minstrlen: bin->minstrlen;
}
if (obj) {
if (!obj->info) {
return false;
}
if (!obj->info->lang) {
obj->info->lang = r_bin_lang_tostring (obj->lang);
}
}
return true;
}
| null | null | 267,953
|
11109708838971955092594178821129064135
| 24
|
Fix integer overflow in string search causing oobread ##crash
* Reported by @greatergoodest via huntrdev
* BountyID: 8a3dc5cb-08b3-4807-82b2-77f08c137a04
* Reproducer bfileovf
|
other
|
radare2
|
193f4fe01d7f626e2ea937450f2e0c4604420e9d
| 0
|
static RBinPlugin *get_plugin_from_buffer(RBin *bin, RBinFile *bf, const char *pluginname, RBuffer *buf) {
RBinPlugin *plugin = bin->force? r_bin_get_binplugin_by_name (bin, bin->force): NULL;
if (plugin) {
return plugin;
}
plugin = pluginname? r_bin_get_binplugin_by_name (bin, pluginname): NULL;
if (plugin) {
return plugin;
}
plugin = r_bin_get_binplugin_by_buffer (bin, bf, buf);
if (plugin) {
return plugin;
}
return r_bin_get_binplugin_by_name (bin, "any");
}
| null | null | 267,956
|
215812811139165702455696047759219823417
| 15
|
Fix integer overflow in string search causing oobread ##crash
* Reported by @greatergoodest via huntrdev
* BountyID: 8a3dc5cb-08b3-4807-82b2-77f08c137a04
* Reproducer bfileovf
|
other
|
radare2
|
193f4fe01d7f626e2ea937450f2e0c4604420e9d
| 0
|
R_API RBinFile *r_bin_file_find_by_fd(RBin *bin, ut32 bin_fd) {
RListIter *iter;
RBinFile *bf;
r_return_val_if_fail (bin, NULL);
r_list_foreach (bin->binfiles, iter, bf) {
if (bf->fd == bin_fd) {
return bf;
}
}
return NULL;
}
| null | null | 267,963
|
35348010251906534441404139902219682378
| 13
|
Fix integer overflow in string search causing oobread ##crash
* Reported by @greatergoodest via huntrdev
* BountyID: 8a3dc5cb-08b3-4807-82b2-77f08c137a04
* Reproducer bfileovf
|
other
|
uftpd
|
0fb2c031ce0ace07cc19cd2cb2143c4b5a63c9dd
| 0
|
static int do_abort(ctrl_t *ctrl)
{
if (ctrl->d || ctrl->d_num) {
uev_io_stop(&ctrl->data_watcher);
if (ctrl->d_num > 0)
free(ctrl->d);
ctrl->d_num = 0;
ctrl->d = NULL;
ctrl->i = 0;
if (ctrl->file)
free(ctrl->file);
ctrl->file = NULL;
}
if (ctrl->file) {
uev_io_stop(&ctrl->data_watcher);
free(ctrl->file);
ctrl->file = NULL;
}
if (ctrl->fp) {
fclose(ctrl->fp);
ctrl->fp = NULL;
}
ctrl->pending = 0;
ctrl->offset = 0;
return close_data_connection(ctrl);
}
| null | null | 273,924
|
321756024100513914410711700288874310687
| 31
|
FTP: Fix buffer overflow in PORT parser, reported by Aaron Esau
Signed-off-by: Joachim Nilsson <[email protected]>
|
other
|
gerbv
|
319a8af890e4d0a5c38e6d08f510da8eefc42537
| 0
|
callbacks_open_activate(GtkMenuItem *menuitem, gpointer user_data)
{
GSList *fns = NULL;
screen.win.gerber =
gtk_file_chooser_dialog_new (
_("Open Gerbv project, Gerber, drill, "
"or pick&place files"),
NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_select_multiple(
(GtkFileChooser *)screen.win.gerber, TRUE);
gtk_file_chooser_set_current_folder(
(GtkFileChooser *)screen.win.gerber, mainProject->path);
gtk_widget_show (screen.win.gerber);
if (gtk_dialog_run ((GtkDialog*)screen.win.gerber) ==
GTK_RESPONSE_ACCEPT) {
fns = gtk_file_chooser_get_filenames(
GTK_FILE_CHOOSER (screen.win.gerber));
/* Update the last folder */
g_free (mainProject->path);
mainProject->path = gtk_file_chooser_get_current_folder(
(GtkFileChooser *)screen.win.gerber);
}
gtk_widget_destroy (screen.win.gerber);
open_files (fns);
g_slist_free_full (fns, g_free);
}
| null | null | 274,749
|
10546569675352686049676335445411764791
| 31
|
Remove local alias to parameter array
Normalizing access to `gerbv_simplified_amacro_t::parameter` as a step to fix CVE-2021-40402
|
other
|
date
|
8f2d7a0c7e52cea8333824bd527822e5449ed83d
| 0
|
d_lite_inspect_raw(VALUE self)
{
get_d1(self);
return mk_inspect_raw(dat, rb_obj_class(self));
}
| null | null | 294,629
|
79567068934892548582210724174282211440
| 5
|
`Date._<format>(nil)` should return an empty Hash
Fix: https://github.com/ruby/date/issues/39
This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.
https://github.com/rails/rails/blob/90357af08048ef5076730505f6e7b14a81f33d0c/activesupport/lib/active_support/values/time_zone.rb#L383-L384
Any Rails application upgrading to date `3.2.1` might run into unexpected errors.
|
other
|
exim
|
e2f5dc151e2e79058e93924e6d35510557f0535d
| 0
|
read_named_list(tree_node **anchorp, int *numberp, int max, uschar *s,
uschar *tname)
{
BOOL forcecache = FALSE;
uschar *ss;
tree_node *t;
namedlist_block *nb = store_get(sizeof(namedlist_block));
if (Ustrncmp(s, "_cache", 6) == 0)
{
forcecache = TRUE;
s += 6;
}
if (!isspace(*s))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "unrecognized configuration line");
if (*numberp >= max)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "too many named %ss (max is %d)\n",
tname, max);
while (isspace(*s)) s++;
ss = s;
while (isalnum(*s) || *s == '_') s++;
t = store_get(sizeof(tree_node) + s-ss);
Ustrncpy(t->name, ss, s-ss);
t->name[s-ss] = 0;
while (isspace(*s)) s++;
if (!tree_insertnode(anchorp, t))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"duplicate name \"%s\" for a named %s", t->name, tname);
t->data.ptr = nb;
nb->number = *numberp;
*numberp += 1;
if (*s++ != '=') log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
"missing '=' after \"%s\"", t->name);
while (isspace(*s)) s++;
nb->string = read_string(s, t->name);
nb->cache_data = NULL;
/* Check the string for any expansions; if any are found, mark this list
uncacheable unless the user has explicited forced caching. */
if (!forcecache && Ustrchr(nb->string, '$') != NULL) nb->number = -1;
}
| null | null | 299,895
|
16042436833134722795812694423110631061
| 48
|
Check configure file permissions even for non-default files if still privileged
(Bug 1044, CVE-2010-4345)
|
other
|
linux
|
d6d86830705f173fca6087a3e67ceaf68db80523
| 0
|
static int tipc_sk_insert(struct tipc_sock *tsk)
{
struct sock *sk = &tsk->sk;
struct net *net = sock_net(sk);
struct tipc_net *tn = net_generic(net, tipc_net_id);
u32 remaining = (TIPC_MAX_PORT - TIPC_MIN_PORT) + 1;
u32 portid = prandom_u32() % remaining + TIPC_MIN_PORT;
while (remaining--) {
portid++;
if ((portid < TIPC_MIN_PORT) || (portid > TIPC_MAX_PORT))
portid = TIPC_MIN_PORT;
tsk->portid = portid;
sock_hold(&tsk->sk);
if (!rhashtable_lookup_insert_fast(&tn->sk_rht, &tsk->node,
tsk_rht_params))
return 0;
sock_put(&tsk->sk);
}
return -1;
}
| null | null | 300,817
|
49892430050799669092879530873298978246
| 22
|
net ticp:fix a kernel-infoleak in __tipc_sendmsg()
struct tipc_socket_addr.ref has a 4-byte hole,and __tipc_getname() currently
copying it to user space,causing kernel-infoleak.
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline]
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline] lib/usercopy.c:33
BUG: KMSAN: kernel-infoleak in _copy_to_user+0x1c9/0x270 lib/usercopy.c:33 lib/usercopy.c:33
instrument_copy_to_user include/linux/instrumented.h:121 [inline]
instrument_copy_to_user include/linux/instrumented.h:121 [inline] lib/usercopy.c:33
_copy_to_user+0x1c9/0x270 lib/usercopy.c:33 lib/usercopy.c:33
copy_to_user include/linux/uaccess.h:209 [inline]
copy_to_user include/linux/uaccess.h:209 [inline] net/socket.c:287
move_addr_to_user+0x3f6/0x600 net/socket.c:287 net/socket.c:287
__sys_getpeername+0x470/0x6b0 net/socket.c:1987 net/socket.c:1987
__do_sys_getpeername net/socket.c:1997 [inline]
__se_sys_getpeername net/socket.c:1994 [inline]
__do_sys_getpeername net/socket.c:1997 [inline] net/socket.c:1994
__se_sys_getpeername net/socket.c:1994 [inline] net/socket.c:1994
__x64_sys_getpeername+0xda/0x120 net/socket.c:1994 net/socket.c:1994
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x44/0xae
Uninit was stored to memory at:
tipc_getname+0x575/0x5e0 net/tipc/socket.c:757 net/tipc/socket.c:757
__sys_getpeername+0x3b3/0x6b0 net/socket.c:1984 net/socket.c:1984
__do_sys_getpeername net/socket.c:1997 [inline]
__se_sys_getpeername net/socket.c:1994 [inline]
__do_sys_getpeername net/socket.c:1997 [inline] net/socket.c:1994
__se_sys_getpeername net/socket.c:1994 [inline] net/socket.c:1994
__x64_sys_getpeername+0xda/0x120 net/socket.c:1994 net/socket.c:1994
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x44/0xae
Uninit was stored to memory at:
msg_set_word net/tipc/msg.h:212 [inline]
msg_set_destport net/tipc/msg.h:619 [inline]
msg_set_word net/tipc/msg.h:212 [inline] net/tipc/socket.c:1486
msg_set_destport net/tipc/msg.h:619 [inline] net/tipc/socket.c:1486
__tipc_sendmsg+0x44fa/0x5890 net/tipc/socket.c:1486 net/tipc/socket.c:1486
tipc_sendmsg+0xeb/0x140 net/tipc/socket.c:1402 net/tipc/socket.c:1402
sock_sendmsg_nosec net/socket.c:704 [inline]
sock_sendmsg net/socket.c:724 [inline]
sock_sendmsg_nosec net/socket.c:704 [inline] net/socket.c:2409
sock_sendmsg net/socket.c:724 [inline] net/socket.c:2409
____sys_sendmsg+0xe11/0x12c0 net/socket.c:2409 net/socket.c:2409
___sys_sendmsg net/socket.c:2463 [inline]
___sys_sendmsg net/socket.c:2463 [inline] net/socket.c:2492
__sys_sendmsg+0x704/0x840 net/socket.c:2492 net/socket.c:2492
__do_sys_sendmsg net/socket.c:2501 [inline]
__se_sys_sendmsg net/socket.c:2499 [inline]
__do_sys_sendmsg net/socket.c:2501 [inline] net/socket.c:2499
__se_sys_sendmsg net/socket.c:2499 [inline] net/socket.c:2499
__x64_sys_sendmsg+0xe2/0x120 net/socket.c:2499 net/socket.c:2499
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x44/0xae
Local variable skaddr created at:
__tipc_sendmsg+0x2d0/0x5890 net/tipc/socket.c:1419 net/tipc/socket.c:1419
tipc_sendmsg+0xeb/0x140 net/tipc/socket.c:1402 net/tipc/socket.c:1402
Bytes 4-7 of 16 are uninitialized
Memory access of size 16 starts at ffff888113753e00
Data copied to user address 0000000020000280
Reported-by: [email protected]
Signed-off-by: Haimin Zhang <[email protected]>
Acked-by: Jon Maloy <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
|
other
|
ncurses
|
790a85dbd4a81d5f5d8dd02a44d84f01512ef443
| 0
|
set_conversions(TTY * tty_settings)
{
#ifdef ONLCR
tty_settings->c_oflag |= ONLCR;
#endif
tty_settings->c_iflag |= ICRNL;
tty_settings->c_lflag |= ECHO;
#ifdef OXTABS
tty_settings->c_oflag |= OXTABS;
#endif /* OXTABS */
/* test used to be tgetflag("NL") */
if (VALID_STRING(newline) && newline[0] == '\n' && !newline[1]) {
/* Newline, not linefeed. */
#ifdef ONLCR
tty_settings->c_oflag &= ~((unsigned) ONLCR);
#endif
tty_settings->c_iflag &= ~((unsigned) ICRNL);
}
#ifdef OXTABS
/* test used to be tgetflag("pt") */
if (VALID_STRING(set_tab) && VALID_STRING(clear_all_tabs))
tty_settings->c_oflag &= ~OXTABS;
#endif /* OXTABS */
tty_settings->c_lflag |= (ECHOE | ECHOK);
}
| null | null | 309,899
|
311391480107612379888923697780274498645
| 26
|
ncurses 6.2 - patch 20200531
+ correct configure version-check/warnng for g++ to allow for 10.x
+ re-enable "bel" in konsole-base (report by Nia Huang)
+ add linux-s entry (patch by Alexandre Montaron).
+ drop long-obsolete convert_configure.pl
+ add test/test_parm.c, for checking tparm changes.
+ improve parameter-checking for tparm, adding function _nc_tiparm() to
handle the most-used case, which accepts only numeric parameters
(report/testcase by "puppet-meteor").
+ use a more conservative estimate of the buffer-size in lib_tparm.c's
save_text() and save_number(), in case the sprintf() function
passes-through unexpected characters from a format specifier
(report/testcase by "puppet-meteor").
+ add a check for end-of-string in cvtchar to handle a malformed
string in infotocap (report/testcase by "puppet-meteor").
|
other
|
ncurses
|
790a85dbd4a81d5f5d8dd02a44d84f01512ef443
| 0
|
skip_delay(char *s)
{
while (*s == '/' || isdigit(UChar(*s)))
++s;
return s;
}
| null | null | 310,021
|
111765975845851947072863777002864995611
| 6
|
ncurses 6.2 - patch 20200531
+ correct configure version-check/warnng for g++ to allow for 10.x
+ re-enable "bel" in konsole-base (report by Nia Huang)
+ add linux-s entry (patch by Alexandre Montaron).
+ drop long-obsolete convert_configure.pl
+ add test/test_parm.c, for checking tparm changes.
+ improve parameter-checking for tparm, adding function _nc_tiparm() to
handle the most-used case, which accepts only numeric parameters
(report/testcase by "puppet-meteor").
+ use a more conservative estimate of the buffer-size in lib_tparm.c's
save_text() and save_number(), in case the sprintf() function
passes-through unexpected characters from a format specifier
(report/testcase by "puppet-meteor").
+ add a check for end-of-string in cvtchar to handle a malformed
string in infotocap (report/testcase by "puppet-meteor").
|
other
|
ncurses
|
790a85dbd4a81d5f5d8dd02a44d84f01512ef443
| 0
|
mouse_activate(SCREEN *sp, int on)
{
if (!on && !sp->_mouse_initialized)
return;
if (!_nc_mouse_init(sp))
return;
if (on) {
sp->_mouse_bstate = 0;
switch (sp->_mouse_type) {
case M_XTERM:
#if NCURSES_EXT_FUNCS
NCURSES_SP_NAME(keyok) (NCURSES_SP_ARGx KEY_MOUSE, on);
#endif
TPUTS_TRACE("xterm mouse initialization");
enable_xterm_mouse(sp, 1);
break;
#if USE_GPM_SUPPORT
case M_GPM:
if (enable_gpm_mouse(sp, TRUE)) {
sp->_mouse_fd = *(my_gpm_fd);
T(("GPM mouse_fd %d", sp->_mouse_fd));
}
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, handle_sysmouse);
sp->_mouse_active = TRUE;
break;
#endif
#ifdef USE_TERM_DRIVER
case M_TERM_DRIVER:
sp->_mouse_active = TRUE;
break;
#endif
case M_NONE:
return;
}
/* Make runtime binding to cut down on object size of applications that
* do not use the mouse (e.g., 'clear').
*/
sp->_mouse_event = _nc_mouse_event;
sp->_mouse_inline = _nc_mouse_inline;
sp->_mouse_parse = _nc_mouse_parse;
sp->_mouse_resume = _nc_mouse_resume;
sp->_mouse_wrap = _nc_mouse_wrap;
} else {
switch (sp->_mouse_type) {
case M_XTERM:
TPUTS_TRACE("xterm mouse deinitialization");
enable_xterm_mouse(sp, 0);
break;
#if USE_GPM_SUPPORT
case M_GPM:
enable_gpm_mouse(sp, FALSE);
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, SIG_IGN);
sp->_mouse_active = FALSE;
break;
#endif
#ifdef USE_TERM_DRIVER
case M_TERM_DRIVER:
sp->_mouse_active = FALSE;
break;
#endif
case M_NONE:
return;
}
}
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
| null | null | 310,108
|
228122921798639990128175751527020416456
| 77
|
ncurses 6.2 - patch 20200531
+ correct configure version-check/warnng for g++ to allow for 10.x
+ re-enable "bel" in konsole-base (report by Nia Huang)
+ add linux-s entry (patch by Alexandre Montaron).
+ drop long-obsolete convert_configure.pl
+ add test/test_parm.c, for checking tparm changes.
+ improve parameter-checking for tparm, adding function _nc_tiparm() to
handle the most-used case, which accepts only numeric parameters
(report/testcase by "puppet-meteor").
+ use a more conservative estimate of the buffer-size in lib_tparm.c's
save_text() and save_number(), in case the sprintf() function
passes-through unexpected characters from a format specifier
(report/testcase by "puppet-meteor").
+ add a check for end-of-string in cvtchar to handle a malformed
string in infotocap (report/testcase by "puppet-meteor").
|
other
|
tor
|
00fffbc1a15e2696a89c721d0c94dc333ff419ef
| 0
|
dirserv_get_consensus(const char *flavor_name)
{
if (!cached_consensuses)
return NULL;
return strmap_get(cached_consensuses, flavor_name);
}
| null | null | 310,263
|
215315223511708647156635059924534938711
| 6
|
Don't give the Guard flag to relays without the CVE-2011-2768 fix
|
other
|
vim
|
d6c67629ed05aae436164eec474832daf8ba7420
| 0
|
qf_new_list(qf_info_T *qi, char_u *qf_title)
{
int i;
qf_list_T *qfl;
// If the current entry is not the last entry, delete entries beyond
// the current entry. This makes it possible to browse in a tree-like
// way with ":grep".
while (qi->qf_listcount > qi->qf_curlist + 1)
qf_free(&qi->qf_lists[--qi->qf_listcount]);
// When the stack is full, remove to oldest entry
// Otherwise, add a new entry.
if (qi->qf_listcount == LISTCOUNT)
{
qf_free(&qi->qf_lists[0]);
for (i = 1; i < LISTCOUNT; ++i)
qi->qf_lists[i - 1] = qi->qf_lists[i];
qi->qf_curlist = LISTCOUNT - 1;
}
else
qi->qf_curlist = qi->qf_listcount++;
qfl = qf_get_curlist(qi);
CLEAR_POINTER(qfl);
qf_store_title(qfl, qf_title);
qfl->qfl_type = qi->qfl_type;
qfl->qf_id = ++last_qf_id;
}
| null | null | 312,477
|
93732360710220841877453733545087850475
| 28
|
patch 9.0.0260: using freed memory when using 'quickfixtextfunc' recursively
Problem: Using freed memory when using 'quickfixtextfunc' recursively.
Solution: Do not allow for recursion.
|
other
|
vim
|
395bd1f6d3edc9f7edb5d1f2d7deaf5a9e3ab93c
| 0
|
nv_end(cmdarg_T *cap)
{
if (cap->arg || (mod_mask & MOD_MASK_CTRL)) // CTRL-END = goto last line
{
cap->arg = TRUE;
nv_goto(cap);
cap->count1 = 1; // to end of current line
}
nv_dollar(cap);
}
| null | null | 313,833
|
113428978086857076445718800141878983962
| 10
|
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Problem: Reading past end of line with "gf" in Visual block mode.
Solution: Do not include the NUL in the length.
|
other
|
linux
|
2a8859f373b0a86f0ece8ec8312607eacf12485d
| 0
|
static inline bool FNAME(is_last_gpte)(struct kvm_mmu *mmu,
unsigned int level, unsigned int gpte)
{
/*
* For EPT and PAE paging (both variants), bit 7 is either reserved at
* all level or indicates a huge page (ignoring CR3/EPTP). In either
* case, bit 7 being set terminates the walk.
*/
#if PTTYPE == 32
/*
* 32-bit paging requires special handling because bit 7 is ignored if
* CR4.PSE=0, not reserved. Clear bit 7 in the gpte if the level is
* greater than the last level for which bit 7 is the PAGE_SIZE bit.
*
* The RHS has bit 7 set iff level < (2 + PSE). If it is clear, bit 7
* is not reserved and does not indicate a large page at this level,
* so clear PT_PAGE_SIZE_MASK in gpte if that is the case.
*/
gpte &= level - (PT32_ROOT_LEVEL + mmu->mmu_role.ext.cr4_pse);
#endif
/*
* PG_LEVEL_4K always terminates. The RHS has bit 7 set
* iff level <= PG_LEVEL_4K, which for our purpose means
* level == PG_LEVEL_4K; set PT_PAGE_SIZE_MASK in gpte then.
*/
gpte |= level - PG_LEVEL_4K - 1;
return gpte & PT_PAGE_SIZE_MASK;
}
| null | null | 314,479
|
44046198089629007653487158637045629162
| 29
|
KVM: x86/mmu: do compare-and-exchange of gPTE via the user address
FNAME(cmpxchg_gpte) is an inefficient mess. It is at least decent if it
can go through get_user_pages_fast(), but if it cannot then it tries to
use memremap(); that is not just terribly slow, it is also wrong because
it assumes that the VM_PFNMAP VMA is contiguous.
The right way to do it would be to do the same thing as
hva_to_pfn_remapped() does since commit add6a0cd1c5b ("KVM: MMU: try to
fix up page faults before giving up", 2016-07-05), using follow_pte()
and fixup_user_fault() to determine the correct address to use for
memremap(). To do this, one could for example extract hva_to_pfn()
for use outside virt/kvm/kvm_main.c. But really there is no reason to
do that either, because there is already a perfectly valid address to
do the cmpxchg() on, only it is a userspace address. That means doing
user_access_begin()/user_access_end() and writing the code in assembly
to handle exceptions correctly. Worse, the guest PTE can be 8-byte
even on i686 so there is the extra complication of using cmpxchg8b to
account for. But at least it is an efficient mess.
(Thanks to Linus for suggesting improvement on the inline assembly).
Reported-by: Qiuhao Li <[email protected]>
Reported-by: Gaoning Pan <[email protected]>
Reported-by: Yongkang Jia <[email protected]>
Reported-by: [email protected]
Debugged-by: Tadeusz Struk <[email protected]>
Tested-by: Maxim Levitsky <[email protected]>
Cc: [email protected]
Fixes: bd53cb35a3e9 ("X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs")
Signed-off-by: Paolo Bonzini <[email protected]>
|
other
|
linux
|
2a8859f373b0a86f0ece8ec8312607eacf12485d
| 0
|
static inline unsigned FNAME(gpte_access)(u64 gpte)
{
unsigned access;
#if PTTYPE == PTTYPE_EPT
access = ((gpte & VMX_EPT_WRITABLE_MASK) ? ACC_WRITE_MASK : 0) |
((gpte & VMX_EPT_EXECUTABLE_MASK) ? ACC_EXEC_MASK : 0) |
((gpte & VMX_EPT_READABLE_MASK) ? ACC_USER_MASK : 0);
#else
BUILD_BUG_ON(ACC_EXEC_MASK != PT_PRESENT_MASK);
BUILD_BUG_ON(ACC_EXEC_MASK != 1);
access = gpte & (PT_WRITABLE_MASK | PT_USER_MASK | PT_PRESENT_MASK);
/* Combine NX with P (which is set here) to get ACC_EXEC_MASK. */
access ^= (gpte >> PT64_NX_SHIFT);
#endif
return access;
}
| null | null | 314,485
|
25615746603894343205835009457100590890
| 17
|
KVM: x86/mmu: do compare-and-exchange of gPTE via the user address
FNAME(cmpxchg_gpte) is an inefficient mess. It is at least decent if it
can go through get_user_pages_fast(), but if it cannot then it tries to
use memremap(); that is not just terribly slow, it is also wrong because
it assumes that the VM_PFNMAP VMA is contiguous.
The right way to do it would be to do the same thing as
hva_to_pfn_remapped() does since commit add6a0cd1c5b ("KVM: MMU: try to
fix up page faults before giving up", 2016-07-05), using follow_pte()
and fixup_user_fault() to determine the correct address to use for
memremap(). To do this, one could for example extract hva_to_pfn()
for use outside virt/kvm/kvm_main.c. But really there is no reason to
do that either, because there is already a perfectly valid address to
do the cmpxchg() on, only it is a userspace address. That means doing
user_access_begin()/user_access_end() and writing the code in assembly
to handle exceptions correctly. Worse, the guest PTE can be 8-byte
even on i686 so there is the extra complication of using cmpxchg8b to
account for. But at least it is an efficient mess.
(Thanks to Linus for suggesting improvement on the inline assembly).
Reported-by: Qiuhao Li <[email protected]>
Reported-by: Gaoning Pan <[email protected]>
Reported-by: Yongkang Jia <[email protected]>
Reported-by: [email protected]
Debugged-by: Tadeusz Struk <[email protected]>
Tested-by: Maxim Levitsky <[email protected]>
Cc: [email protected]
Fixes: bd53cb35a3e9 ("X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs")
Signed-off-by: Paolo Bonzini <[email protected]>
|
other
|
net
|
7892032cfe67f4bde6fc2ee967e45a8fbaf33756
| 0
|
static struct ip6_tnl __rcu **__ip6gre_bucket(struct ip6gre_net *ign,
const struct __ip6_tnl_parm *p)
{
const struct in6_addr *remote = &p->raddr;
const struct in6_addr *local = &p->laddr;
unsigned int h = HASH_KEY(p->i_key);
int prio = 0;
if (!ipv6_addr_any(local))
prio |= 1;
if (!ipv6_addr_any(remote) && !ipv6_addr_is_multicast(remote)) {
prio |= 2;
h ^= HASH_ADDR(remote);
}
return &ign->tunnels[prio][h];
}
| null | null | 336,112
|
15270385349691506685460241366719163391
| 17
|
ip6_gre: fix ip6gre_err() invalid reads
Andrey Konovalov reported out of bound accesses in ip6gre_err()
If GRE flags contains GRE_KEY, the following expression
*(((__be32 *)p) + (grehlen / 4) - 1)
accesses data ~40 bytes after the expected point, since
grehlen includes the size of IPv6 headers.
Let's use a "struct gre_base_hdr *greh" pointer to make this
code more readable.
p[1] becomes greh->protocol.
grhlen is the GRE header length.
Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Andrey Konovalov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
other
|
spice
|
ca5bbc5692e052159bce1a75f55dc60b36078749
| 0
|
static RedsMigTargetClient* reds_mig_target_client_find(RedsState *reds, RedClient *client)
{
GList *l;
for (l = reds->mig_target_clients; l != NULL; l = l->next) {
RedsMigTargetClient *mig_client = (RedsMigTargetClient*) l->data;
if (mig_client->client == client) {
return mig_client;
}
}
return NULL;
}
| null | null | 336,520
|
177512632378378514037906220099719318192
| 13
|
With OpenSSL 1.1: Disable client-initiated renegotiation.
Fixes issue #49
Fixes BZ#1904459
Signed-off-by: Julien Ropé <[email protected]>
Reported-by: BlackKD
Acked-by: Frediano Ziglio <[email protected]>
|
other
|
spice
|
ca5bbc5692e052159bce1a75f55dc60b36078749
| 0
|
static void reds_mig_release(RedServerConfig *config)
{
if (config->mig_spice) {
g_free(config->mig_spice->cert_subject);
g_free(config->mig_spice->host);
g_free(config->mig_spice);
config->mig_spice = NULL;
}
}
| null | null | 336,543
|
105940152202525552856838230907712217417
| 9
|
With OpenSSL 1.1: Disable client-initiated renegotiation.
Fixes issue #49
Fixes BZ#1904459
Signed-off-by: Julien Ropé <[email protected]>
Reported-by: BlackKD
Acked-by: Frediano Ziglio <[email protected]>
|
other
|
tty
|
15b3cd8ef46ad1b100e0d3c7e38774f330726820
| 0
|
int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
{
struct uni_pagedir *q;
if (!*src_vc->vc_uni_pagedir_loc)
return -EINVAL;
if (*dst_vc->vc_uni_pagedir_loc == *src_vc->vc_uni_pagedir_loc)
return 0;
con_free_unimap(dst_vc);
q = *src_vc->vc_uni_pagedir_loc;
q->refcount++;
*dst_vc->vc_uni_pagedir_loc = q;
return 0;
}
| null | null | 345,210
|
111635185053533606181053014468092583454
| 14
|
Revert "consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c"
This reverts commit 84ecc2f6eb1cb12e6d44818f94fa49b50f06e6ac.
con_insert_unipair() is working with a sparse 3-dimensional array:
- p->uni_pgdir[] is the top layer
- p1 points to a middle layer
- p2 points to a bottom layer
If it needs to allocate a new middle layer, and then fails to allocate
a new bottom layer, it would previously free only p2, and now it frees
both p1 and p2. But since the new middle layer was already registered
in the top layer, it was not leaked.
However, if it looks up an *existing* middle layer and then fails to
allocate a bottom layer, it now frees both p1 and p2 but does *not*
free any other bottom layers under p1. So it *introduces* a memory
leak.
The error path also cleared the wrong index in p->uni_pgdir[],
introducing a use-after-free.
Signed-off-by: Ben Hutchings <[email protected]>
Fixes: 84ecc2f6eb1c ("consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c")
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
other
|
linux
|
1d0688421449718c6c5f46e458a378c9b530ba18
| 0
|
static int virtbt_probe(struct virtio_device *vdev)
{
vq_callback_t *callbacks[VIRTBT_NUM_VQS] = {
[VIRTBT_VQ_TX] = virtbt_tx_done,
[VIRTBT_VQ_RX] = virtbt_rx_done,
};
const char *names[VIRTBT_NUM_VQS] = {
[VIRTBT_VQ_TX] = "tx",
[VIRTBT_VQ_RX] = "rx",
};
struct virtio_bluetooth *vbt;
struct hci_dev *hdev;
int err;
__u8 type;
if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
return -ENODEV;
type = virtio_cread8(vdev, offsetof(struct virtio_bt_config, type));
switch (type) {
case VIRTIO_BT_CONFIG_TYPE_PRIMARY:
case VIRTIO_BT_CONFIG_TYPE_AMP:
break;
default:
return -EINVAL;
}
vbt = kzalloc(sizeof(*vbt), GFP_KERNEL);
if (!vbt)
return -ENOMEM;
vdev->priv = vbt;
vbt->vdev = vdev;
INIT_WORK(&vbt->rx, virtbt_rx_work);
err = virtio_find_vqs(vdev, VIRTBT_NUM_VQS, vbt->vqs, callbacks,
names, NULL);
if (err)
return err;
hdev = hci_alloc_dev();
if (!hdev) {
err = -ENOMEM;
goto failed;
}
vbt->hdev = hdev;
hdev->bus = HCI_VIRTIO;
hdev->dev_type = type;
hci_set_drvdata(hdev, vbt);
hdev->open = virtbt_open;
hdev->close = virtbt_close;
hdev->flush = virtbt_flush;
hdev->send = virtbt_send_frame;
if (virtio_has_feature(vdev, VIRTIO_BT_F_VND_HCI)) {
__u16 vendor;
virtio_cread(vdev, struct virtio_bt_config, vendor, &vendor);
switch (vendor) {
case VIRTIO_BT_CONFIG_VENDOR_ZEPHYR:
hdev->manufacturer = 1521;
hdev->setup = virtbt_setup_zephyr;
hdev->shutdown = virtbt_shutdown_generic;
hdev->set_bdaddr = virtbt_set_bdaddr_zephyr;
break;
case VIRTIO_BT_CONFIG_VENDOR_INTEL:
hdev->manufacturer = 2;
hdev->setup = virtbt_setup_intel;
hdev->shutdown = virtbt_shutdown_generic;
hdev->set_bdaddr = virtbt_set_bdaddr_intel;
set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
break;
case VIRTIO_BT_CONFIG_VENDOR_REALTEK:
hdev->manufacturer = 93;
hdev->setup = virtbt_setup_realtek;
hdev->shutdown = virtbt_shutdown_generic;
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
break;
}
}
if (virtio_has_feature(vdev, VIRTIO_BT_F_MSFT_EXT)) {
__u16 msft_opcode;
virtio_cread(vdev, struct virtio_bt_config,
msft_opcode, &msft_opcode);
hci_set_msft_opcode(hdev, msft_opcode);
}
if (virtio_has_feature(vdev, VIRTIO_BT_F_AOSP_EXT))
hci_set_aosp_capable(hdev);
if (hci_register_dev(hdev) < 0) {
hci_free_dev(hdev);
err = -EBUSY;
goto failed;
}
return 0;
failed:
vdev->config->del_vqs(vdev);
return err;
}
| null | null | 349,525
|
129546000597670610909112769484114841455
| 116
|
Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle()
On the reception of packets with an invalid packet type, the memory of
the allocated socket buffers is never freed. Add a default case that frees
these to avoid a memory leak.
Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver")
Signed-off-by: Soenke Huster <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
|
other
|
poppler
|
b224e2f5739fe61de9fa69955d016725b2a4b78d
| 0
|
void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
bool overprintFlag,
int overprintMode,
const GfxColor *singleColor,
bool grayIndexed) {
#ifdef SPLASH_CMYK
unsigned int mask;
GfxCMYK cmyk;
bool additive = false;
int i;
if (colorSpace->getMode() == csIndexed) {
setOverprintMask(((GfxIndexedColorSpace *)colorSpace)->getBase(),
overprintFlag,
overprintMode,
singleColor,
grayIndexed);
return;
}
if (overprintFlag && overprintPreview) {
mask = colorSpace->getOverprintMask();
if (singleColor && overprintMode &&
colorSpace->getMode() == csDeviceCMYK) {
colorSpace->getCMYK(singleColor, &cmyk);
if (cmyk.c == 0) {
mask &= ~1;
}
if (cmyk.m == 0) {
mask &= ~2;
}
if (cmyk.y == 0) {
mask &= ~4;
}
if (cmyk.k == 0) {
mask &= ~8;
}
}
if (grayIndexed) {
mask &= ~7;
} else if (colorSpace->getMode() == csSeparation) {
GfxSeparationColorSpace *deviceSep = (GfxSeparationColorSpace *)colorSpace;
additive = deviceSep->getName()->cmp("All") != 0 && mask == 0x0f && !deviceSep->isNonMarking();
} else if (colorSpace->getMode() == csDeviceN) {
GfxDeviceNColorSpace *deviceNCS = (GfxDeviceNColorSpace *)colorSpace;
additive = mask == 0x0f && !deviceNCS->isNonMarking();
for (i = 0; i < deviceNCS->getNComps() && additive; i++) {
if (deviceNCS->getColorantName(i)->cmp("Cyan") == 0) {
additive = false;
} else if (deviceNCS->getColorantName(i)->cmp("Magenta") == 0) {
additive = false;
} else if (deviceNCS->getColorantName(i)->cmp("Yellow") == 0) {
additive = false;
} else if (deviceNCS->getColorantName(i)->cmp("Black") == 0) {
additive = false;
}
}
}
} else {
mask = 0xffffffff;
}
splash->setOverprintMask(mask, additive);
#endif
}
| null | null | 353,148
|
211313924904805379136813267926417891874
| 63
|
SplashOutputDev::tilingPatternFill: Fix crash on broken file
Issue #802
|
other
|
linux
|
a2ef990ab5a6705a356d146dd773a3b359787497
| 0
|
static struct mm_struct *__check_mem_permission(struct task_struct *task)
{
struct mm_struct *mm;
mm = get_task_mm(task);
if (!mm)
return ERR_PTR(-EINVAL);
/*
* A task can always look at itself, in case it chooses
* to use system calls instead of load instructions.
*/
if (task == current)
return mm;
/*
* If current is actively ptrace'ing, and would also be
* permitted to freshly attach with ptrace now, permit it.
*/
if (task_is_stopped_or_traced(task)) {
int match;
rcu_read_lock();
match = (ptrace_parent(task) == current);
rcu_read_unlock();
if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH))
return mm;
}
/*
* No one else is allowed.
*/
mmput(mm);
return ERR_PTR(-EPERM);
}
| null | null | 369,945
|
32400825679336594106152712477471029748
| 34
|
proc: fix null pointer deref in proc_pid_permission()
get_proc_task() can fail to search the task and return NULL,
put_task_struct() will then bomb the kernel with following oops:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
IP: [<ffffffff81217d34>] proc_pid_permission+0x64/0xe0
PGD 112075067 PUD 112814067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
This is a regression introduced by commit 0499680a ("procfs: add hidepid=
and gid= mount options"). The kernel should return -ESRCH if
get_proc_task() failed.
Signed-off-by: Xiaotian Feng <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Vasiliy Kulikov <[email protected]>
Cc: Stephen Wilson <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
other
|
qcad
|
1eeffc5daf5a06cf6213ffc19e95923cdebb2eb8
| 0
|
void DL_Dxf::addMText(DL_CreationInterface* creationInterface) {
double angle = 0.0;
if (hasValue(50)) {
if (libVersion<=0x02000200) {
// wrong but compatible with dxflib <=2.0.2.0 (angle stored in rad):
angle = getRealValue(50, 0.0);
} else {
angle = (getRealValue(50, 0.0)*2*M_PI)/360.0;
}
} else if (hasValue(11) && hasValue(21)) {
double x = getRealValue(11, 0.0);
double y = getRealValue(21, 0.0);
if (fabs(x)<1.0e-6) {
if (y>0.0) {
angle = M_PI/2.0;
} else {
angle = M_PI/2.0*3.0;
}
} else {
angle = atan(y/x);
}
}
DL_MTextData d(
// insertion point
getRealValue(10, 0.0),
getRealValue(20, 0.0),
getRealValue(30, 0.0),
// X direction vector
getRealValue(11, 0.0),
getRealValue(21, 0.0),
getRealValue(31, 0.0),
// height
getRealValue(40, 2.5),
// width
getRealValue(41, 0.0),
// attachment point
getIntValue(71, 1),
// drawing direction
getIntValue(72, 1),
// line spacing style
getIntValue(73, 1),
// line spacing factor
getRealValue(44, 1.0),
// text
getStringValue(1, ""),
// style
getStringValue(7, ""),
// angle
angle);
creationInterface->addMText(d);
}
| null | null | 386,560
|
46338429322259655153929301092741538110
| 54
|
check vertexIndex which might be -1 for broken DXF
|
other
|
linux
|
5934d9a0383619c14df91af8fd76261dc3de2f5f
| 0
|
static int snd_ctl_elem_list_user(struct snd_card *card,
struct snd_ctl_elem_list __user *_list)
{
struct snd_ctl_elem_list list;
int err;
if (copy_from_user(&list, _list, sizeof(list)))
return -EFAULT;
err = snd_ctl_elem_list(card, &list);
if (err)
return err;
if (copy_to_user(_list, &list, sizeof(list)))
return -EFAULT;
return 0;
}
| null | null | 387,581
|
63256158084291611402985334955951385448
| 16
|
ALSA: control: Re-order bounds checking in get_ctl_id_hash()
These two checks are in the reverse order so it might read one element
beyond the end of the array. First check if the "i" is within bounds
before using it.
Fixes: 6ab55ec0a938 ("ALSA: control: Fix an out-of-bounds bug in get_ctl_id_hash()")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/YwjgNh/gkG1hH7po@kili
Signed-off-by: Takashi Iwai <[email protected]>
|
other
|
vim
|
1e56bda9048a9625bce6e660938c834c5c15b07d
| 0
|
check_for_dict_arg(typval_T *args, int idx)
{
if (args[idx].v_type != VAR_DICT)
{
semsg(_(e_dict_required_for_argument_nr), idx + 1);
return FAIL;
}
return OK;
}
| null | null | 389,713
|
141080721318029071675117420640599644779
| 9
|
patch 9.0.0104: going beyond allocated memory when evaluating string constant
Problem: Going beyond allocated memory when evaluating string constant.
Solution: Properly skip over <Key> form.
|
other
|
vim
|
1e56bda9048a9625bce6e660938c834c5c15b07d
| 0
|
check_for_bool_arg(typval_T *args, int idx)
{
if (args[idx].v_type != VAR_BOOL
&& !(args[idx].v_type == VAR_NUMBER
&& (args[idx].vval.v_number == 0
|| args[idx].vval.v_number == 1)))
{
semsg(_(e_bool_required_for_argument_nr), idx + 1);
return FAIL;
}
return OK;
}
| null | null | 389,727
|
18860959565384722997224499968636100802
| 12
|
patch 9.0.0104: going beyond allocated memory when evaluating string constant
Problem: Going beyond allocated memory when evaluating string constant.
Solution: Properly skip over <Key> form.
|
other
|
squirrel
|
a6413aa690e0bdfef648c68693349a7b878fe60d
| 0
|
static SQInteger base_seterrorhandler(HSQUIRRELVM v)
{
sq_seterrorhandler(v);
return 0;
}
| null | null | 393,481
|
178112983592969439257590626914183686801
| 5
|
fix in thread.call
|
other
|
linux
|
f227e3ec3b5cad859ad15666874405e8c1bbc1d4
| 0
|
static void timer_sync_wait_running(struct timer_base *base)
{
if (atomic_read(&base->timer_waiters)) {
spin_unlock(&base->expiry_lock);
spin_lock(&base->expiry_lock);
}
}
| null | null | 401,512
|
176891829193256923285135254041913515459
| 7
|
random32: update the net random state on interrupt and activity
This modifies the first 32 bits out of the 128 bits of a random CPU's
net_rand_state on interrupt or CPU activity to complicate remote
observations that could lead to guessing the network RNG's internal
state.
Note that depending on some network devices' interrupt rate moderation
or binding, this re-seeding might happen on every packet or even almost
never.
In addition, with NOHZ some CPUs might not even get timer interrupts,
leaving their local state rarely updated, while they are running
networked processes making use of the random state. For this reason, we
also perform this update in update_process_times() in order to at least
update the state when there is user or system activity, since it's the
only case we care about.
Reported-by: Amit Klein <[email protected]>
Suggested-by: Linus Torvalds <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: "Jason A. Donenfeld" <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: <[email protected]>
Signed-off-by: Willy Tarreau <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
other
|
at-spi2-core
|
c2e87fe00b596dba20c9d57d406ab8faa744b15a
| 0
|
on_name_lost (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
A11yBusLauncher *app = user_data;
if (app->session_bus == NULL
&& connection == NULL
&& app->a11y_launch_error_message == NULL)
app->a11y_launch_error_message = g_strdup ("Failed to connect to session bus");
g_main_loop_quit (app->loop);
}
| null | null | 411,796
|
209162272483935417248155158643498161858
| 11
|
Fix inverted logic.
Don't write more into a buffer than it can hold.
https://bugzilla.gnome.org/show_bug.cgi?id=791124
|
other
|
gnupg
|
b0b3803e8c2959dd67ca96debc54b5c6464f0d41
| 0
|
pin_cb (void *opaque, const char *info, char **retstr)
{
assuan_context_t ctx = opaque;
char *command;
int rc;
unsigned char *value;
size_t valuelen;
if (!retstr)
{
/* We prompt for pinpad entry. To make sure that the popup has
been show we use an inquire and not just a status message.
We ignore any value returned. */
if (info)
{
log_debug ("prompting for pinpad entry '%s'\n", info);
rc = gpgrt_asprintf (&command, "POPUPPINPADPROMPT %s", info);
if (rc < 0)
return gpg_error (gpg_err_code_from_errno (errno));
rc = assuan_inquire (ctx, command, &value, &valuelen, MAXLEN_PIN);
xfree (command);
}
else
{
log_debug ("dismiss pinpad entry prompt\n");
rc = assuan_inquire (ctx, "DISMISSPINPADPROMPT",
&value, &valuelen, MAXLEN_PIN);
}
if (!rc)
xfree (value);
return rc;
}
*retstr = NULL;
log_debug ("asking for PIN '%s'\n", info);
rc = gpgrt_asprintf (&command, "NEEDPIN %s", info);
if (rc < 0)
return gpg_error (gpg_err_code_from_errno (errno));
/* Fixme: Write an inquire function which returns the result in
secure memory and check all further handling of the PIN. */
rc = assuan_inquire (ctx, command, &value, &valuelen, MAXLEN_PIN);
xfree (command);
if (rc)
return rc;
if (!valuelen || value[valuelen-1])
{
/* We require that the returned value is an UTF-8 string */
xfree (value);
return gpg_error (GPG_ERR_INV_RESPONSE);
}
*retstr = (char*)value;
return 0;
}
| null | null | 415,207
|
339532838092181681955556042023008325329
| 56
|
scd: Avoid double-free on error condition in scd
* scd/command.c (cmd_readkey): avoid double-free of cert
--
When ksba_cert_new() fails, cert will be double-freed.
Debian-Bug-Id: 773471
Original patch changed by wk to do the free only at leave.
|
other
|
MilkyTracker
|
7afd55c42ad80d01a339197a2d8b5461d214edaf
| 0
|
void PlayerGeneric::enable(PlayModeOptions option, bool b)
{
ASSERT(option>=PlayModeOptionFirst && option<PlayModeOptionLast);
options[option] = b;
if (player)
player->enable(option, b);
}
| null | null | 417,067
|
225622941726678529531855917956910537431
| 8
|
Fix use-after-free in PlayerGeneric destructor
|
other
|
file
|
46a8443f76cec4b41ec736eca396984c74664f84
| 0
|
cdf_swap_dir(cdf_directory_t *d)
{
d->d_namelen = CDF_TOLE2(d->d_namelen);
d->d_left_child = CDF_TOLE4(CAST(uint32_t, d->d_left_child));
d->d_right_child = CDF_TOLE4(CAST(uint32_t, d->d_right_child));
d->d_storage = CDF_TOLE4(CAST(uint32_t, d->d_storage));
d->d_storage_uuid[0] = CDF_TOLE8(d->d_storage_uuid[0]);
d->d_storage_uuid[1] = CDF_TOLE8(d->d_storage_uuid[1]);
d->d_flags = CDF_TOLE4(d->d_flags);
d->d_created = CDF_TOLE8(CAST(uint64_t, d->d_created));
d->d_modified = CDF_TOLE8(CAST(uint64_t, d->d_modified));
d->d_stream_first_sector = CDF_TOLE4(
CAST(uint32_t, d->d_stream_first_sector));
d->d_size = CDF_TOLE4(d->d_size);
}
| null | null | 427,718
|
267598963095433805790413638791896858364
| 15
|
Limit the number of elements in a vector (found by oss-fuzz)
|
other
|
linux
|
9b0971ca7fc75daca80c0bb6c02e96059daea90a
| 0
|
int svm_register_enc_region(struct kvm *kvm,
struct kvm_enc_region *range)
{
struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
struct enc_region *region;
int ret = 0;
if (!sev_guest(kvm))
return -ENOTTY;
/* If kvm is mirroring encryption context it isn't responsible for it */
if (is_mirroring_enc_context(kvm))
return -EINVAL;
if (range->addr > ULONG_MAX || range->size > ULONG_MAX)
return -EINVAL;
region = kzalloc(sizeof(*region), GFP_KERNEL_ACCOUNT);
if (!region)
return -ENOMEM;
mutex_lock(&kvm->lock);
region->pages = sev_pin_memory(kvm, range->addr, range->size, ®ion->npages, 1);
if (IS_ERR(region->pages)) {
ret = PTR_ERR(region->pages);
mutex_unlock(&kvm->lock);
goto e_free;
}
region->uaddr = range->addr;
region->size = range->size;
list_add_tail(®ion->list, &sev->regions_list);
mutex_unlock(&kvm->lock);
/*
* The guest may change the memory encryption attribute from C=0 -> C=1
* or vice versa for this memory range. Lets make sure caches are
* flushed to ensure that guest data gets written into memory with
* correct C-bit.
*/
sev_clflush_pages(region->pages, region->npages);
return ret;
e_free:
kfree(region);
return ret;
}
| null | null | 427,818
|
37735299863907632866603568494697437605
| 49
|
KVM: SEV-ES: fix another issue with string I/O VMGEXITs
If the guest requests string I/O from the hypervisor via VMGEXIT,
SW_EXITINFO2 will contain the REP count. However, sev_es_string_io
was incorrectly treating it as the size of the GHCB buffer in
bytes.
This fixes the "outsw" test in the experimental SEV tests of
kvm-unit-tests.
Cc: [email protected]
Fixes: 7ed9abfe8e9f ("KVM: SVM: Support string IO operations for an SEV-ES guest")
Reported-by: Marc Orr <[email protected]>
Tested-by: Marc Orr <[email protected]>
Reviewed-by: Marc Orr <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
other
|
unicorn
|
3d3deac5e6d38602b689c4fef5dac004f07a2e63
| 0
|
static bool subpage_accepts(struct uc_struct *uc, void *opaque, hwaddr addr,
unsigned len, bool is_write,
MemTxAttrs attrs)
{
subpage_t *subpage = opaque;
#if defined(DEBUG_SUBPAGE)
printf("%s: subpage %p %c len %u addr " TARGET_FMT_plx "\n",
__func__, subpage, is_write ? 'w' : 'r', len, addr);
#endif
return flatview_access_valid(uc, subpage->fv, addr + subpage->base,
len, is_write, attrs);
}
| null | null | 432,168
|
63967631870418926600391921964457441366
| 13
|
Fix crash when mapping a big memory and calling uc_close
|
other
|
linux
|
89c2b3b74918200e46699338d7bcc19b1ea12110
| 0
|
static void __io_commit_cqring_flush(struct io_ring_ctx *ctx)
{
if (ctx->off_timeout_used)
io_flush_timeouts(ctx);
if (ctx->drain_active)
io_queue_deferred(ctx);
}
| null | null | 436,068
|
340010207469402300024205814911386979974
| 7
|
io_uring: reexpand under-reexpanded iters
[ 74.211232] BUG: KASAN: stack-out-of-bounds in iov_iter_revert+0x809/0x900
[ 74.212778] Read of size 8 at addr ffff888025dc78b8 by task
syz-executor.0/828
[ 74.214756] CPU: 0 PID: 828 Comm: syz-executor.0 Not tainted
5.14.0-rc3-next-20210730 #1
[ 74.216525] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
[ 74.219033] Call Trace:
[ 74.219683] dump_stack_lvl+0x8b/0xb3
[ 74.220706] print_address_description.constprop.0+0x1f/0x140
[ 74.224226] kasan_report.cold+0x7f/0x11b
[ 74.226085] iov_iter_revert+0x809/0x900
[ 74.227960] io_write+0x57d/0xe40
[ 74.232647] io_issue_sqe+0x4da/0x6a80
[ 74.242578] __io_queue_sqe+0x1ac/0xe60
[ 74.245358] io_submit_sqes+0x3f6e/0x76a0
[ 74.248207] __do_sys_io_uring_enter+0x90c/0x1a20
[ 74.257167] do_syscall_64+0x3b/0x90
[ 74.257984] entry_SYSCALL_64_after_hwframe+0x44/0xae
old_size = iov_iter_count();
...
iov_iter_revert(old_size - iov_iter_count());
If iov_iter_revert() is done base on the initial size as above, and the
iter is truncated and not reexpanded in the middle, it miscalculates
borders causing problems. This trace is due to no one reexpanding after
generic_write_checks().
Now iters store how many bytes has been truncated, so reexpand them to
the initial state right before reverting.
Cc: [email protected]
Reported-by: Palash Oswal <[email protected]>
Reported-by: Sudip Mukherjee <[email protected]>
Reported-and-tested-by: [email protected]
Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Al Viro <[email protected]>
|
other
|
ImageMagick6
|
210474b2fac6a661bfa7ed563213920e93e76395
| 0
|
ModuleExport size_t RegisterPNMImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("PAM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->description=ConstantString("Common 2-dimensional bitmap format");
entry->mime_type=ConstantString("image/x-portable-pixmap");
entry->module=ConstantString("PNM");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PBM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->description=ConstantString("Portable bitmap format (black and white)");
entry->mime_type=ConstantString("image/x-portable-bitmap");
entry->module=ConstantString("PNM");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PFM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->endian_support=MagickTrue;
entry->description=ConstantString("Portable float format");
entry->module=ConstantString("PFM");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PGM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->description=ConstantString("Portable graymap format (gray scale)");
entry->mime_type=ConstantString("image/x-portable-greymap");
entry->module=ConstantString("PNM");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->magick=(IsImageFormatHandler *) IsPNM;
entry->description=ConstantString("Portable anymap");
entry->mime_type=ConstantString("image/x-portable-pixmap");
entry->module=ConstantString("PNM");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PPM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
entry->description=ConstantString("Portable pixmap format (color)");
entry->mime_type=ConstantString("image/x-portable-pixmap");
entry->module=ConstantString("PNM");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| null | null | 439,066
|
94264172621879694387592603491954916518
| 50
|
Fix ultra rare but potential memory-leak
|
other
|
spice
|
a4a16ac42d2f19a17e36556546aa94d5cd83745f
| 0
|
static void print_memslots(RedMemSlotInfo *info)
{
int i;
int x;
for (i = 0; i < info->num_memslots_groups; ++i) {
for (x = 0; x < info->num_memslots; ++x) {
if (!info->mem_slots[i][x].virt_start_addr &&
!info->mem_slots[i][x].virt_end_addr) {
continue;
}
printf("id %d, group %d, virt start %lx, virt end %lx, generation %u, delta %lx\n",
x, i, info->mem_slots[i][x].virt_start_addr,
info->mem_slots[i][x].virt_end_addr, info->mem_slots[i][x].generation,
info->mem_slots[i][x].address_delta);
}
}
}
| null | null | 442,582
|
151001726244296520622555241676922871542
| 18
|
memslot: Fix off-by-one error in group/slot boundary check
RedMemSlotInfo keeps an array of groups, and each group contains an
array of slots. Unfortunately, these checks are off by 1, they check
that the index is greater or equal to the number of elements in the
array, while these arrays are 0 based. The check should only check for
strictly greater than the number of elements.
For the group array, this is not a big issue, as these memslot groups
are created by spice-server users (eg QEMU), and the group ids used to
index that array are also generated by the spice-server user, so it
should not be possible for the guest to set them to arbitrary values.
The slot id is more problematic, as it's calculated from a QXLPHYSICAL
address, and such addresses are usually set by the guest QXL driver, so
the guest can set these to arbitrary values, including malicious values,
which are probably easy to build from the guest PCI configuration.
This patch fixes the arrays bound check, and adds a test case for this.
This fixes CVE-2019-3813.
Signed-off-by: Christophe Fergeau <[email protected]>
Acked-by: Frediano Ziglio <[email protected]>
|
other
|
curl
|
70b1900dd13d16f2e83f571407a614541d5ac9ba
| 0
|
static int ftpfilemethod(struct Configurable *config, char *str)
{
if(curlx_strequal("singlecwd", str))
return CURLFTPMETHOD_SINGLECWD;
if(curlx_strequal("nocwd", str))
return CURLFTPMETHOD_NOCWD;
if(curlx_strequal("multicwd", str))
return CURLFTPMETHOD_MULTICWD;
warnf(config, "unrecognized ftp file method '%s', using default\n", str);
return CURLFTPMETHOD_MULTICWD;
}
| null | null | 442,792
|
108849185848884077742314181965388997639
| 11
|
'mytx' in bug report #1723194 (http://curl.haxx.se/bug/view.cgi?id=1723194)
pointed out that the warnf() function in the curl tool didn't properly deal
with the cases when excessively long words were used in the string to chop
up.
|
other
|
file-roller
|
b147281293a8307808475e102a14857055f81631
| 0
|
fr_window_set_password_for_second_archive (FrWindow *window,
const char *password)
{
g_return_if_fail (window != NULL);
if (window->priv->second_password != NULL) {
g_free (window->priv->second_password);
window->priv->second_password = NULL;
}
if ((password != NULL) && (password[0] != '\0'))
window->priv->second_password = g_strdup (password);
}
| null | null | 445,869
|
40852421738713627674976957508022854528
| 13
|
libarchive: sanitize filenames before extracting
|
other
|
frr
|
ff6db1027f8f36df657ff2e5ea167773752537ed
| 0
|
bool bgp_notify_received_hard_reset(struct peer *peer, uint8_t code,
uint8_t subcode)
{
/* When the "N" bit has been exchanged, a Hard Reset message is used to
* indicate to the peer that the session is to be fully terminated.
*/
if (!bgp_has_graceful_restart_notification(peer))
return false;
if (code == BGP_NOTIFY_CEASE && subcode == BGP_NOTIFY_CEASE_HARD_RESET)
return true;
return false;
}
| null | null | 448,548
|
173437471597660270075946890529571204456
| 14
|
bgpd: Make sure hdr length is at a minimum of what is expected
Ensure that if the capability length specified is enough data.
Signed-off-by: Donald Sharp <[email protected]>
|
other
|
clamav-devel
|
c6870a6c857dd722dffaf6d37ae52ec259d12492
| 0
|
int cli_scansis(int desc, cli_ctx *ctx) {
FILE *f;
int i;
char *tmpd;
uint32_t uid[4];
cli_dbgmsg("in scansis()\n");
if (!(tmpd = cli_gentemp(ctx->engine->tmpdir)))
return CL_ETMPDIR;
if (mkdir(tmpd, 0700)) {
cli_dbgmsg("SIS: Can't create temporary directory %s\n", tmpd);
free(tmpd);
return CL_ETMPDIR;
}
if (ctx->engine->keeptmp)
cli_dbgmsg("SIS: Extracting files to %s\n", tmpd);
if ((i=dup(desc))==-1) {
cli_dbgmsg("SIS: dup() failed\n");
cli_rmdirs(tmpd);
free(tmpd);
return CL_EDUP;
}
if (!(f=fdopen(i, "rb"))) {
cli_dbgmsg("SIS: fdopen() failed\n");
close(i);
cli_rmdirs(tmpd);
free(tmpd);
return CL_EOPEN;
}
rewind(f);
if (fread(uid, 16, 1, f)!=1) {
cli_dbgmsg("SIS: unable to read UIDs\n");
cli_rmdirs(tmpd);
free(tmpd);
fclose(f);
return CL_EREAD;
}
cli_dbgmsg("SIS: UIDS %x %x %x - %x\n", EC32(uid[0]), EC32(uid[1]), EC32(uid[2]), EC32(uid[3]));
if (uid[2]==le32_to_host(0x10000419)) {
i=real_scansis(f, ctx, tmpd);
}
else if(uid[0]==le32_to_host(0x10201a7a)) {
i=real_scansis9x(f, ctx, tmpd);
}
else {
cli_dbgmsg("SIS: UIDs failed to match\n");
i=CL_EFORMAT;
}
if (!ctx->engine->keeptmp)
cli_rmdirs(tmpd);
free(tmpd);
fclose(f);
return i;
}
| null | null | 449,318
|
218645672916114051254559215843708120847
| 59
|
bb #6808
|
other
|
bash
|
951bdaad7a18cc0dc1036bba86b18b90874d39ff
| 0
|
bash_vi_complete (count, key)
int count, key;
{
#if defined (SPECIFIC_COMPLETION_FUNCTIONS)
int p, r;
char *t;
if ((rl_point < rl_end) && (!whitespace (rl_line_buffer[rl_point])))
{
if (!whitespace (rl_line_buffer[rl_point + 1]))
rl_vi_end_word (1, 'E');
rl_point++;
}
/* Find boundaries of current word, according to vi definition of a
`bigword'. */
t = 0;
if (rl_point > 0)
{
p = rl_point;
rl_vi_bWord (1, 'B');
r = rl_point;
rl_point = p;
p = r;
t = substring (rl_line_buffer, p, rl_point);
}
if (t && completion_glob_pattern (t) == 0)
rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
FREE (t);
if (key == '*') /* Expansion and replacement. */
r = bash_glob_expand_word (count, key);
else if (key == '=') /* List possible completions. */
r = bash_glob_list_expansions (count, key);
else if (key == '\\') /* Standard completion */
r = bash_glob_complete_word (count, key);
else
r = rl_complete (0, key);
if (key == '*' || key == '\\')
rl_vi_start_inserting (key, 1, 1);
return (r);
#else
return rl_vi_complete (count, key);
#endif /* !SPECIFIC_COMPLETION_FUNCTIONS */
}
| null | null | 455,358
|
139310507451300935907578564904967929900
| 49
|
commit bash-20190628 snapshot
|
other
|
linux
|
30e29a9a2bc6a4888335a6ede968b75cd329657a
| 0
|
static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
u64 *ips, u32 trace_nr, bool user)
{
int i;
struct vm_area_struct *vma;
bool irq_work_busy = false;
struct stack_map_irq_work *work = NULL;
if (irqs_disabled()) {
if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
work = this_cpu_ptr(&up_read_work);
if (irq_work_is_busy(&work->irq_work)) {
/* cannot queue more up_read, fallback */
irq_work_busy = true;
}
} else {
/*
* PREEMPT_RT does not allow to trylock mmap sem in
* interrupt disabled context. Force the fallback code.
*/
irq_work_busy = true;
}
}
/*
* We cannot do up_read() when the irq is disabled, because of
* risk to deadlock with rq_lock. To do build_id lookup when the
* irqs are disabled, we need to run up_read() in irq_work. We use
* a percpu variable to do the irq_work. If the irq_work is
* already used by another lookup, we fall back to report ips.
*
* Same fallback is used for kernel stack (!user) on a stackmap
* with build_id.
*/
if (!user || !current || !current->mm || irq_work_busy ||
!mmap_read_trylock(current->mm)) {
/* cannot access current->mm, fall back to ips */
for (i = 0; i < trace_nr; i++) {
id_offs[i].status = BPF_STACK_BUILD_ID_IP;
id_offs[i].ip = ips[i];
memset(id_offs[i].build_id, 0, BUILD_ID_SIZE_MAX);
}
return;
}
for (i = 0; i < trace_nr; i++) {
vma = find_vma(current->mm, ips[i]);
if (!vma || build_id_parse(vma, id_offs[i].build_id, NULL)) {
/* per entry fall back to ips */
id_offs[i].status = BPF_STACK_BUILD_ID_IP;
id_offs[i].ip = ips[i];
memset(id_offs[i].build_id, 0, BUILD_ID_SIZE_MAX);
continue;
}
id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i]
- vma->vm_start;
id_offs[i].status = BPF_STACK_BUILD_ID_VALID;
}
if (!work) {
mmap_read_unlock(current->mm);
} else {
work->mm = current->mm;
/* The lock will be released once we're out of interrupt
* context. Tell lockdep that we've released it now so
* it doesn't complain that we forgot to release it.
*/
rwsem_release(¤t->mm->mmap_lock.dep_map, _RET_IP_);
irq_work_queue(&work->irq_work);
}
}
| null | null | 459,520
|
218331281774651464479696581807373915903
| 72
|
bpf: Fix integer overflow in prealloc_elems_and_freelist()
In prealloc_elems_and_freelist(), the multiplication to calculate the
size passed to bpf_map_area_alloc() could lead to an integer overflow.
As a result, out-of-bounds write could occur in pcpu_freelist_populate()
as reported by KASAN:
[...]
[ 16.968613] BUG: KASAN: slab-out-of-bounds in pcpu_freelist_populate+0xd9/0x100
[ 16.969408] Write of size 8 at addr ffff888104fc6ea0 by task crash/78
[ 16.970038]
[ 16.970195] CPU: 0 PID: 78 Comm: crash Not tainted 5.15.0-rc2+ #1
[ 16.970878] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[ 16.972026] Call Trace:
[ 16.972306] dump_stack_lvl+0x34/0x44
[ 16.972687] print_address_description.constprop.0+0x21/0x140
[ 16.973297] ? pcpu_freelist_populate+0xd9/0x100
[ 16.973777] ? pcpu_freelist_populate+0xd9/0x100
[ 16.974257] kasan_report.cold+0x7f/0x11b
[ 16.974681] ? pcpu_freelist_populate+0xd9/0x100
[ 16.975190] pcpu_freelist_populate+0xd9/0x100
[ 16.975669] stack_map_alloc+0x209/0x2a0
[ 16.976106] __sys_bpf+0xd83/0x2ce0
[...]
The possibility of this overflow was originally discussed in [0], but
was overlooked.
Fix the integer overflow by changing elem_size to u64 from u32.
[0] https://lore.kernel.org/bpf/[email protected]/
Fixes: 557c0c6e7df8 ("bpf: convert stackmap to pre-allocation")
Signed-off-by: Tatsuhiko Yasumatsu <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
|
other
|
atril
|
f4291fd62f7dfe6460d2406a979ccfac0c68dd59
| 0
|
comics_document_get_page_size (EvDocument *document,
EvPage *page,
double *width,
double *height)
{
GdkPixbufLoader *loader;
char **argv;
guchar buf[1024];
gboolean success, got_size = FALSE;
gint outpipe = -1;
GPid child_pid;
gssize bytes;
GdkPixbuf *pixbuf;
gchar *filename;
ComicsDocument *comics_document = COMICS_DOCUMENT (document);
if (!comics_document->decompress_tmp) {
argv = extract_argv (document, page->index);
success = g_spawn_async_with_pipes (NULL, argv, NULL,
G_SPAWN_SEARCH_PATH |
G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL,
&child_pid,
NULL, &outpipe, NULL, NULL);
g_strfreev (argv);
g_return_if_fail (success == TRUE);
loader = gdk_pixbuf_loader_new ();
g_signal_connect (loader, "area-prepared",
G_CALLBACK (get_page_size_area_prepared_cb),
&got_size);
while (outpipe >= 0) {
bytes = read (outpipe, buf, 1024);
if (bytes > 0)
gdk_pixbuf_loader_write (loader, buf, bytes, NULL);
if (bytes <= 0 || got_size) {
close (outpipe);
outpipe = -1;
gdk_pixbuf_loader_close (loader, NULL);
}
}
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf) {
if (width)
*width = gdk_pixbuf_get_width (pixbuf);
if (height)
*height = gdk_pixbuf_get_height (pixbuf);
}
g_spawn_close_pid (child_pid);
g_object_unref (loader);
} else {
filename = g_build_filename (comics_document->dir,
(char *) comics_document->page_names->pdata[page->index],
NULL);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
if (pixbuf) {
if (width)
*width = gdk_pixbuf_get_width (pixbuf);
if (height)
*height = gdk_pixbuf_get_height (pixbuf);
g_object_unref (pixbuf);
}
g_free (filename);
}
}
| null | null | 463,033
|
42093752426338562510575554408611838860
| 67
|
comics: make the files containing "--checkpoint-action=" unsupported
Fixes #257
|
other
|
kvm
|
e28ba7bb020f07193bc000453c8775e9d2c0dda7
| 0
|
static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned seg,
int reg, struct operand *op)
{
int df = (ctxt->eflags & EFLG_DF) ? -1 : 1;
register_address_increment(ctxt, &ctxt->regs[reg], df * op->bytes);
op->addr.mem.ea = register_address(ctxt, ctxt->regs[reg]);
op->addr.mem.seg = seg;
}
| null | null | 466,141
|
279937378381120723563750678467533571246
| 9
|
KVM: x86: fix missing checks in syscall emulation
On hosts without this patch, 32bit guests will crash (and 64bit guests
may behave in a wrong way) for example by simply executing following
nasm-demo-application:
[bits 32]
global _start
SECTION .text
_start: syscall
(I tested it with winxp and linux - both always crashed)
Disassembly of section .text:
00000000 <_start>:
0: 0f 05 syscall
The reason seems a missing "invalid opcode"-trap (int6) for the
syscall opcode "0f05", which is not available on Intel CPUs
within non-longmodes, as also on some AMD CPUs within legacy-mode.
(depending on CPU vendor, MSR_EFER and cpuid)
Because previous mentioned OSs may not engage corresponding
syscall target-registers (STAR, LSTAR, CSTAR), they remain
NULL and (non trapping) syscalls are leading to multiple
faults and finally crashs.
Depending on the architecture (AMD or Intel) pretended by
guests, various checks according to vendor's documentation
are implemented to overcome the current issue and behave
like the CPUs physical counterparts.
[mtosatti: cleanup/beautify code]
Signed-off-by: Stephan Baerwolf <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
|
other
|
linux
|
75e5b4849b81e19e9efe1654b30d7f3151c33c2c
| 0
|
void usb_remove_config(struct usb_composite_dev *cdev,
struct usb_configuration *config)
{
unsigned long flags;
spin_lock_irqsave(&cdev->lock, flags);
if (cdev->config == config)
reset_config(cdev);
spin_unlock_irqrestore(&cdev->lock, flags);
remove_config(cdev, config);
}
| null | null | 476,112
|
158127452115525305672838329101128620567
| 14
|
USB: gadget: validate interface OS descriptor requests
Stall the control endpoint in case provided index exceeds array size of
MAX_CONFIG_INTERFACES or when the retrieved function pointer is null.
Signed-off-by: Szymon Heidrich <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
other
|
radare2
|
9650e3c352f675687bf6c6f65ff2c4a3d0e288fa
| 0
|
R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {
ut32 i = 0;
ut64 curpos, offset = 0;
RBinJavaLineNumberAttribute *lnattr;
if (sz < 6) {
return NULL;
}
RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);
if (!attr) {
return NULL;
}
offset += 6;
attr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;
attr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
attr->info.line_number_table_attr.line_number_table = r_list_newf (free);
ut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;
RList *linenum_list = attr->info.line_number_table_attr.line_number_table;
for (i = 0; i < linenum_len; i++) {
curpos = buf_offset + offset;
// eprintf ("%"PFMT64x" %"PFMT64x"\n", curpos, sz);
// XXX if (curpos + 8 >= sz) break;
lnattr = R_NEW0 (RBinJavaLineNumberAttribute);
if (!lnattr) {
break;
}
// wtf it works
if (offset - 2 > sz) {
R_FREE (lnattr);
break;
}
lnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
lnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
lnattr->file_offset = curpos;
lnattr->size = 4;
r_list_append (linenum_list, lnattr);
}
attr->size = offset;
return attr;
}
| null | null | 477,370
|
119348967668166951269710852739156757728
| 43
|
Fix oobread segfault in java arith8.class ##crash
* Reported by Cen Zhang via huntr.dev
|
other
|
radare2
|
9650e3c352f675687bf6c6f65ff2c4a3d0e288fa
| 0
|
R_API void r_bin_java_reset_bin_info(RBinJavaObj *bin) {
free (bin->cf2.flags_str);
free (bin->cf2.this_class_name);
r_list_free (bin->imports_list);
r_list_free (bin->methods_list);
r_list_free (bin->fields_list);
r_list_free (bin->attrs_list);
r_list_free (bin->cp_list);
r_list_free (bin->interfaces_list);
r_str_constpool_fini (&bin->constpool);
memset (bin, 0, sizeof (RBinJavaObj));
r_str_constpool_init (&bin->constpool);
bin->cf2.flags_str = strdup ("unknown");
bin->cf2.this_class_name = strdup ("unknown");
bin->imports_list = r_list_newf (free);
bin->methods_list = r_list_newf (r_bin_java_fmtype_free);
bin->fields_list = r_list_newf (r_bin_java_fmtype_free);
bin->attrs_list = r_list_newf (r_bin_java_attribute_free);
bin->cp_list = r_list_newf (r_bin_java_constant_pool);
bin->interfaces_list = r_list_newf (r_bin_java_interface_free);
}
| null | null | 477,386
|
257880697052646704196395827734415534903
| 21
|
Fix oobread segfault in java arith8.class ##crash
* Reported by Cen Zhang via huntr.dev
|
other
|
liblouis
|
2e4772befb2b1c37cb4b9d6572945115ee28630a
| 0
|
compileGrouping(FileInfo *file, int noback, int nofor, TranslationTableHeader **table,
DisplayTableHeader **displayTable) {
int k;
CharsString name;
CharsString groupChars;
CharsString groupDots;
CharsString dotsParsed;
if (!getToken(file, &name, "name operand")) return 0;
if (!getRuleCharsText(file, &groupChars)) return 0;
if (!getToken(file, &groupDots, "dots operand")) return 0;
for (k = 0; k < groupDots.length && groupDots.chars[k] != ','; k++)
;
if (k == groupDots.length) {
compileError(file, "Dots operand must consist of two cells separated by a comma");
return 0;
}
groupDots.chars[k] = '-';
if (!parseDots(file, &dotsParsed, &groupDots)) return 0;
if (groupChars.length != 2 || dotsParsed.length != 2) {
compileError(file,
"two Unicode characters and two cells separated by a comma are needed.");
return 0;
}
if (table) {
TranslationTableOffset ruleOffset;
TranslationTableCharacter *charsDotsPtr;
charsDotsPtr = putChar(file, groupChars.chars[0], table, NULL);
charsDotsPtr->attributes |= CTC_Math;
charsDotsPtr = putChar(file, groupChars.chars[1], table, NULL);
charsDotsPtr->attributes |= CTC_Math;
charsDotsPtr = putDots(file, dotsParsed.chars[0], table);
charsDotsPtr->attributes |= CTC_Math;
charsDotsPtr = putDots(file, dotsParsed.chars[1], table);
charsDotsPtr->attributes |= CTC_Math;
if (!addRule(file, CTO_Grouping, &groupChars, &dotsParsed, 0, 0, &ruleOffset,
NULL, noback, nofor, table))
return 0;
if (!addRuleName(file, &name, ruleOffset, *table)) return 0;
}
if (displayTable) {
putCharDotsMapping(file, groupChars.chars[0], dotsParsed.chars[0], displayTable);
putCharDotsMapping(file, groupChars.chars[1], dotsParsed.chars[1], displayTable);
}
if (table) {
widechar endChar;
widechar endDots;
endChar = groupChars.chars[1];
endDots = dotsParsed.chars[1];
groupChars.length = dotsParsed.length = 1;
if (!addRule(file, CTO_Math, &groupChars, &dotsParsed, 0, 0, NULL, NULL, noback,
nofor, table))
return 0;
groupChars.chars[0] = endChar;
dotsParsed.chars[0] = endDots;
if (!addRule(file, CTO_Math, &groupChars, &dotsParsed, 0, 0, NULL, NULL, noback,
nofor, table))
return 0;
}
return 1;
}
| null | null | 482,489
|
184745494045006716627734704064241271128
| 60
|
Prevent an invalid memory writes in compileRule
Thanks to Han Zheng for reporting it
Fixes #1214
|
other
|
linux-2.6
|
9926e4c74300c4b31dee007298c6475d33369df0
| 0
|
static int set_one_prio(struct task_struct *p, int niceval, int error)
{
int no_nice;
if (p->uid != current->euid &&
p->euid != current->euid && !capable(CAP_SYS_NICE)) {
error = -EPERM;
goto out;
}
if (niceval < task_nice(p) && !can_nice(p, niceval)) {
error = -EACCES;
goto out;
}
no_nice = security_task_setnice(p, niceval);
if (no_nice) {
error = no_nice;
goto out;
}
if (error == -ESRCH)
error = 0;
set_user_nice(p, niceval);
out:
return error;
}
|
CWE-20
| null | 487,649
|
175074766187818791589639418717951159110
| 24
|
CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
As discovered here today, the change in Kernel 2.6.17 intended to inhibit
users from setting RLIMIT_CPU to 0 (as that is equivalent to unlimited) by
"cheating" and setting it to 1 in such a case, does not make a difference,
as the check is done in the wrong place (too late), and only applies to the
profiling code.
On all systems I checked running kernels above 2.6.17, no matter what the
hard and soft CPU time limits were before, a user could escape them by
issuing in the shell (sh/bash/zsh) "ulimit -t 0", and then the user's
process was not ever killed.
Attached is a trivial patch to fix that. Simply moving the check to a
slightly earlier location (specifically, before the line that actually
assigns the limit - *old_rlim = new_rlim), does the trick.
Do note that at least the zsh (but not ash, dash, or bash) shell has the
problem of "caching" the limits set by the ulimit command, so when running
zsh the fix will not immediately be evident - after entering "ulimit -t 0",
"ulimit -a" will show "-t: cpu time (seconds) 0", even though the actual
limit as returned by getrlimit(...) will be 1. It can be verified by
opening a subshell (which will not have the values of the parent shell in
cache) and checking in it, or just by running a CPU intensive command like
"echo '65536^1048576' | bc" and verifying that it dumps core after one
second.
Regardless of whether that is a misfeature in the shell, perhaps it would
be better to return -EINVAL from setrlimit in such a case instead of
cheating and setting to 1, as that does not really reflect the actual state
of the process anymore. I do not however know what the ground for that
decision was in the original 2.6.17 change, and whether there would be any
"backward" compatibility issues, so I preferred not to touch that right
now.
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
other
|
openssl
|
cca1cd9a3447dd067503e4a85ebd1679ee78a48e
| 0
|
kssl_TKT2tkt( /* IN */ krb5_context krb5context,
/* IN */ KRB5_TKTBODY *asn1ticket,
/* OUT */ krb5_ticket **krb5ticket,
/* OUT */ KSSL_ERR *kssl_err )
{
krb5_error_code krb5rc = KRB5KRB_ERR_GENERIC;
krb5_ticket *new5ticket = NULL;
ASN1_GENERALSTRING *gstr_svc, *gstr_host;
*krb5ticket = NULL;
if (asn1ticket == NULL || asn1ticket->realm == NULL ||
asn1ticket->sname == NULL ||
sk_ASN1_GENERALSTRING_num(asn1ticket->sname->namestring) < 2)
{
BIO_snprintf(kssl_err->text, KSSL_ERR_MAX,
"Null field in asn1ticket.\n");
kssl_err->reason = SSL_R_KRB5_S_RD_REQ;
return KRB5KRB_ERR_GENERIC;
}
if ((new5ticket = (krb5_ticket *) calloc(1, sizeof(krb5_ticket)))==NULL)
{
BIO_snprintf(kssl_err->text, KSSL_ERR_MAX,
"Unable to allocate new krb5_ticket.\n");
kssl_err->reason = SSL_R_KRB5_S_RD_REQ;
return ENOMEM; /* or KRB5KRB_ERR_GENERIC; */
}
gstr_svc = sk_ASN1_GENERALSTRING_value(asn1ticket->sname->namestring, 0);
gstr_host = sk_ASN1_GENERALSTRING_value(asn1ticket->sname->namestring, 1);
if ((krb5rc = kssl_build_principal_2(krb5context,
&new5ticket->server,
asn1ticket->realm->length, (char *)asn1ticket->realm->data,
gstr_svc->length, (char *)gstr_svc->data,
gstr_host->length, (char *)gstr_host->data)) != 0)
{
free(new5ticket);
BIO_snprintf(kssl_err->text, KSSL_ERR_MAX,
"Error building ticket server principal.\n");
kssl_err->reason = SSL_R_KRB5_S_RD_REQ;
return krb5rc; /* or KRB5KRB_ERR_GENERIC; */
}
krb5_princ_type(krb5context, new5ticket->server) =
asn1ticket->sname->nametype->data[0];
new5ticket->enc_part.enctype = asn1ticket->encdata->etype->data[0];
new5ticket->enc_part.kvno = asn1ticket->encdata->kvno->data[0];
new5ticket->enc_part.ciphertext.length =
asn1ticket->encdata->cipher->length;
if ((new5ticket->enc_part.ciphertext.data =
calloc(1, asn1ticket->encdata->cipher->length)) == NULL)
{
free(new5ticket);
BIO_snprintf(kssl_err->text, KSSL_ERR_MAX,
"Error allocating cipher in krb5ticket.\n");
kssl_err->reason = SSL_R_KRB5_S_RD_REQ;
return KRB5KRB_ERR_GENERIC;
}
else
{
memcpy(new5ticket->enc_part.ciphertext.data,
asn1ticket->encdata->cipher->data,
asn1ticket->encdata->cipher->length);
}
*krb5ticket = new5ticket;
return 0;
}
|
CWE-20
| null | 500,056
|
16422261560787497011814600734339799474
| 70
|
Submitted by: Tomas Hoger <[email protected]>
Fix for CVE-2010-0433 where some kerberos enabled versions of OpenSSL
could be crashed if the relevant tables were not present (e.g. chrooted).
|
other
|
openssl
|
cca1cd9a3447dd067503e4a85ebd1679ee78a48e
| 0
|
print_krb5_authdata(char *label, krb5_authdata **adata)
{
if (adata == NULL)
{
printf("%s, authdata==0\n", label);
return;
}
printf("%s [%p]\n", label, (void *)adata);
#if 0
{
int i;
printf("%s[at%d:%d] ", label, adata->ad_type, adata->length);
for (i=0; i < adata->length; i++)
{
printf((isprint(adata->contents[i]))? "%c ": "%02x",
adata->contents[i]);
}
printf("\n");
}
#endif
}
|
CWE-20
| null | 500,075
|
183101211022783597999868632812091193726
| 21
|
Submitted by: Tomas Hoger <[email protected]>
Fix for CVE-2010-0433 where some kerberos enabled versions of OpenSSL
could be crashed if the relevant tables were not present (e.g. chrooted).
|
other
|
core
|
69ad3c902ea4bbf9f21ab1857d8923f975dc6145
| 0
|
rpa_read_buffer(pool_t pool, const unsigned char **data,
const unsigned char *end, unsigned char **buffer)
{
const unsigned char *p = *data;
unsigned int len;
if (p > end)
return 0;
len = *p++;
if (p + len > end || len == 0)
return 0;
*buffer = p_malloc(pool, len);
memcpy(*buffer, p, len);
*data += 1 + len;
return len;
}
|
CWE-125
| null | 506,428
|
339411141889199958173804859413175563009
| 20
|
auth: mech-rpa - Fail on zero len buffer
|
other
|
server
|
0168d1eda30dad4b517659422e347175eb89e923
| 0
|
void promote_select_describe_flag_if_needed(LEX *lex)
{
if (lex->describe)
{
lex->select_lex.options |= SELECT_DESCRIBE;
}
}
| null | 508,380
|
44316068689065413397010145560216090514
| 7
|
MDEV-25766 Unused CTE lead to a crash in find_field_in_tables/find_order_in_list
Do not assume that subquery Item always present.
|
other
|
|
server
|
0168d1eda30dad4b517659422e347175eb89e923
| 0
|
Field *find_field_in_table_sef(TABLE *table, const char *name)
{
Field **field_ptr;
if (table->s->name_hash.records)
{
field_ptr= (Field**)my_hash_search(&table->s->name_hash,(uchar*) name,
strlen(name));
if (field_ptr)
{
/*
field_ptr points to field in TABLE_SHARE. Convert it to the matching
field in table
*/
field_ptr= (table->field + (field_ptr - table->s->field));
}
}
else
{
if (!(field_ptr= table->field))
return (Field *)0;
for (; *field_ptr; ++field_ptr)
if (!my_strcasecmp(system_charset_info, (*field_ptr)->field_name, name))
break;
}
if (field_ptr)
return *field_ptr;
else
return (Field *)0;
}
| null | 508,409
|
34330718272183626264179761641215101680
| 29
|
MDEV-25766 Unused CTE lead to a crash in find_field_in_tables/find_order_in_list
Do not assume that subquery Item always present.
|
other
|
|
server
|
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
| 0
|
Item_date_literal_for_invalid_dates(THD *thd, const Date *ltime)
:Item_date_literal(thd, ltime)
{
maybe_null= false;
}
|
CWE-617
| null | 512,516
|
54308002906361432365810863007565647826
| 5
|
MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order...
When doing condition pushdown from HAVING into WHERE,
Item_equal::create_pushable_equalities() calls
item->set_extraction_flag(IMMUTABLE_FL) for constant items.
Then, Item::cleanup_excluding_immutables_processor() checks for this flag
to see if it should call item->cleanup() or leave the item as-is.
The failure happens when a constant item has a non-constant one inside it,
like:
(tbl.col=0 AND impossible_cond)
item->walk(cleanup_excluding_immutables_processor) works in a bottom-up
way so it
1. will call Item_func_eq(tbl.col=0)->cleanup()
2. will not call Item_cond_and->cleanup (as the AND is constant)
This creates an item tree where a fixed Item has an un-fixed Item inside
it which eventually causes an assertion failure.
Fixed by introducing this rule: instead of just calling
item->set_extraction_flag(IMMUTABLE_FL);
we call Item::walk() to set the flag for all sub-items of the item.
|
other
|
server
|
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
| 0
|
const Type_handler *type_handler() const
{
return Type_handler::get_handler_by_field_type(int_field_type);
}
|
CWE-617
| null | 512,670
|
320212748104616102966869388990600827457
| 4
|
MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order...
When doing condition pushdown from HAVING into WHERE,
Item_equal::create_pushable_equalities() calls
item->set_extraction_flag(IMMUTABLE_FL) for constant items.
Then, Item::cleanup_excluding_immutables_processor() checks for this flag
to see if it should call item->cleanup() or leave the item as-is.
The failure happens when a constant item has a non-constant one inside it,
like:
(tbl.col=0 AND impossible_cond)
item->walk(cleanup_excluding_immutables_processor) works in a bottom-up
way so it
1. will call Item_func_eq(tbl.col=0)->cleanup()
2. will not call Item_cond_and->cleanup (as the AND is constant)
This creates an item tree where a fixed Item has an un-fixed Item inside
it which eventually causes an assertion failure.
Fixed by introducing this rule: instead of just calling
item->set_extraction_flag(IMMUTABLE_FL);
we call Item::walk() to set the flag for all sub-items of the item.
|
other
|
server
|
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
| 0
|
Item_bool_rowready_func2* Eq_creator::create_swap(THD *thd, Item *a, Item *b) const
{
return new(thd->mem_root) Item_func_eq(thd, b, a);
}
|
CWE-617
| null | 512,983
|
286250761033775663381012619805177298974
| 4
|
MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order...
When doing condition pushdown from HAVING into WHERE,
Item_equal::create_pushable_equalities() calls
item->set_extraction_flag(IMMUTABLE_FL) for constant items.
Then, Item::cleanup_excluding_immutables_processor() checks for this flag
to see if it should call item->cleanup() or leave the item as-is.
The failure happens when a constant item has a non-constant one inside it,
like:
(tbl.col=0 AND impossible_cond)
item->walk(cleanup_excluding_immutables_processor) works in a bottom-up
way so it
1. will call Item_func_eq(tbl.col=0)->cleanup()
2. will not call Item_cond_and->cleanup (as the AND is constant)
This creates an item tree where a fixed Item has an un-fixed Item inside
it which eventually causes an assertion failure.
Fixed by introducing this rule: instead of just calling
item->set_extraction_flag(IMMUTABLE_FL);
we call Item::walk() to set the flag for all sub-items of the item.
|
other
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.