func
stringlengths 0
484k
| target
int64 0
1
| cwe
listlengths 0
4
| project
stringclasses 799
values | commit_id
stringlengths 40
40
| hash
float64 1,215,700,430,453,689,100,000,000B
340,281,914,521,452,260,000,000,000,000B
| size
int64 1
24k
| message
stringlengths 0
13.3k
|
---|---|---|---|---|---|---|---|
vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)
{
unsigned int i;
for (i = 0; i < state->user_state.bo_count; i++)
drm_gem_object_unreference_unlocked(state->bo[i]);
kfree(state);
}
| 0 |
[
"CWE-190",
"CWE-703"
] |
linux
|
0f2ff82e11c86c05d051cae32b58226392d33bbf
| 311,419,608,306,312,670,000,000,000,000,000,000,000 | 9 |
drm/vc4: Fix an integer overflow in temporary allocation layout.
We copy the unvalidated ioctl arguments from the user into kernel
temporary memory to run the validation from, to avoid a race where the
user updates the unvalidate contents in between validating them and
copying them into the validated BO.
However, in setting up the layout of the kernel side, we failed to
check one of the additions (the roundup() for shader_rec_offset)
against integer overflow, allowing a nearly MAX_UINT value of
bin_cl_size to cause us to under-allocate the temporary space that we
then copy_from_user into.
Reported-by: Murray McAllister <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
|
vrend_copy_sub_image(struct vrend_resource* src_res, struct vrend_resource * dst_res,
uint32_t src_level, const struct pipe_box *src_box,
uint32_t dst_level, uint32_t dstx, uint32_t dsty, uint32_t dstz)
{
GLenum src_target = tgsitargettogltarget(src_res->base.target, src_res->base.nr_samples);
GLenum dst_target = tgsitargettogltarget(dst_res->base.target, dst_res->base.nr_samples);
if (vrend_state.use_gles) {
src_target = translate_gles_emulation_texture_target(src_target);
dst_target = translate_gles_emulation_texture_target(dst_target);
}
glCopyImageSubData(src_res->id, src_target, src_level,
src_box->x, src_box->y, src_box->z,
dst_res->id, dst_target, dst_level,
dstx, dsty, dstz,
src_box->width, src_box->height,src_box->depth);
}
| 0 |
[
"CWE-787"
] |
virglrenderer
|
cbc8d8b75be360236cada63784046688aeb6d921
| 315,115,952,513,215,840,000,000,000,000,000,000,000 | 19 |
vrend: check transfer bounds for negative values too and report error
Closes #138
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
|
rfbSendBell(rfbScreenInfoPtr rfbScreen)
{
rfbClientIteratorPtr i;
rfbClientPtr cl;
rfbBellMsg b;
i = rfbGetClientIterator(rfbScreen);
while((cl=rfbClientIteratorNext(i))) {
b.type = rfbBell;
LOCK(cl->sendMutex);
if (rfbWriteExact(cl, (char *)&b, sz_rfbBellMsg) < 0) {
rfbLogPerror("rfbSendBell: write");
rfbCloseClient(cl);
}
UNLOCK(cl->sendMutex);
}
rfbStatRecordMessageSent(cl, rfbBell, sz_rfbBellMsg, sz_rfbBellMsg);
rfbReleaseClientIterator(i);
}
| 0 |
[] |
libvncserver
|
804335f9d296440bb708ca844f5d89b58b50b0c6
| 211,523,163,006,059,300,000,000,000,000,000,000,000 | 19 |
Thread safety for zrle, zlib, tight.
Proposed tight security type fix for debian bug 517422.
|
int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enhance)
{
struct sk_buff *skb;
struct wmi_sta_bmiss_enhance_cmd *cmd;
int ret;
skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
if (!skb)
return -ENOMEM;
cmd = (struct wmi_sta_bmiss_enhance_cmd *) skb->data;
cmd->enable = enhance ? 1 : 0;
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb,
WMI_STA_BMISS_ENHANCE_CMDID,
NO_SYNC_WMIFLAG);
return ret;
}
| 0 |
[
"CWE-125"
] |
linux
|
5d6751eaff672ea77642e74e92e6c0ac7f9709ab
| 200,863,343,444,565,850,000,000,000,000,000,000,000 | 18 |
ath6kl: add some bounds checking
The "ev->traffic_class" and "reply->ac" variables come from the network
and they're used as an offset into the wmi->stream_exist_for_ac[] array.
Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[]
array only has WMM_NUM_AC (4) elements. We need to add a couple bounds
checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to
"if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
Fixes: bdcd81707973 (" Add ath6kl cleaned up driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
|
int line6_probe(struct usb_interface *interface,
const struct usb_device_id *id,
const char *driver_name,
const struct line6_properties *properties,
int (*private_init)(struct usb_line6 *, const struct usb_device_id *id),
size_t data_size)
{
struct usb_device *usbdev = interface_to_usbdev(interface);
struct snd_card *card;
struct usb_line6 *line6;
int interface_number;
int ret;
if (WARN_ON(data_size < sizeof(*line6)))
return -EINVAL;
/* we don't handle multiple configurations */
if (usbdev->descriptor.bNumConfigurations != 1)
return -ENODEV;
ret = snd_card_new(&interface->dev,
SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, data_size, &card);
if (ret < 0)
return ret;
/* store basic data: */
line6 = card->private_data;
line6->card = card;
line6->properties = properties;
line6->usbdev = usbdev;
line6->ifcdev = &interface->dev;
strcpy(card->id, properties->id);
strcpy(card->driver, driver_name);
strcpy(card->shortname, properties->name);
sprintf(card->longname, "Line 6 %s at USB %s", properties->name,
dev_name(line6->ifcdev));
card->private_free = line6_destruct;
usb_set_intfdata(interface, line6);
/* increment reference counters: */
usb_get_dev(usbdev);
/* initialize device info: */
dev_info(&interface->dev, "Line 6 %s found\n", properties->name);
/* query interface number */
interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
/* TODO reserves the bus bandwidth even without actual transfer */
ret = usb_set_interface(usbdev, interface_number,
properties->altsetting);
if (ret < 0) {
dev_err(&interface->dev, "set_interface failed\n");
goto error;
}
line6_get_usb_properties(line6);
if (properties->capabilities & LINE6_CAP_CONTROL) {
ret = line6_init_cap_control(line6);
if (ret < 0)
goto error;
}
/* initialize device data based on device: */
ret = private_init(line6, id);
if (ret < 0)
goto error;
/* creation of additional special files should go here */
dev_info(&interface->dev, "Line 6 %s now attached\n",
properties->name);
return 0;
error:
/* we can call disconnect callback here because no close-sync is
* needed yet at this point
*/
line6_disconnect(interface);
return ret;
}
| 1 |
[
"CWE-476"
] |
linux
|
0b074ab7fc0d575247b9cc9f93bb7e007ca38840
| 106,889,145,437,579,570,000,000,000,000,000,000,000 | 86 |
ALSA: line6: Assure canceling delayed work at disconnection
The current code performs the cancel of a delayed work at the late
stage of disconnection procedure, which may lead to the access to the
already cleared state.
This patch assures to call cancel_delayed_work_sync() at the beginning
of the disconnection procedure for avoiding that race. The delayed
work object is now assigned in the common line6 object instead of its
derivative, so that we can call cancel_delayed_work_sync().
Along with the change, the startup function is called via the new
callback instead. This will make it easier to port other LINE6
drivers to use the delayed work for startup in later patches.
Reported-by: [email protected]
Fixes: 7f84ff68be05 ("ALSA: line6: toneport: Fix broken usage of timer for delayed execution")
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
|
unsigned int timespec_sub_ms(struct timespec *a, struct timespec *b)
{
time_t dsecs;
dsecs = a->tv_sec - b->tv_sec;
if (!INT_MULTIPLY_OVERFLOW(dsecs, 1000)) {
return (dsecs*1000 + (a->tv_nsec - b->tv_nsec) / (1000 * 1000));
} else {
return UINT_MAX;
}
}
| 0 |
[
"CWE-400"
] |
gnutls
|
1ffb827e45721ef56982d0ffd5c5de52376c428e
| 129,815,505,940,342,470,000,000,000,000,000,000,000 | 11 |
handshake: set a maximum number of warning messages that can be received per handshake
That is to avoid DoS due to the assymetry of cost of sending an alert vs the cost
of processing.
|
static inline void restore_sprs(struct thread_struct *old_thread,
struct thread_struct *new_thread)
{
#ifdef CONFIG_ALTIVEC
if (cpu_has_feature(CPU_FTR_ALTIVEC) &&
old_thread->vrsave != new_thread->vrsave)
mtspr(SPRN_VRSAVE, new_thread->vrsave);
#endif
#ifdef CONFIG_PPC_BOOK3S_64
if (cpu_has_feature(CPU_FTR_DSCR)) {
u64 dscr = get_paca()->dscr_default;
if (new_thread->dscr_inherit)
dscr = new_thread->dscr;
if (old_thread->dscr != dscr)
mtspr(SPRN_DSCR, dscr);
}
if (cpu_has_feature(CPU_FTR_ARCH_207S)) {
if (old_thread->bescr != new_thread->bescr)
mtspr(SPRN_BESCR, new_thread->bescr);
if (old_thread->ebbhr != new_thread->ebbhr)
mtspr(SPRN_EBBHR, new_thread->ebbhr);
if (old_thread->ebbrr != new_thread->ebbrr)
mtspr(SPRN_EBBRR, new_thread->ebbrr);
if (old_thread->fscr != new_thread->fscr)
mtspr(SPRN_FSCR, new_thread->fscr);
if (old_thread->tar != new_thread->tar)
mtspr(SPRN_TAR, new_thread->tar);
}
if (cpu_has_feature(CPU_FTR_ARCH_300)) {
/* Conditionally restore Load Monitor registers, if enabled */
if (new_thread->fscr & FSCR_LM) {
if (old_thread->lmrr != new_thread->lmrr)
mtspr(SPRN_LMRR, new_thread->lmrr);
if (old_thread->lmser != new_thread->lmser)
mtspr(SPRN_LMSER, new_thread->lmser);
}
}
#endif
}
| 0 |
[] |
linux
|
5d176f751ee3c6eededd984ad409bff201f436a7
| 293,311,047,404,661,500,000,000,000,000,000,000,000 | 44 |
powerpc: tm: Enable transactional memory (TM) lazily for userspace
Currently the MSR TM bit is always set if the hardware is TM capable.
This adds extra overhead as it means the TM SPRS (TFHAR, TEXASR and
TFAIR) must be swapped for each process regardless of if they use TM.
For processes that don't use TM the TM MSR bit can be turned off
allowing the kernel to avoid the expensive swap of the TM registers.
A TM unavailable exception will occur if a thread does use TM and the
kernel will enable MSR_TM and leave it so for some time afterwards.
Signed-off-by: Cyril Bur <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
|
static u32 tg3_irq_count(struct tg3 *tp)
{
u32 irq_cnt = max(tp->rxq_cnt, tp->txq_cnt);
if (irq_cnt > 1) {
/* We want as many rx rings enabled as there are cpus.
* In multiqueue MSI-X mode, the first MSI-X vector
* only deals with link interrupts, etc, so we add
* one to the number of vectors we are requesting.
*/
irq_cnt = min_t(unsigned, irq_cnt + 1, tp->irq_max);
}
return irq_cnt;
}
| 0 |
[
"CWE-476",
"CWE-119"
] |
linux
|
715230a44310a8cf66fbfb5a46f9a62a9b2de424
| 202,077,789,408,448,120,000,000,000,000,000,000,000 | 15 |
tg3: fix length overflow in VPD firmware parsing
Commit 184b89044fb6e2a74611dafa69b1dce0d98612c6 ("tg3: Use VPD fw version
when present") introduced VPD parsing that contained a potential length
overflow.
Limit the hardware's reported firmware string length (max 255 bytes) to
stay inside the driver's firmware string length (32 bytes). On overflow,
truncate the formatted firmware string instead of potentially overwriting
portions of the tg3 struct.
http://cansecwest.com/slides/2013/PrivateCore%20CSW%202013.pdf
Signed-off-by: Kees Cook <[email protected]>
Reported-by: Oded Horovitz <[email protected]>
Reported-by: Brad Spengler <[email protected]>
Cc: [email protected]
Cc: Matt Carlson <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
TEST(SimpleRegexTest, RootedComplex) {
auto testIndex = buildSimpleIndexEntry();
IndexBoundsBuilder::BoundsTightness tightness;
std::string prefix = IndexBoundsBuilder::simpleRegex(
"\\Af \t\vo\n\ro \\ \\# #comment", "mx", testIndex, &tightness);
ASSERT_EQUALS(prefix, "foo #");
ASSERT_EQUALS(tightness, IndexBoundsBuilder::INEXACT_COVERED);
}
| 0 |
[
"CWE-754"
] |
mongo
|
f8f55e1825ee5c7bdb3208fc7c5b54321d172732
| 270,066,066,002,811,700,000,000,000,000,000,000,000 | 8 |
SERVER-44377 generate correct plan for indexed inequalities to null
|
static MagickBooleanType GetXMPProperty(const Image *image,const char *property)
{
char
*xmp_profile;
const char
*content;
const StringInfo
*profile;
ExceptionInfo
*exception;
MagickBooleanType
status;
register const char
*p;
XMLTreeInfo
*child,
*description,
*node,
*rdf,
*xmp;
profile=GetImageProfile(image,"xmp");
if (profile == (StringInfo *) NULL)
return(MagickFalse);
if ((property == (const char *) NULL) || (*property == '\0'))
return(MagickFalse);
xmp_profile=StringInfoToString(profile);
if (xmp_profile == (char *) NULL)
return(MagickFalse);
for (p=xmp_profile; *p != '\0'; p++)
if ((*p == '<') && (*(p+1) == 'x'))
break;
exception=AcquireExceptionInfo();
xmp=NewXMLTree((char *) p,exception);
xmp_profile=DestroyString(xmp_profile);
exception=DestroyExceptionInfo(exception);
if (xmp == (XMLTreeInfo *) NULL)
return(MagickFalse);
status=MagickFalse;
rdf=GetXMLTreeChild(xmp,"rdf:RDF");
if (rdf != (XMLTreeInfo *) NULL)
{
if (image->properties == (void *) NULL)
((Image *) image)->properties=NewSplayTree(CompareSplayTreeString,
RelinquishMagickMemory,RelinquishMagickMemory);
description=GetXMLTreeChild(rdf,"rdf:Description");
while (description != (XMLTreeInfo *) NULL)
{
node=GetXMLTreeChild(description,(const char *) NULL);
while (node != (XMLTreeInfo *) NULL)
{
child=GetXMLTreeChild(node,(const char *) NULL);
content=GetXMLTreeContent(node);
if ((child == (XMLTreeInfo *) NULL) &&
(SkipXMPValue(content) == MagickFalse))
(void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
ConstantString(GetXMLTreeTag(node)),ConstantString(content));
while (child != (XMLTreeInfo *) NULL)
{
content=GetXMLTreeContent(child);
if (SkipXMPValue(content) == MagickFalse)
(void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
ConstantString(GetXMLTreeTag(child)),ConstantString(content));
child=GetXMLTreeSibling(child);
}
node=GetXMLTreeSibling(node);
}
description=GetNextXMLTreeTag(description);
}
}
xmp=DestroyXMLTree(xmp);
return(status);
}
| 0 |
[
"CWE-190",
"CWE-125"
] |
ImageMagick
|
d8ab7f046587f2e9f734b687ba7e6e10147c294b
| 276,707,885,210,142,150,000,000,000,000,000,000,000 | 79 |
Improve checking of EXIF profile to prevent integer overflow (bug report from Ibrahim el-sayed)
|
void mdesc_register_notifier(struct mdesc_notifier_client *client)
{
bool supported = false;
u64 node;
int i;
mutex_lock(&mdesc_mutex);
/* check to see if the node is supported for registration */
for (i = 0; md_node_ops_table[i].name != NULL; i++) {
if (strcmp(md_node_ops_table[i].name, client->node_name) == 0) {
supported = true;
break;
}
}
if (!supported) {
pr_err("MD: %s node not supported\n", client->node_name);
mutex_unlock(&mdesc_mutex);
return;
}
client->next = client_list;
client_list = client;
mdesc_for_each_node_by_name(cur_mdesc, node, client->node_name)
client->add(cur_mdesc, node, client->node_name);
mutex_unlock(&mdesc_mutex);
}
| 0 |
[
"CWE-476"
] |
sparc
|
80caf43549e7e41a695c6d1e11066286538b336f
| 89,099,797,485,335,650,000,000,000,000,000,000,000 | 30 |
mdesc: fix a missing-check bug in get_vdev_port_node_info()
In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated
by kstrdup_const(), and it returns NULL when fails. So
'node_info->vdev_port.name' should be checked.
Signed-off-by: Gen Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static int match_endpoint_audioformats(struct snd_usb_substream *subs,
struct audioformat *fp,
struct audioformat *match, int rate,
snd_pcm_format_t pcm_format)
{
int i;
int score = 0;
if (fp->channels < 1) {
dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no channels\n", __func__, fp);
return 0;
}
if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no match for format %d\n", __func__,
fp, pcm_format);
return 0;
}
for (i = 0; i < fp->nr_rates; i++) {
if (fp->rate_table[i] == rate) {
score++;
break;
}
}
if (!score) {
dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) no match for rate %d\n", __func__,
fp, rate);
return 0;
}
if (fp->channels == match->channels)
score++;
dev_dbg(&subs->dev->dev,
"%s: (fmt @%p) score %d\n", __func__, fp, score);
return score;
}
| 0 |
[] |
sound
|
447d6275f0c21f6cc97a88b3a0c601436a4cdf2a
| 29,080,296,645,580,690,000,000,000,000,000,000,000 | 42 |
ALSA: usb-audio: Add sanity checks for endpoint accesses
Add some sanity check codes before actually accessing the endpoint via
get_endpoint() in order to avoid the invalid access through a
malformed USB descriptor. Mostly just checking bNumEndpoints, but in
one place (snd_microii_spdif_default_get()), the validity of iface and
altsetting index is checked as well.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
|
void dump_xml(Formatter *f) const {
encode_xml("Key", key, f);
encode_xml("Value", value, f);
}
| 0 |
[
"CWE-79"
] |
ceph
|
8f90658c731499722d5f4393c8ad70b971d05f77
| 37,239,653,456,742,540,000,000,000,000,000,000,000 | 4 |
rgw: reject unauthenticated response-header actions
Signed-off-by: Matt Benjamin <[email protected]>
Reviewed-by: Casey Bodley <[email protected]>
(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)
|
innodb_conn_init(
/*=============*/
innodb_engine_t* engine, /*!< in/out: InnoDB memcached
engine */
const void* cookie, /*!< in: This connection's
cookie */
int conn_option, /*!< in: whether it is
for read or write operation*/
ib_lck_mode_t lock_mode, /*!< in: Table lock mode */
bool has_lock, /*!< in: Has engine mutex */
meta_cfg_info_t* new_meta_info) /*!< in: meta info for
table to open or NULL */
{
innodb_conn_data_t* conn_data;
meta_cfg_info_t* meta_info;
meta_index_t* meta_index;
ib_err_t err = DB_SUCCESS;
ib_crsr_t crsr;
ib_crsr_t read_crsr;
ib_crsr_t idx_crsr;
bool trx_updated = false;
/* Get this connection's conn_data */
conn_data = engine->server.cookie->get_engine_specific(cookie);
assert(!conn_data || !conn_data->in_use);
if (!conn_data) {
LOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
conn_data = engine->server.cookie->get_engine_specific(cookie);
if (conn_data) {
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
goto have_conn;
}
if (UT_LIST_GET_LEN(engine->conn_data) > 2048) {
/* Some of conn_data can be stale, recycle them */
innodb_conn_clean(engine, false, true);
}
conn_data = malloc(sizeof(*conn_data));
if (!conn_data) {
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
return(NULL);
}
memset(conn_data, 0, sizeof(*conn_data));
conn_data->result = malloc(sizeof(mci_item_t));
if (!conn_data->result) {
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
free(conn_data);
conn_data = NULL;
return(NULL);
}
conn_data->conn_meta = new_meta_info
? new_meta_info
: engine->meta_info;
conn_data->row_buf = malloc(1024);
if (!conn_data->row_buf) {
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
free(conn_data->result);
free(conn_data);
conn_data = NULL;
return(NULL);
}
conn_data->row_buf_len = 1024;
conn_data->cmd_buf = malloc(1024);
if (!conn_data->cmd_buf) {
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
free(conn_data->row_buf);
free(conn_data->result);
free(conn_data);
conn_data = NULL;
return(NULL);
}
conn_data->cmd_buf_len = 1024;
conn_data->is_flushing = false;
conn_data->conn_cookie = (void*) cookie;
/* Add connection to the list after all memory allocations */
UT_LIST_ADD_LAST(conn_list, engine->conn_data, conn_data);
engine->server.cookie->store_engine_specific(
cookie, conn_data);
pthread_mutex_init(&conn_data->curr_conn_mutex, NULL);
UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine);
}
have_conn:
meta_info = conn_data->conn_meta;
meta_index = &meta_info->index_info;
assert(engine->conn_data.count > 0);
if (conn_option == CONN_MODE_NONE) {
return(conn_data);
}
LOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn_data);
/* If flush is running, then wait for it complete. */
if (conn_data->is_flushing) {
/* Request flush_mutex for waiting for flush
completed. */
pthread_mutex_lock(&engine->flush_mutex);
pthread_mutex_unlock(&engine->flush_mutex);
}
/* This special case added to facilitate unlocking
of MDL lock during FLUSH TABLE WITH READ LOCK */
if (engine &&
release_mdl_lock &&
(engine->enable_binlog || engine->enable_mdl)) {
if ( DB_SUCCESS !=
innodb_open_mysql_table(conn_data,
conn_option,
engine)){
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return NULL;
}
}
conn_data->in_use = true;
crsr = conn_data->crsr;
read_crsr = conn_data->read_crsr;
if (lock_mode == IB_LOCK_TABLE_X) {
if(!conn_data->crsr_trx) {
conn_data->crsr_trx = ib_cb_trx_begin(
engine->trx_level, true, false);
} else {
/* Write cursor transaction exists.
Reuse this transaction.*/
if (ib_cb_trx_read_only(conn_data->crsr_trx)) {
innodb_cb_trx_commit(
conn_data->crsr_trx);
}
err = ib_cb_trx_start(conn_data->crsr_trx,
engine->trx_level,
true, false, NULL);
assert(err == DB_SUCCESS);
}
err = innodb_api_begin(
engine,
meta_info->col_info[CONTAINER_DB].col_name,
meta_info->col_info[CONTAINER_TABLE].col_name,
conn_data, conn_data->crsr_trx,
&conn_data->crsr, &conn_data->idx_crsr,
lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->crsr);
conn_data->crsr = NULL;
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn_data);
return(conn_data);
}
/* Write operation */
if (conn_option == CONN_MODE_WRITE) {
if (!crsr) {
if (!conn_data->crsr_trx) {
conn_data->crsr_trx = ib_cb_trx_begin(
engine->trx_level, true, false);
trx_updated = true;
} else {
if (ib_cb_trx_read_only(conn_data->crsr_trx)) {
innodb_cb_trx_commit(
conn_data->crsr_trx);
}
ib_cb_trx_start(conn_data->crsr_trx,
engine->trx_level,
true, false, NULL);
}
err = innodb_api_begin(
engine,
meta_info->col_info[CONTAINER_DB].col_name,
meta_info->col_info[CONTAINER_TABLE].col_name,
conn_data, conn_data->crsr_trx,
&conn_data->crsr, &conn_data->idx_crsr,
lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->crsr);
conn_data->crsr = NULL;
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
} else if (!conn_data->crsr_trx) {
/* There exists a cursor, just need update
with a new transaction */
conn_data->crsr_trx = ib_cb_trx_begin(
engine->trx_level, true, false);
innodb_cb_cursor_new_trx(crsr, conn_data->crsr_trx);
trx_updated = true;
err = innodb_cb_cursor_lock(engine, crsr, lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->crsr);
conn_data->crsr = NULL;
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
if (meta_index->srch_use_idx == META_USE_SECONDARY) {
idx_crsr = conn_data->idx_crsr;
innodb_cb_cursor_new_trx(
idx_crsr, conn_data->crsr_trx);
innodb_cb_cursor_lock(
engine, idx_crsr, lock_mode);
}
} else {
if (ib_cb_trx_read_only(conn_data->crsr_trx)) {
innodb_cb_trx_commit(
conn_data->crsr_trx);
}
ib_cb_trx_start(conn_data->crsr_trx,
engine->trx_level,
true, false, NULL);
ib_cb_cursor_stmt_begin(crsr);
err = innodb_cb_cursor_lock(engine, crsr, lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->crsr);
conn_data->crsr = NULL;
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
}
if (trx_updated) {
if (conn_data->read_crsr) {
innodb_cb_cursor_new_trx(
conn_data->read_crsr,
conn_data->crsr_trx);
}
if (conn_data->idx_read_crsr) {
innodb_cb_cursor_new_trx(
conn_data->idx_read_crsr,
conn_data->crsr_trx);
}
}
} else {
assert(conn_option == CONN_MODE_READ);
if (!read_crsr) {
if (!conn_data->crsr_trx) {
/* This is read operation, start a trx
with "read_write" parameter set to false */
conn_data->crsr_trx = ib_cb_trx_begin(
engine->trx_level, false,
engine->read_batch_size == 1);
trx_updated = true;
} else {
ib_cb_trx_start(conn_data->crsr_trx,
engine->trx_level,
false,
engine->read_batch_size == 1,
NULL);
}
err = innodb_api_begin(
engine,
meta_info->col_info[CONTAINER_DB].col_name,
meta_info->col_info[CONTAINER_TABLE].col_name,
conn_data,
conn_data->crsr_trx,
&conn_data->read_crsr,
&conn_data->idx_read_crsr,
lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->read_crsr);
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->read_crsr = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
} else if (!conn_data->crsr_trx) {
/* This is read operation, start a trx
with "read_write" parameter set to false */
conn_data->crsr_trx = ib_cb_trx_begin(
engine->trx_level, false,
engine->read_batch_size == 1);
trx_updated = true;
innodb_cb_cursor_new_trx(
conn_data->read_crsr,
conn_data->crsr_trx);
if (conn_data->crsr) {
innodb_cb_cursor_new_trx(
conn_data->crsr,
conn_data->crsr_trx);
}
err = innodb_cb_cursor_lock(
engine, conn_data->read_crsr, lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->read_crsr);
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->read_crsr = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
if (meta_index->srch_use_idx == META_USE_SECONDARY) {
ib_crsr_t idx_crsr = conn_data->idx_read_crsr;
innodb_cb_cursor_new_trx(
idx_crsr, conn_data->crsr_trx);
innodb_cb_cursor_lock(
engine, idx_crsr, lock_mode);
}
} else {
/* This is read operation, start a trx
with "read_write" parameter set to false */
ib_cb_trx_start(conn_data->crsr_trx,
engine->trx_level,
false,
engine->read_batch_size == 1,
NULL);
ib_cb_cursor_stmt_begin(conn_data->read_crsr);
err = innodb_cb_cursor_lock(
engine, conn_data->read_crsr, lock_mode);
if (err != DB_SUCCESS) {
innodb_cb_cursor_close(
conn_data->read_crsr);
innodb_cb_trx_commit(
conn_data->crsr_trx);
err = ib_cb_trx_release(conn_data->crsr_trx);
assert(err == DB_SUCCESS);
conn_data->crsr_trx = NULL;
conn_data->read_crsr = NULL;
conn_data->in_use = false;
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(
has_lock, conn_data);
return(NULL);
}
if (meta_index->srch_use_idx == META_USE_SECONDARY) {
ib_crsr_t idx_crsr = conn_data->idx_read_crsr;
ib_cb_cursor_stmt_begin(idx_crsr);
innodb_cb_cursor_lock(
engine, idx_crsr, lock_mode);
}
}
if (trx_updated) {
if (conn_data->crsr) {
innodb_cb_cursor_new_trx(
conn_data->crsr,
conn_data->crsr_trx);
}
if (conn_data->idx_crsr) {
innodb_cb_cursor_new_trx(
conn_data->idx_crsr,
conn_data->crsr_trx);
}
}
}
UNLOCK_CURRENT_CONN_IF_NOT_LOCKED( has_lock, conn_data);
return(conn_data);
}
| 0 |
[] |
mysql-server
|
659514dc83299a7d8c7defeb543be4339fbe1ee1
| 258,021,350,287,537,400,000,000,000,000,000,000,000 | 445 |
Bug #25147515 SET DAEMON_MEMCACHED_R_BATCH_SIZE GREATER THAN 1 MAKE MYSQLD CRASHED
PROBLEM
-------
User starts a "get" the the connection with SET DAEMON_MEMCACHED_R_BATCH_SIZE= 5
and with binlog on. Since "get" is a read transaction this connection is not
allocated any conn_data->thd (which is used for bin log commit).The connection
is kept open. Innodb background thread tries to commit transactions which have
exceed CONN_IDLE_TIME_TO_BK_COMMIT and whose read batch size > 0, when it finds
this connection it tries to attach conn_data->thd to bin log thread.Since
conn_data->thd is NULL it crashes.
FIX
---
Check conn_data->thd value before attaching it to binlog thread.
|
bool basic_const_item() const { return true; }
| 0 |
[
"CWE-617"
] |
server
|
2e7891080667c59ac80f788eef4d59d447595772
| 714,728,546,035,926,700,000,000,000,000,000,000 | 1 |
MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view
This bug could manifest itself after pushing a where condition over a
mergeable derived table / view / CTE DT into a grouping view / derived
table / CTE V whose item list contained set functions with constant
arguments such as MIN(2), SUM(1) etc. In such cases the field references
used in the condition pushed into the view V that correspond set functions
are wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation
of the virtual method const_item() for the class Item_direct_view_ref the
wrapped set functions with constant arguments could be erroneously taken
for constant items. This could lead to a wrong result set returned by the
main select query in 10.2. In 10.4 where a possibility of pushing condition
from HAVING into WHERE had been added this could cause a crash.
Approved by Sergey Petrunya <[email protected]>
|
CImg<T>& operator%=(const t value) {
if (is_empty()) return *this;
cimg_openmp_for(*this,cimg::mod(*ptr,(T)value),16384);
return *this;
}
| 0 |
[
"CWE-770"
] |
cimg
|
619cb58dd90b4e03ac68286c70ed98acbefd1c90
| 221,514,733,923,831,270,000,000,000,000,000,000,000 | 5 |
CImg<>::load_bmp() and CImg<>::load_pandore(): Check that dimensions encoded in file does not exceed file size.
|
Status AuthorizationManager::getAuthorizationVersion(OperationContext* opCtx, int* version) {
CacheGuard guard(this, CacheGuard::fetchSynchronizationManual);
int newVersion = _version;
if (schemaVersionInvalid == newVersion) {
while (guard.otherUpdateInFetchPhase())
guard.wait();
guard.beginFetchPhase();
Status status = _externalState->getStoredAuthorizationVersion(opCtx, &newVersion);
guard.endFetchPhase();
if (!status.isOK()) {
warning() << "Problem fetching the stored schema version of authorization data: "
<< redact(status);
*version = schemaVersionInvalid;
return status;
}
if (guard.isSameCacheGeneration()) {
_version = newVersion;
}
}
*version = newVersion;
return Status::OK();
}
| 0 |
[
"CWE-613"
] |
mongo
|
db19e7ce84cfd702a4ba9983ee2ea5019f470f82
| 316,381,333,588,581,560,000,000,000,000,000,000,000 | 23 |
SERVER-38984 Validate unique User ID on UserCache hit
(cherry picked from commit e55d6e2292e5dbe2f97153251d8193d1cc89f5d7)
|
int MonConnection::get_auth_request(
uint32_t *method,
std::vector<uint32_t> *preferred_modes,
ceph::buffer::list *bl,
const EntityName& entity_name,
uint32_t want_keys,
RotatingKeyRing* keyring)
{
using ceph::encode;
// choose method
if (auth_method < 0) {
std::vector<uint32_t> as;
auth_registry->get_supported_methods(con->get_peer_type(), &as);
if (as.empty()) {
return -EACCES;
}
auth_method = as.front();
}
*method = auth_method;
auth_registry->get_supported_modes(con->get_peer_type(), auth_method,
preferred_modes);
ldout(cct,10) << __func__ << " method " << *method
<< " preferred_modes " << *preferred_modes << dendl;
if (preferred_modes->empty()) {
return -EACCES;
}
if (auth) {
auth.reset();
}
int r = _init_auth(*method, entity_name, want_keys, keyring, true);
ceph_assert(r == 0);
// initial requset includes some boilerplate...
encode((char)AUTH_MODE_MON, *bl);
encode(entity_name, *bl);
encode(global_id, *bl);
// and (maybe) some method-specific initial payload
auth->build_initial_request(bl);
return 0;
}
| 0 |
[
"CWE-294"
] |
ceph
|
6c14c2fb5650426285428dfe6ca1597e5ea1d07d
| 265,911,168,287,990,930,000,000,000,000,000,000,000 | 43 |
mon/MonClient: bring back CEPHX_V2 authorizer challenges
Commit c58c5754dfd2 ("msg/async/ProtocolV1: use AuthServer and
AuthClient") introduced a backwards compatibility issue into msgr1.
To fix it, commit 321548010578 ("mon/MonClient: skip CEPHX_V2
challenge if client doesn't support it") set out to skip authorizer
challenges for peers that don't support CEPHX_V2. However, it
made it so that authorizer challenges are skipped for all peers in
both msgr1 and msgr2 cases, effectively disabling the protection
against replay attacks that was put in place in commit f80b848d3f83
("auth/cephx: add authorizer challenge", CVE-2018-1128).
This is because con->get_features() always returns 0 at that
point. In msgr1 case, the peer shares its features along with the
authorizer, but while they are available in connect_msg.features they
aren't assigned to con until ProtocolV1::open(). In msgr2 case, the
peer doesn't share its features until much later (in CLIENT_IDENT
frame, i.e. after the authentication phase). The result is that
!CEPHX_V2 branch is taken in all cases and replay attack protection
is lost.
Only clusters with cephx_service_require_version set to 2 on the
service daemons would not be silently downgraded. But, since the
default is 1 and there are no reports of looping on BADAUTHORIZER
faults, I'm pretty sure that no one has ever done that. Note that
cephx_require_version set to 2 would have no effect even though it
is supposed to be stronger than cephx_service_require_version
because MonClient::handle_auth_request() didn't check it.
To fix:
- for msgr1, check connect_msg.features (as was done before commit
c58c5754dfd2) and challenge if CEPHX_V2 is supported. Together
with two preceding patches that resurrect proper cephx_* option
handling in msgr1, this covers both "I want old clients to work"
and "I wish to require better authentication" use cases.
- for msgr2, don't check anything and always challenge. CEPHX_V2
predates msgr2, anyone speaking msgr2 must support it.
Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit 4a82c72e3bdddcb625933e83af8b50a444b961f1)
|
v3d_clean_caches(struct v3d_dev *v3d)
{
struct drm_device *dev = &v3d->drm;
int core = 0;
trace_v3d_cache_clean_begin(dev);
V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF);
if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
V3D_L2TCACTL_L2TFLS), 100)) {
DRM_ERROR("Timeout waiting for L1T write combiner flush\n");
}
mutex_lock(&v3d->cache_clean_lock);
V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL,
V3D_L2TCACTL_L2TFLS |
V3D_SET_FIELD(V3D_L2TCACTL_FLM_CLEAN, V3D_L2TCACTL_FLM));
if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
V3D_L2TCACTL_L2TFLS), 100)) {
DRM_ERROR("Timeout waiting for L2T clean\n");
}
mutex_unlock(&v3d->cache_clean_lock);
trace_v3d_cache_clean_end(dev);
}
| 0 |
[
"CWE-400",
"CWE-401"
] |
linux
|
29cd13cfd7624726d9e6becbae9aa419ef35af7f
| 294,885,139,330,894,340,000,000,000,000,000,000,000 | 27 |
drm/v3d: Fix memory leak in v3d_submit_cl_ioctl
In the impelementation of v3d_submit_cl_ioctl() there are two memory
leaks. One is when allocation for bin fails, and the other is when bin
initialization fails. If kcalloc fails to allocate memory for bin then
render->base should be put. Also, if v3d_job_init() fails to initialize
bin->base then allocated memory for bin should be released.
Fixes: a783a09ee76d ("drm/v3d: Refactor job management.")
Signed-off-by: Navid Emamdoost <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
|
dec_cursor(void)
{
return dec(&curwin->w_cursor);
}
| 0 |
[
"CWE-120"
] |
vim
|
7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97
| 320,715,174,140,011,430,000,000,000,000,000,000,000 | 4 |
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Problem: Changing text in Visual mode may cause invalid memory access.
Solution: Check the Visual position after making a change.
|
int cli_hm_have_size(const struct cli_matcher *root, enum CLI_HASH_TYPE type, uint32_t size) {
return (size && size != 0xffffffff && root && root->hm.sizehashes[type].capacity && cli_htu32_find(&root->hm.sizehashes[type], size));
}
| 0 |
[
"CWE-189"
] |
clamav-devel
|
4842733eb3f09be61caeed83778bb6679141dbc5
| 306,668,707,218,032,400,000,000,000,000,000,000,000 | 3 |
bb#2818
|
void FoFiTrueType::cvtCharStrings(char **encoding,
int *codeToGID,
FoFiOutputFunc outputFunc,
void *outputStream) {
char *name;
GooString *buf;
char buf2[16];
int i, k;
// always define '.notdef'
(*outputFunc)(outputStream, "/CharStrings 256 dict dup begin\n", 32);
(*outputFunc)(outputStream, "/.notdef 0 def\n", 15);
// if there's no 'cmap' table, punt
if (nCmaps == 0) {
goto err;
}
// map char name to glyph index:
// 1. use encoding to map name to char code
// 2. use codeToGID to map char code to glyph index
// N.B. We do this in reverse order because font subsets can have
// weird encodings that use the same character name twice, and
// the first definition is probably the one we want.
k = 0; // make gcc happy
for (i = 255; i >= 0; --i) {
if (encoding) {
name = encoding[i];
} else {
sprintf(buf2, "c%02x", i);
name = buf2;
}
if (name && strcmp(name, ".notdef")) {
k = codeToGID[i];
// note: Distiller (maybe Adobe's PS interpreter in general)
// doesn't like TrueType fonts that have CharStrings entries
// which point to nonexistent glyphs, hence the (k < nGlyphs)
// test
if (k > 0 && k < nGlyphs) {
(*outputFunc)(outputStream, "/", 1);
(*outputFunc)(outputStream, name, strlen(name));
buf = GooString::format(" {0:d} def\n", k);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
delete buf;
}
}
}
err:
(*outputFunc)(outputStream, "end readonly def\n", 17);
}
| 0 |
[
"CWE-125"
] |
poppler
|
cdb7ad95f7c8fbf63ade040d8a07ec96467042fc
| 183,908,902,454,750,100,000,000,000,000,000,000,000 | 51 |
Fix malformed file crash in bug #85243
|
plan_a (char const *filename)
{
char const *s;
char const *lim;
char const **ptr;
char *buffer;
lin iline;
size_t size = instat.st_size;
/* Fail if the file size doesn't fit in a size_t,
or if storage isn't available. */
if (! (size == instat.st_size
&& (buffer = malloc (size ? size : (size_t) 1))))
return false;
/* Read the input file, but don't bother reading it if it's empty.
When creating files, the files do not actually exist. */
if (size)
{
if (S_ISREG (instat.st_mode))
{
int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
size_t buffered = 0, n;
if (ifd < 0)
pfatal ("can't open file %s", quotearg (filename));
while (size - buffered != 0)
{
n = read (ifd, buffer + buffered, size - buffered);
if (n == 0)
{
/* Some non-POSIX hosts exaggerate st_size in text mode;
or the file may have shrunk! */
size = buffered;
break;
}
if (n == (size_t) -1)
{
/* Perhaps size is too large for this host. */
close (ifd);
free (buffer);
return false;
}
buffered += n;
}
if (close (ifd) != 0)
read_fatal ();
}
else if (S_ISLNK (instat.st_mode))
{
ssize_t n;
n = safe_readlink (filename, buffer, size);
if (n < 0)
pfatal ("can't read %s %s", "symbolic link", quotearg (filename));
size = n;
}
else
{
free (buffer);
return false;
}
}
/* Scan the buffer and build array of pointers to lines. */
lim = buffer + size;
iline = 3; /* 1 unused, 1 for SOF, 1 for EOF if last line is incomplete */
for (s = buffer; (s = (char *) memchr (s, '\n', lim - s)); s++)
if (++iline < 0)
too_many_lines (filename);
if (! (iline == (size_t) iline
&& (size_t) iline * sizeof *ptr / sizeof *ptr == (size_t) iline
&& (ptr = (char const **) malloc ((size_t) iline * sizeof *ptr))))
{
free (buffer);
return false;
}
iline = 0;
for (s = buffer; ; s++)
{
ptr[++iline] = s;
if (! (s = (char *) memchr (s, '\n', lim - s)))
break;
}
if (size && lim[-1] != '\n')
ptr[++iline] = lim;
input_lines = iline - 1;
if (revision)
{
char const *rev = revision;
int rev0 = rev[0];
bool found_revision = false;
size_t revlen = strlen (rev);
if (revlen <= size)
{
char const *limrev = lim - revlen;
for (s = buffer; (s = (char *) memchr (s, rev0, limrev - s)); s++)
if (memcmp (s, rev, revlen) == 0
&& (s == buffer || ISSPACE ((unsigned char) s[-1]))
&& (s + 1 == limrev || ISSPACE ((unsigned char) s[revlen])))
{
found_revision = true;
break;
}
}
report_revision (found_revision);
}
/* Plan A will work. */
i_buffer = buffer;
i_ptr = ptr;
return true;
}
| 1 |
[
"CWE-59"
] |
patch
|
dce4683cbbe107a95f1f0d45fabc304acfb5d71a
| 176,392,324,421,738,530,000,000,000,000,000,000,000 | 117 |
Don't follow symlinks unless --follow-symlinks is given
* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
append_to_file): Unless the --follow-symlinks option is given, open files with
the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing
that consistently for input files.
* src/util.c (create_backup): When creating empty backup files, (re)create them
with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
|
OPJ_BOOL opj_j2k_end_decompress(opj_j2k_t *p_j2k,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager
)
{
(void)p_j2k;
(void)p_stream;
(void)p_manager;
return OPJ_TRUE;
}
| 0 |
[
"CWE-416",
"CWE-787"
] |
openjpeg
|
4241ae6fbbf1de9658764a80944dc8108f2b4154
| 115,338,879,063,989,500,000,000,000,000,000,000,000 | 10 |
Fix assertion in debug mode / heap-based buffer overflow in opj_write_bytes_LE for Cinema profiles with numresolutions = 1 (#985)
|
static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
struct ext4_extent *ex,
long long *partial_cluster,
ext4_lblk_t from, ext4_lblk_t to)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
unsigned short ee_len = ext4_ext_get_actual_len(ex);
ext4_fsblk_t pblk;
int flags = get_default_free_blocks_flags(inode);
/*
* For bigalloc file systems, we never free a partial cluster
* at the beginning of the extent. Instead, we make a note
* that we tried freeing the cluster, and check to see if we
* need to free it on a subsequent call to ext4_remove_blocks,
* or at the end of ext4_ext_rm_leaf or ext4_ext_remove_space.
*/
flags |= EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER;
trace_ext4_remove_blocks(inode, ex, from, to, *partial_cluster);
/*
* If we have a partial cluster, and it's different from the
* cluster of the last block, we need to explicitly free the
* partial cluster here.
*/
pblk = ext4_ext_pblock(ex) + ee_len - 1;
if (*partial_cluster > 0 &&
*partial_cluster != (long long) EXT4_B2C(sbi, pblk)) {
ext4_free_blocks(handle, inode, NULL,
EXT4_C2B(sbi, *partial_cluster),
sbi->s_cluster_ratio, flags);
*partial_cluster = 0;
}
#ifdef EXTENTS_STATS
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
spin_lock(&sbi->s_ext_stats_lock);
sbi->s_ext_blocks += ee_len;
sbi->s_ext_extents++;
if (ee_len < sbi->s_ext_min)
sbi->s_ext_min = ee_len;
if (ee_len > sbi->s_ext_max)
sbi->s_ext_max = ee_len;
if (ext_depth(inode) > sbi->s_depth_max)
sbi->s_depth_max = ext_depth(inode);
spin_unlock(&sbi->s_ext_stats_lock);
}
#endif
if (from >= le32_to_cpu(ex->ee_block)
&& to == le32_to_cpu(ex->ee_block) + ee_len - 1) {
/* tail removal */
ext4_lblk_t num;
long long first_cluster;
num = le32_to_cpu(ex->ee_block) + ee_len - from;
pblk = ext4_ext_pblock(ex) + ee_len - num;
/*
* Usually we want to free partial cluster at the end of the
* extent, except for the situation when the cluster is still
* used by any other extent (partial_cluster is negative).
*/
if (*partial_cluster < 0 &&
*partial_cluster == -(long long) EXT4_B2C(sbi, pblk+num-1))
flags |= EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER;
ext_debug("free last %u blocks starting %llu partial %lld\n",
num, pblk, *partial_cluster);
ext4_free_blocks(handle, inode, NULL, pblk, num, flags);
/*
* If the block range to be freed didn't start at the
* beginning of a cluster, and we removed the entire
* extent and the cluster is not used by any other extent,
* save the partial cluster here, since we might need to
* delete if we determine that the truncate or punch hole
* operation has removed all of the blocks in the cluster.
* If that cluster is used by another extent, preserve its
* negative value so it isn't freed later on.
*
* If the whole extent wasn't freed, we've reached the
* start of the truncated/punched region and have finished
* removing blocks. If there's a partial cluster here it's
* shared with the remainder of the extent and is no longer
* a candidate for removal.
*/
if (EXT4_PBLK_COFF(sbi, pblk) && ee_len == num) {
first_cluster = (long long) EXT4_B2C(sbi, pblk);
if (first_cluster != -*partial_cluster)
*partial_cluster = first_cluster;
} else {
*partial_cluster = 0;
}
} else
ext4_error(sbi->s_sb, "strange request: removal(2) "
"%u-%u from %u:%u",
from, to, le32_to_cpu(ex->ee_block), ee_len);
return 0;
}
| 0 |
[
"CWE-125"
] |
linux
|
bc890a60247171294acc0bd67d211fa4b88d40ba
| 75,877,366,740,730,750,000,000,000,000,000,000,000 | 98 |
ext4: verify the depth of extent tree in ext4_find_extent()
If there is a corupted file system where the claimed depth of the
extent tree is -1, this can cause a massive buffer overrun leading to
sadness.
This addresses CVE-2018-10877.
https://bugzilla.kernel.org/show_bug.cgi?id=199417
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected]
|
void luaD_call (lua_State *L, StkId func, int nresults) {
lua_CFunction f;
retry:
switch (ttypetag(s2v(func))) {
case LUA_VCCL: /* C closure */
f = clCvalue(s2v(func))->f;
goto Cfunc;
case LUA_VLCF: /* light C function */
f = fvalue(s2v(func));
Cfunc: {
int n; /* number of returns */
CallInfo *ci;
checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */
L->ci = ci = next_ci(L);
ci->nresults = nresults;
ci->callstatus = CIST_C;
ci->top = L->top + LUA_MINSTACK;
ci->func = func;
lua_assert(ci->top <= L->stack_last);
if (L->hookmask & LUA_MASKCALL) {
int narg = cast_int(L->top - func) - 1;
luaD_hook(L, LUA_HOOKCALL, -1, 1, narg);
}
lua_unlock(L);
n = (*f)(L); /* do the actual call */
lua_lock(L);
api_checknelems(L, n);
luaD_poscall(L, ci, n);
break;
}
case LUA_VLCL: { /* Lua function */
CallInfo *ci;
Proto *p = clLvalue(s2v(func))->p;
int narg = cast_int(L->top - func) - 1; /* number of real arguments */
int nfixparams = p->numparams;
int fsize = p->maxstacksize; /* frame size */
checkstackGCp(L, fsize, func);
L->ci = ci = next_ci(L);
ci->nresults = nresults;
ci->u.l.savedpc = p->code; /* starting point */
ci->callstatus = 0;
ci->top = func + 1 + fsize;
ci->func = func;
L->ci = ci;
for (; narg < nfixparams; narg++)
setnilvalue(s2v(L->top++)); /* complete missing arguments */
lua_assert(ci->top <= L->stack_last);
luaV_execute(L, ci); /* run the function */
break;
}
default: { /* not a function */
checkstackGCp(L, 1, func); /* space for metamethod */
luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */
goto retry; /* try again with metamethod */
}
}
}
| 0 |
[
"CWE-416",
"CWE-125",
"CWE-787"
] |
lua
|
eb41999461b6f428186c55abd95f4ce1a76217d5
| 192,929,546,844,245,500,000,000,000,000,000,000,000 | 57 |
Fixed bugs of stack reallocation x GC
Macro 'checkstackGC' was doing a GC step after resizing the stack;
the GC could shrink the stack and undo the resize. Moreover, macro
'checkstackp' also does a GC step, which could remove the preallocated
CallInfo when calling a function. (Its name has been changed to
'checkstackGCp' to emphasize that it calls the GC.)
|
void setInUserManagementCommand(OperationContext*, bool) override {
UASSERT_NOT_IMPLEMENTED;
}
| 0 |
[
"CWE-613"
] |
mongo
|
e55d6e2292e5dbe2f97153251d8193d1cc89f5d7
| 243,727,338,032,180,800,000,000,000,000,000,000,000 | 3 |
SERVER-38984 Validate unique User ID on UserCache hit
|
MagickExport size_t InterpretImageFilename(const ImageInfo *image_info,
Image *image,const char *format,int value,char *filename)
{
char
*q;
int
c;
MagickBooleanType
canonical;
register const char
*p;
ssize_t
field_width,
offset;
canonical=MagickFalse;
offset=0;
(void) CopyMagickString(filename,format,MaxTextExtent);
for (p=strchr(format,'%'); p != (char *) NULL; p=strchr(p+1,'%'))
{
q=(char *) p+1;
if (*q == '%')
{
p=q+1;
continue;
}
field_width=0;
if (*q == '0')
field_width=(ssize_t) strtol(q,&q,10);
switch (*q)
{
case 'd':
case 'o':
case 'x':
{
q++;
c=(*q);
*q='\0';
(void) FormatLocaleString(filename+(p-format-offset),(size_t)
(MaxTextExtent-(p-format-offset)),p,value);
offset+=(4-field_width);
*q=c;
(void) ConcatenateMagickString(filename,q,MaxTextExtent);
canonical=MagickTrue;
if (*(q-1) != '%')
break;
p++;
break;
}
case '[':
{
char
pattern[MaxTextExtent];
const char
*value;
register char
*r;
register ssize_t
i;
ssize_t
depth;
/*
Image option.
*/
if (strchr(p,']') == (char *) NULL)
break;
depth=1;
r=q+1;
for (i=0; (i < (MaxTextExtent-1L)) && (*r != '\0'); i++)
{
if (*r == '[')
depth++;
if (*r == ']')
depth--;
if (depth <= 0)
break;
pattern[i]=(*r++);
}
pattern[i]='\0';
if (LocaleNCompare(pattern,"filename:",9) != 0)
break;
value=(const char *) NULL;
if (image != (Image *) NULL)
value=GetImageProperty(image,pattern);
if ((value == (const char *) NULL) &&
(image != (Image *) NULL))
value=GetImageArtifact(image,pattern);
if ((value == (const char *) NULL) &&
(image_info != (ImageInfo *) NULL))
value=GetImageOption(image_info,pattern);
if (value == (const char *) NULL)
break;
q--;
c=(*q);
*q='\0';
(void) CopyMagickString(filename+(p-format-offset),value,(size_t)
(MaxTextExtent-(p-format-offset)));
offset+=strlen(pattern)-strlen(value)+3;
*q=c;
(void) ConcatenateMagickString(filename,r+1,MaxTextExtent);
canonical=MagickTrue;
if (*(q-1) != '%')
break;
p++;
break;
}
default:
break;
}
}
for (q=filename; *q != '\0'; q++)
if ((*q == '%') && (*(q+1) == '%'))
{
(void) CopyMagickString(q,q+1,(size_t) (MaxTextExtent-(q-filename)));
canonical=MagickTrue;
}
if (canonical == MagickFalse)
(void) CopyMagickString(filename,format,MaxTextExtent);
return(strlen(filename));
}
| 0 |
[
"CWE-665"
] |
ImageMagick6
|
27b1c74979ac473a430e266ff6c4b645664bc805
| 200,168,357,255,689,360,000,000,000,000,000,000,000 | 129 |
https://github.com/ImageMagick/ImageMagick/issues/1522
|
box_ge(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
PG_RETURN_BOOL(FPge(box_ar(box1), box_ar(box2)));
}
| 0 |
[
"CWE-703",
"CWE-189"
] |
postgres
|
31400a673325147e1205326008e32135a78b4d8a
| 239,633,961,412,486,740,000,000,000,000,000,000,000 | 7 |
Predict integer overflow to avoid buffer overruns.
Several functions, mostly type input functions, calculated an allocation
size such that the calculation wrapped to a small positive value when
arguments implied a sufficiently-large requirement. Writes past the end
of the inadvertent small allocation followed shortly thereafter.
Coverity identified the path_in() vulnerability; code inspection led to
the rest. In passing, add check_stack_depth() to prevent stack overflow
in related functions.
Back-patch to 8.4 (all supported versions). The non-comment hstore
changes touch code that did not exist in 8.4, so that part stops at 9.0.
Noah Misch and Heikki Linnakangas, reviewed by Tom Lane.
Security: CVE-2014-0064
|
static int usbredir_check_filter(USBRedirDevice *dev)
{
if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
ERROR("No interface info for device\n");
goto error;
}
if (dev->filter_rules) {
if (!usbredirparser_peer_has_cap(dev->parser,
usb_redir_cap_connect_device_version)) {
ERROR("Device filter specified and peer does not have the "
"connect_device_version capability\n");
goto error;
}
if (usbredirfilter_check(
dev->filter_rules,
dev->filter_rules_count,
dev->device_info.device_class,
dev->device_info.device_subclass,
dev->device_info.device_protocol,
dev->interface_info.interface_class,
dev->interface_info.interface_subclass,
dev->interface_info.interface_protocol,
dev->interface_info.interface_count,
dev->device_info.vendor_id,
dev->device_info.product_id,
dev->device_info.device_version_bcd,
0) != 0) {
goto error;
}
}
return 0;
error:
usbredir_reject_device(dev);
return -1;
}
| 0 |
[
"CWE-770"
] |
qemu
|
7ec54f9eb62b5d177e30eb8b1cad795a5f8d8986
| 80,532,808,634,938,290,000,000,000,000,000,000,000 | 39 |
usb/redir: avoid dynamic stack allocation (CVE-2021-3527)
Use autofree heap allocation instead.
Fixes: 4f4321c11ff ("usb: use iovecs in USBPacket")
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
|
xmlXPathFreeObjectEntry(void *obj, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlXPathFreeObject((xmlXPathObjectPtr) obj);
}
| 0 |
[
"CWE-476"
] |
libxml2
|
a436374994c47b12d5de1b8b1d191a098fa23594
| 273,847,808,189,179,200,000,000,000,000,000,000,000 | 3 |
Fix nullptr deref with XPath logic ops
If the XPath stack is corrupted, for example by a misbehaving extension
function, the "and" and "or" XPath operators could dereference NULL
pointers. Check that the XPath stack isn't empty and optimize the
logic operators slightly.
Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/5
Also see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817
https://bugzilla.redhat.com/show_bug.cgi?id=1595985
This is CVE-2018-14404.
Thanks to Guy Inbar for the report.
|
static inline unsigned int level_to_offset_bits(int level)
{
return (level - 1) * LEVEL_STRIDE;
}
| 0 |
[] |
linux
|
d8b8591054575f33237556c32762d54e30774d28
| 34,672,167,626,244,494,000,000,000,000,000,000,000 | 4 |
iommu/vt-d: Disable ATS support on untrusted devices
Commit fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted
devices") disables ATS support on the devices which have been marked
as untrusted. Unfortunately this is not enough to fix the DMA attack
vulnerabiltiies because IOMMU driver allows translated requests as
long as a device advertises the ATS capability. Hence a malicious
peripheral device could use this to bypass IOMMU.
This disables the ATS support on untrusted devices by clearing the
internal per-device ATS mark. As the result, IOMMU driver will block
any translated requests from any device marked as untrusted.
Cc: Jacob Pan <[email protected]>
Cc: Mika Westerberg <[email protected]>
Suggested-by: Kevin Tian <[email protected]>
Suggested-by: Ashok Raj <[email protected]>
Fixes: fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted devices")
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
|
static void Ins_PUSHW( INS_ARG )
{
Int L, K;
L = CUR.opcode - 0xB8 + 1;
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
CUR.IP++;
for ( K = 0; K < L; K++ )
{ args[K] = GET_ShortIns();
DBG_PRINT1(" %d", args[K]);
}
CUR.step_ins = FALSE;
}
| 0 |
[
"CWE-125"
] |
ghostpdl
|
c7c55972758a93350882c32147801a3485b010fe
| 204,595,265,460,401,300,000,000,000,000,000,000,000 | 21 |
Bug 698024: bounds check zone pointer in Ins_MIRP()
|
static Image *ReadOneJNGImage(MngInfo *mng_info,
const ImageInfo *image_info, ExceptionInfo *exception)
{
Image
*alpha_image,
*color_image,
*image,
*jng_image;
ImageInfo
*alpha_image_info,
*color_image_info;
MagickBooleanType
logging;
ssize_t
y;
MagickBooleanType
status;
png_uint_32
jng_height,
jng_width;
png_byte
jng_color_type,
jng_image_sample_depth,
jng_image_compression_method,
jng_image_interlace_method,
jng_alpha_sample_depth,
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method;
register const Quantum
*s;
register ssize_t
i,
x;
register Quantum
*q;
register unsigned char
*p;
unsigned int
read_JSEP,
reading_idat;
size_t
length;
jng_alpha_compression_method=0;
jng_alpha_sample_depth=8;
jng_color_type=0;
jng_height=0;
jng_width=0;
alpha_image=(Image *) NULL;
color_image=(Image *) NULL;
alpha_image_info=(ImageInfo *) NULL;
color_image_info=(ImageInfo *) NULL;
logging=LogMagickEvent(CoderEvent,GetMagickModule(),
" Enter ReadOneJNGImage()");
image=mng_info->image;
if (GetAuthenticPixelQueue(image) != (Quantum *) NULL)
{
/*
Allocate next image structure.
*/
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" AcquireNextImage()");
AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
return(DestroyImageList(image));
image=SyncNextImageInList(image);
}
mng_info->image=image;
/*
Signature bytes have already been read.
*/
read_JSEP=MagickFalse;
reading_idat=MagickFalse;
for (;;)
{
char
type[MagickPathExtent];
unsigned char
*chunk;
unsigned int
count;
/*
Read a new JNG chunk.
*/
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
break;
type[0]='\0';
(void) ConcatenateMagickString(type,"errr",MagickPathExtent);
length=ReadBlobMSBLong(image);
count=(unsigned int) ReadBlob(image,4,(unsigned char *) type);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading JNG chunk type %c%c%c%c, length: %.20g",
type[0],type[1],type[2],type[3],(double) length);
if (length > PNG_UINT_31_MAX || count == 0)
ThrowReaderException(CorruptImageError,"CorruptImage");
p=NULL;
chunk=(unsigned char *) NULL;
if (length != 0)
{
chunk=(unsigned char *) AcquireQuantumMemory(length+MagickPathExtent,
sizeof(*chunk));
if (chunk == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
{
int
c;
c=ReadBlobByte(image);
if (c == EOF)
break;
chunk[i]=(unsigned char) c;
}
p=chunk;
}
(void) ReadBlobMSBLong(image); /* read crc word */
if (memcmp(type,mng_JHDR,4) == 0)
{
if (length == 16)
{
jng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |
(p[2] << 8) | p[3]);
jng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |
(p[6] << 8) | p[7]);
if ((jng_width == 0) || (jng_height == 0))
ThrowReaderException(CorruptImageError,
"NegativeOrZeroImageSize");
jng_color_type=p[8];
jng_image_sample_depth=p[9];
jng_image_compression_method=p[10];
jng_image_interlace_method=p[11];
image->interlace=jng_image_interlace_method != 0 ? PNGInterlace :
NoInterlace;
jng_alpha_sample_depth=p[12];
jng_alpha_compression_method=p[13];
jng_alpha_filter_method=p[14];
jng_alpha_interlace_method=p[15];
if (logging != MagickFalse)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_width: %16lu, jng_height: %16lu\n"
" jng_color_type: %16d, jng_image_sample_depth: %3d\n"
" jng_image_compression_method:%3d",
(unsigned long) jng_width, (unsigned long) jng_height,
jng_color_type, jng_image_sample_depth,
jng_image_compression_method);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_image_interlace_method: %3d"
" jng_alpha_sample_depth: %3d",
jng_image_interlace_method,
jng_alpha_sample_depth);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_alpha_compression_method:%3d\n"
" jng_alpha_filter_method: %3d\n"
" jng_alpha_interlace_method: %3d",
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method);
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((reading_idat == MagickFalse) && (read_JSEP == MagickFalse) &&
((memcmp(type,mng_JDAT,4) == 0) || (memcmp(type,mng_JdAA,4) == 0) ||
(memcmp(type,mng_IDAT,4) == 0) || (memcmp(type,mng_JDAA,4) == 0)))
{
/*
o create color_image
o open color_blob, attached to color_image
o if (color type has alpha)
open alpha_blob, attached to alpha_image
*/
color_image_info=(ImageInfo *)AcquireMagickMemory(sizeof(ImageInfo));
if (color_image_info == (ImageInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
GetImageInfo(color_image_info);
color_image=AcquireImage(color_image_info,exception);
if (color_image == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating color_blob.");
(void) AcquireUniqueFilename(color_image->filename);
status=OpenBlob(color_image_info,color_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if ((image_info->ping == MagickFalse) && (jng_color_type >= 12))
{
alpha_image_info=(ImageInfo *)
AcquireMagickMemory(sizeof(ImageInfo));
if (alpha_image_info == (ImageInfo *) NULL)
{
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
GetImageInfo(alpha_image_info);
alpha_image=AcquireImage(alpha_image_info,exception);
if (alpha_image == (Image *) NULL)
{
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating alpha_blob.");
(void) AcquireUniqueFilename(alpha_image->filename);
status=OpenBlob(alpha_image_info,alpha_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if (jng_alpha_compression_method == 0)
{
unsigned char
data[18];
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Writing IHDR chunk to alpha_blob.");
(void) WriteBlob(alpha_image,8,(const unsigned char *)
"\211PNG\r\n\032\n");
(void) WriteBlobMSBULong(alpha_image,13L);
PNGType(data,mng_IHDR);
LogPNGChunk(logging,mng_IHDR,13L);
PNGLong(data+4,jng_width);
PNGLong(data+8,jng_height);
data[12]=jng_alpha_sample_depth;
data[13]=0; /* color_type gray */
data[14]=0; /* compression method 0 */
data[15]=0; /* filter_method 0 */
data[16]=0; /* interlace_method 0 */
(void) WriteBlob(alpha_image,17,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,17));
}
}
reading_idat=MagickTrue;
}
if (memcmp(type,mng_JDAT,4) == 0)
{
/* Copy chunk to color_image->blob */
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAT chunk data to color_blob.");
if (length != 0)
{
(void) WriteBlob(color_image,length,chunk);
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
}
continue;
}
if (memcmp(type,mng_IDAT,4) == 0)
{
png_byte
data[5];
/* Copy IDAT header and chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying IDAT chunk data to alpha_blob.");
(void) WriteBlobMSBULong(alpha_image,(size_t) length);
PNGType(data,mng_IDAT);
LogPNGChunk(logging,mng_IDAT,length);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlob(alpha_image,length,chunk);
(void) WriteBlobMSBULong(alpha_image,
crc32(crc32(0,data,4),chunk,(uInt) length));
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((memcmp(type,mng_JDAA,4) == 0) || (memcmp(type,mng_JdAA,4) == 0))
{
/* Copy chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAA chunk data to alpha_blob.");
(void) WriteBlob(alpha_image,length,chunk);
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_JSEP,4) == 0)
{
read_JSEP=MagickTrue;
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_bKGD,4) == 0)
{
if (length == 2)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=image->background_color.red;
image->background_color.blue=image->background_color.red;
}
if (length == 6)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=ScaleCharToQuantum(p[3]);
image->background_color.blue=ScaleCharToQuantum(p[5]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_gAMA,4) == 0)
{
if (length == 4)
image->gamma=((float) mng_get_long(p))*0.00001;
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_cHRM,4) == 0)
{
if (length == 32)
{
image->chromaticity.white_point.x=0.00001*mng_get_long(p);
image->chromaticity.white_point.y=0.00001*mng_get_long(&p[4]);
image->chromaticity.red_primary.x=0.00001*mng_get_long(&p[8]);
image->chromaticity.red_primary.y=0.00001*mng_get_long(&p[12]);
image->chromaticity.green_primary.x=0.00001*mng_get_long(&p[16]);
image->chromaticity.green_primary.y=0.00001*mng_get_long(&p[20]);
image->chromaticity.blue_primary.x=0.00001*mng_get_long(&p[24]);
image->chromaticity.blue_primary.y=0.00001*mng_get_long(&p[28]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_sRGB,4) == 0)
{
if (length == 1)
{
image->rendering_intent=
Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);
image->gamma=1.000f/2.200f;
image->chromaticity.red_primary.x=0.6400f;
image->chromaticity.red_primary.y=0.3300f;
image->chromaticity.green_primary.x=0.3000f;
image->chromaticity.green_primary.y=0.6000f;
image->chromaticity.blue_primary.x=0.1500f;
image->chromaticity.blue_primary.y=0.0600f;
image->chromaticity.white_point.x=0.3127f;
image->chromaticity.white_point.y=0.3290f;
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_oFFs,4) == 0)
{
if (length > 8)
{
image->page.x=(ssize_t) mng_get_long(p);
image->page.y=(ssize_t) mng_get_long(&p[4]);
if ((int) p[8] != 0)
{
image->page.x/=10000;
image->page.y/=10000;
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_pHYs,4) == 0)
{
if (length > 8)
{
image->resolution.x=(double) mng_get_long(p);
image->resolution.y=(double) mng_get_long(&p[4]);
if ((int) p[8] == PNG_RESOLUTION_METER)
{
image->units=PixelsPerCentimeterResolution;
image->resolution.x=image->resolution.x/100.0f;
image->resolution.y=image->resolution.y/100.0f;
}
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#if 0
if (memcmp(type,mng_iCCP,4) == 0)
{
/* To do: */
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#endif
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
if (memcmp(type,mng_IEND,4))
continue;
break;
}
/* IEND found */
/*
Finish up reading image data:
o read main image from color_blob.
o close color_blob.
o if (color_type has alpha)
if alpha_encoding is PNG
read secondary image from alpha_blob via ReadPNG
if alpha_encoding is JPEG
read secondary image from alpha_blob via ReadJPEG
o close alpha_blob.
o copy intensity of secondary image into
alpha samples of main image.
o destroy the secondary image.
*/
if (color_image_info == (ImageInfo *) NULL)
{
assert(color_image == (Image *) NULL);
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
if (color_image == (Image *) NULL)
{
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
(void) SeekBlob(color_image,0,SEEK_SET);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading jng_image from color_blob.");
assert(color_image_info != (ImageInfo *) NULL);
(void) FormatLocaleString(color_image_info->filename,MagickPathExtent,"%s",
color_image->filename);
color_image_info->ping=MagickFalse; /* To do: avoid this */
jng_image=ReadImage(color_image_info,exception);
(void) RelinquishUniqueFileResource(color_image->filename);
color_image=DestroyImage(color_image);
color_image_info=DestroyImageInfo(color_image_info);
if (jng_image == (Image *) NULL)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying jng_image pixels to main image.");
image->rows=jng_height;
image->columns=jng_width;
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelRed(image,GetPixelRed(jng_image,s),q);
SetPixelGreen(image,GetPixelGreen(jng_image,s),q);
SetPixelBlue(image,GetPixelBlue(jng_image,s),q);
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
jng_image=DestroyImage(jng_image);
if (image_info->ping == MagickFalse)
{
if (jng_color_type >= 12)
{
if (jng_alpha_compression_method == 0)
{
png_byte
data[5];
(void) WriteBlobMSBULong(alpha_image,0x00000000L);
PNGType(data,mng_IEND);
LogPNGChunk(logging,mng_IEND,0L);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,4));
}
(void) CloseBlob(alpha_image);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading alpha from alpha_blob.");
(void) FormatLocaleString(alpha_image_info->filename,MagickPathExtent,
"%s",alpha_image->filename);
jng_image=ReadImage(alpha_image_info,exception);
if (jng_image != (Image *) NULL)
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,
exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (image->alpha_trait != UndefinedPixelTrait)
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
else
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
if (GetPixelAlpha(image,q) != OpaqueAlpha)
image->alpha_trait=BlendPixelTrait;
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
(void) RelinquishUniqueFileResource(alpha_image->filename);
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
if (jng_image != (Image *) NULL)
jng_image=DestroyImage(jng_image);
}
}
/* Read the JNG image. */
if (mng_info->mng_type == 0)
{
mng_info->mng_width=jng_width;
mng_info->mng_height=jng_height;
}
if (image->page.width == 0 && image->page.height == 0)
{
image->page.width=jng_width;
image->page.height=jng_height;
}
if (image->page.x == 0 && image->page.y == 0)
{
image->page.x=mng_info->x_off[mng_info->object_id];
image->page.y=mng_info->y_off[mng_info->object_id];
}
else
{
image->page.y=mng_info->y_off[mng_info->object_id];
}
mng_info->image_found++;
status=SetImageProgress(image,LoadImagesTag,2*TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" exit ReadOneJNGImage()");
return(image);
}
| 1 |
[
"CWE-703",
"CWE-770"
] |
ImageMagick
|
d9ccd8227c4c88a907cda5278408b73552cb0c07
| 53,698,818,751,833,550,000,000,000,000,000,000,000 | 703 |
https://github.com/ImageMagick/ImageMagick/issues/549
|
void LinkResolver::check_method_loader_constraints(const LinkInfo& link_info,
const methodHandle& resolved_method,
const char* method_type, TRAPS) {
Handle current_loader(THREAD, link_info.current_klass()->class_loader());
Handle resolved_loader(THREAD, resolved_method->method_holder()->class_loader());
ResourceMark rm(THREAD);
Symbol* failed_type_symbol =
SystemDictionary::check_signature_loaders(link_info.signature(), current_loader,
resolved_loader, true, CHECK);
if (failed_type_symbol != NULL) {
Klass* current_class = link_info.current_klass();
ClassLoaderData* current_loader_data = current_class->class_loader_data();
assert(current_loader_data != NULL, "current class has no class loader data");
Klass* resolved_method_class = resolved_method->method_holder();
ClassLoaderData* target_loader_data = resolved_method_class->class_loader_data();
assert(target_loader_data != NULL, "resolved method's class has no class loader data");
stringStream ss;
ss.print("loader constraint violation: when resolving %s '", method_type);
Method::print_external_name(&ss, link_info.resolved_klass(), link_info.name(), link_info.signature());
ss.print("' the class loader %s of the current class, %s,"
" and the class loader %s for the method's defining class, %s, have"
" different Class objects for the type %s used in the signature (%s; %s)",
current_loader_data->loader_name_and_id(),
current_class->name()->as_C_string(),
target_loader_data->loader_name_and_id(),
resolved_method_class->name()->as_C_string(),
failed_type_symbol->as_C_string(),
current_class->class_in_module_of_loader(false, true),
resolved_method_class->class_in_module_of_loader(false, true));
THROW_MSG(vmSymbols::java_lang_LinkageError(), ss.as_string());
}
}
| 0 |
[] |
jdk11u
|
132745902a4601dc64b2c8ca112ca30292feccb4
| 80,979,245,817,629,680,000,000,000,000,000,000,000 | 34 |
8281866: Enhance MethodHandle invocations
Reviewed-by: mbaesken
Backport-of: d974d9da365f787f67971d88c79371c8b0769f75
|
static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
u32 portid, u32 seq, int event,
u32 flags, int family,
const struct nft_table *table,
const struct nft_chain *chain,
const struct nft_rule *rule)
{
struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg;
const struct nft_expr *expr, *next;
struct nlattr *list;
const struct nft_rule *prule;
int type = event | NFNL_SUBSYS_NFTABLES << 8;
nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg),
flags);
if (nlh == NULL)
goto nla_put_failure;
nfmsg = nlmsg_data(nlh);
nfmsg->nfgen_family = family;
nfmsg->version = NFNETLINK_V0;
nfmsg->res_id = htons(net->nft.base_seq & 0xffff);
if (nla_put_string(skb, NFTA_RULE_TABLE, table->name))
goto nla_put_failure;
if (nla_put_string(skb, NFTA_RULE_CHAIN, chain->name))
goto nla_put_failure;
if (nla_put_be64(skb, NFTA_RULE_HANDLE, cpu_to_be64(rule->handle)))
goto nla_put_failure;
if ((event != NFT_MSG_DELRULE) && (rule->list.prev != &chain->rules)) {
prule = list_entry(rule->list.prev, struct nft_rule, list);
if (nla_put_be64(skb, NFTA_RULE_POSITION,
cpu_to_be64(prule->handle)))
goto nla_put_failure;
}
list = nla_nest_start(skb, NFTA_RULE_EXPRESSIONS);
if (list == NULL)
goto nla_put_failure;
nft_rule_for_each_expr(expr, next, rule) {
struct nlattr *elem = nla_nest_start(skb, NFTA_LIST_ELEM);
if (elem == NULL)
goto nla_put_failure;
if (nf_tables_fill_expr_info(skb, expr) < 0)
goto nla_put_failure;
nla_nest_end(skb, elem);
}
nla_nest_end(skb, list);
if (rule->ulen &&
nla_put(skb, NFTA_RULE_USERDATA, rule->ulen, nft_userdata(rule)))
goto nla_put_failure;
return nlmsg_end(skb, nlh);
nla_put_failure:
nlmsg_trim(skb, nlh);
return -1;
}
| 0 |
[
"CWE-19"
] |
nf
|
a2f18db0c68fec96631c10cad9384c196e9008ac
| 283,435,986,978,942,900,000,000,000,000,000,000,000 | 61 |
netfilter: nf_tables: fix flush ruleset chain dependencies
Jumping between chains doesn't mix well with flush ruleset. Rules
from a different chain and set elements may still refer to us.
[ 353.373791] ------------[ cut here ]------------
[ 353.373845] kernel BUG at net/netfilter/nf_tables_api.c:1159!
[ 353.373896] invalid opcode: 0000 [#1] SMP
[ 353.373942] Modules linked in: intel_powerclamp uas iwldvm iwlwifi
[ 353.374017] CPU: 0 PID: 6445 Comm: 31c3.nft Not tainted 3.18.0 #98
[ 353.374069] Hardware name: LENOVO 5129CTO/5129CTO, BIOS 6QET47WW (1.17 ) 07/14/2010
[...]
[ 353.375018] Call Trace:
[ 353.375046] [<ffffffff81964c31>] ? nf_tables_commit+0x381/0x540
[ 353.375101] [<ffffffff81949118>] nfnetlink_rcv+0x3d8/0x4b0
[ 353.375150] [<ffffffff81943fc5>] netlink_unicast+0x105/0x1a0
[ 353.375200] [<ffffffff8194438e>] netlink_sendmsg+0x32e/0x790
[ 353.375253] [<ffffffff818f398e>] sock_sendmsg+0x8e/0xc0
[ 353.375300] [<ffffffff818f36b9>] ? move_addr_to_kernel.part.20+0x19/0x70
[ 353.375357] [<ffffffff818f44f9>] ? move_addr_to_kernel+0x19/0x30
[ 353.375410] [<ffffffff819016d2>] ? verify_iovec+0x42/0xd0
[ 353.375459] [<ffffffff818f3e10>] ___sys_sendmsg+0x3f0/0x400
[ 353.375510] [<ffffffff810615fa>] ? native_sched_clock+0x2a/0x90
[ 353.375563] [<ffffffff81176697>] ? acct_account_cputime+0x17/0x20
[ 353.375616] [<ffffffff8110dc78>] ? account_user_time+0x88/0xa0
[ 353.375667] [<ffffffff818f4bbd>] __sys_sendmsg+0x3d/0x80
[ 353.375719] [<ffffffff81b184f4>] ? int_check_syscall_exit_work+0x34/0x3d
[ 353.375776] [<ffffffff818f4c0d>] SyS_sendmsg+0xd/0x20
[ 353.375823] [<ffffffff81b1826d>] system_call_fastpath+0x16/0x1b
Release objects in this order: rules -> sets -> chains -> tables, to
make sure no references to chains are held anymore.
Reported-by: Asbjoern Sloth Toennesen <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
|
static void record_gencode(GVJ_t * job, node_t * n)
{
obj_state_t *obj = job->obj;
boxf BF;
pointf AF[4];
int style;
field_t *f;
int doMap = (obj->url || obj->explicit_tooltip);
int filled;
char* clrs[2];
f = (field_t *) ND_shape_info(n);
BF = f->b;
BF.LL.x += ND_coord(n).x;
BF.LL.y += ND_coord(n).y;
BF.UR.x += ND_coord(n).x;
BF.UR.y += ND_coord(n).y;
if (doMap && !(job->flags & EMIT_CLUSTERS_LAST))
gvrender_begin_anchor(job,
obj->url, obj->tooltip, obj->target,
obj->id);
style = stylenode(job, n);
penColor(job, n);
clrs[0] = NULL;
if (style & FILLED) {
char* fillcolor = findFill (n);
float frac;
if (findStopColor (fillcolor, clrs, &frac)) {
gvrender_set_fillcolor(job, clrs[0]);
if (clrs[1])
gvrender_set_gradient_vals(job,clrs[1],late_int(n,N_gradientangle,0,0), frac);
else
gvrender_set_gradient_vals(job,DEFAULT_COLOR,late_int(n,N_gradientangle,0,0), frac);
if (style & RADIAL)
filled = RGRADIENT;
else
filled = GRADIENT;
}
else {
filled = FILL;
gvrender_set_fillcolor(job, fillcolor);
}
}
else filled = FALSE;
if (streq(ND_shape(n)->name, "Mrecord"))
style |= ROUNDED;
if (SPECIAL_CORNERS(style)) {
AF[0] = BF.LL;
AF[2] = BF.UR;
AF[1].x = AF[2].x;
AF[1].y = AF[0].y;
AF[3].x = AF[0].x;
AF[3].y = AF[2].y;
round_corners(job, AF, 4, style, filled);
} else {
gvrender_box(job, BF, filled);
}
gen_fields(job, n, f);
if (clrs[0]) free (clrs[0]);
if (doMap) {
if (job->flags & EMIT_CLUSTERS_LAST)
gvrender_begin_anchor(job,
obj->url, obj->tooltip, obj->target,
obj->id);
gvrender_end_anchor(job);
}
}
| 0 |
[
"CWE-120"
] |
graphviz
|
784411ca3655c80da0f6025ab20634b2a6ff696b
| 106,290,922,092,576,340,000,000,000,000,000,000,000 | 73 |
fix: out-of-bounds write on invalid label
When the label for a node cannot be parsed (due to it being malformed), it falls
back on the symbol name of the node itself. I.e. the default label the node
would have had if it had no label attribute at all. However, this is applied by
dynamically altering the node's label to "\N", a shortcut for the symbol name of
the node. All of this is fine, however if the hand written label itself is
shorter than the literal string "\N", not enough memory would have been
allocated to write "\N" into the label text.
Here we account for the possibility of error during label parsing, and assume
that the label text may need to be overwritten with "\N" after the fact. Fixes
issue #1700.
|
explicit RuntimeShape(int dimensions_count) : size_(dimensions_count) {
if (dimensions_count > kMaxSmallSize) {
#ifdef TF_LITE_STATIC_MEMORY
TFLITE_CHECK(false && "No shape resizing supported on this platform");
#else // TF_LITE_STATIC_MEMORY
dims_pointer_ = new int32_t[dimensions_count];
#endif // TF_LITE_STATIC_MEMORY
}
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
tensorflow
|
8ee24e7949a203d234489f9da2c5bf45a7d5157d
| 282,795,503,681,900,800,000,000,000,000,000,000,000 | 9 |
[tflite] Ensure `MatchingDim` does not allow buffer overflow.
We check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.
A much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.
PiperOrigin-RevId: 332526127
Change-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4
|
void alignment_exception(struct pt_regs *regs)
{
int fixed = 0;
/* we don't implement logging of alignment exceptions */
if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS))
fixed = fix_alignment(regs);
if (fixed == 1) {
regs->nip += 4; /* skip over emulated instruction */
emulate_single_step(regs);
return;
}
/* Operand address was bad */
if (fixed == -EFAULT) {
if (user_mode(regs))
_exception(SIGSEGV, regs, SEGV_ACCERR, regs->dar);
else
/* Search exception table */
bad_page_fault(regs, regs->dar, SIGSEGV);
return;
}
_exception(SIGBUS, regs, BUS_ADRALN, regs->dar);
}
| 0 |
[
"CWE-241",
"CWE-19"
] |
linux
|
6c4841c2b6c32a134f9f36e5e08857138cc12b10
| 101,685,457,108,144,580,000,000,000,000,000,000,000 | 25 |
[POWERPC] Never panic when taking altivec exceptions from userspace
At the moment we rely on a cpu feature bit or a firmware property to
detect altivec. If we dont have either of these and the cpu does in fact
support altivec we can cause a panic from userspace.
It seems safer to always send a signal if we manage to get an 0xf20
exception from userspace.
Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
|
TPM2B_ECC_PARAMETER_Marshal(TPM2B_ECC_PARAMETER *source, BYTE **buffer, INT32 *size)
{
UINT16 written = 0;
written += TPM2B_Marshal(&source->b, buffer, size);
return written;
}
| 1 |
[
"CWE-787"
] |
libtpms
|
3ef9b26cb9f28bd64d738bff9505a20d4eb56acd
| 143,004,319,429,520,450,000,000,000,000,000,000,000 | 6 |
tpm2: Add maxSize parameter to TPM2B_Marshal for sanity checks
Add maxSize parameter to TPM2B_Marshal and assert on it checking
the size of the data intended to be marshaled versus the maximum
buffer size.
Signed-off-by: Stefan Berger <[email protected]>
|
file_compare_by_mime_type (NautilusFile *file_a,
NautilusFile *file_b)
{
char *mime_type_a, *mime_type_b;
int ret;
mime_type_a = nautilus_file_get_mime_type (file_a);
mime_type_b = nautilus_file_get_mime_type (file_b);
ret = strcmp (mime_type_a, mime_type_b);
g_free (mime_type_a);
g_free (mime_type_b);
return ret;
}
| 0 |
[
"CWE-20"
] |
nautilus
|
1630f53481f445ada0a455e9979236d31a8d3bb0
| 101,661,905,661,148,740,000,000,000,000,000,000,000 | 16 |
mime-actions: use file metadata for trusting desktop files
Currently we only trust desktop files that have the executable bit
set, and don't replace the displayed icon or the displayed name until
it's trusted, which prevents for running random programs by a malicious
desktop file.
However, the executable permission is preserved if the desktop file
comes from a compressed file.
To prevent this, add a metadata::trusted metadata to the file once the
user acknowledges the file as trusted. This adds metadata to the file,
which cannot be added unless it has access to the computer.
Also remove the SHEBANG "trusted" content we were putting inside the
desktop file, since that doesn't add more security since it can come
with the file itself.
https://bugzilla.gnome.org/show_bug.cgi?id=777991
|
jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)
{
jp2_box_t *box;
int found;
jas_image_t *image;
jp2_dec_t *dec;
bool samedtype;
int dtype;
unsigned int i;
jp2_cmap_t *cmapd;
jp2_pclr_t *pclrd;
jp2_cdef_t *cdefd;
unsigned int channo;
int newcmptno;
int_fast32_t *lutents;
#if 0
jp2_cdefchan_t *cdefent;
int cmptno;
#endif
jp2_cmapent_t *cmapent;
jas_icchdr_t icchdr;
jas_iccprof_t *iccprof;
dec = 0;
box = 0;
image = 0;
JAS_DBGLOG(100, ("jp2_decode(%p, \"%s\")\n", in, optstr));
if (!(dec = jp2_dec_create())) {
goto error;
}
/* Get the first box. This should be a JP box. */
if (!(box = jp2_box_get(in))) {
jas_eprintf("error: cannot get box\n");
goto error;
}
if (box->type != JP2_BOX_JP) {
jas_eprintf("error: expecting signature box\n");
goto error;
}
if (box->data.jp.magic != JP2_JP_MAGIC) {
jas_eprintf("incorrect magic number\n");
goto error;
}
jp2_box_destroy(box);
box = 0;
/* Get the second box. This should be a FTYP box. */
if (!(box = jp2_box_get(in))) {
goto error;
}
if (box->type != JP2_BOX_FTYP) {
jas_eprintf("expecting file type box\n");
goto error;
}
jp2_box_destroy(box);
box = 0;
/* Get more boxes... */
found = 0;
while ((box = jp2_box_get(in))) {
if (jas_getdbglevel() >= 1) {
jas_eprintf("got box type %s\n", box->info->name);
}
switch (box->type) {
case JP2_BOX_JP2C:
found = 1;
break;
case JP2_BOX_IHDR:
if (!dec->ihdr) {
dec->ihdr = box;
box = 0;
}
break;
case JP2_BOX_BPCC:
if (!dec->bpcc) {
dec->bpcc = box;
box = 0;
}
break;
case JP2_BOX_CDEF:
if (!dec->cdef) {
dec->cdef = box;
box = 0;
}
break;
case JP2_BOX_PCLR:
if (!dec->pclr) {
dec->pclr = box;
box = 0;
}
break;
case JP2_BOX_CMAP:
if (!dec->cmap) {
dec->cmap = box;
box = 0;
}
break;
case JP2_BOX_COLR:
if (!dec->colr) {
dec->colr = box;
box = 0;
}
break;
}
if (box) {
jp2_box_destroy(box);
box = 0;
}
if (found) {
break;
}
}
if (!found) {
jas_eprintf("error: no code stream found\n");
goto error;
}
if (!(dec->image = jpc_decode(in, optstr))) {
jas_eprintf("error: cannot decode code stream\n");
goto error;
}
/* An IHDR box must be present. */
if (!dec->ihdr) {
jas_eprintf("error: missing IHDR box\n");
goto error;
}
/* Does the number of components indicated in the IHDR box match
the value specified in the code stream? */
if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,
jas_image_numcmpts(dec->image))) {
jas_eprintf("error: number of components mismatch (IHDR)\n");
goto error;
}
/* At least one component must be present. */
if (!jas_image_numcmpts(dec->image)) {
jas_eprintf("error: no components\n");
goto error;
}
/* Determine if all components have the same data type. */
samedtype = true;
dtype = jas_image_cmptdtype(dec->image, 0);
for (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {
if (jas_image_cmptdtype(dec->image, i) != dtype) {
samedtype = false;
break;
}
}
/* Is the component data type indicated in the IHDR box consistent
with the data in the code stream? */
if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
(!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
jas_eprintf("error: component data type mismatch (IHDR)\n");
goto error;
}
/* Is the compression type supported? */
if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {
jas_eprintf("error: unsupported compression type\n");
goto error;
}
if (dec->bpcc) {
/* Is the number of components indicated in the BPCC box
consistent with the code stream data? */
if (dec->bpcc->data.bpcc.numcmpts !=
JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) {
jas_eprintf("error: number of components mismatch (BPCC)\n");
goto error;
}
/* Is the component data type information indicated in the BPCC
box consistent with the code stream data? */
if (!samedtype) {
for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));
++i) {
if (jas_image_cmptdtype(dec->image, i) !=
JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
jas_eprintf("error: component data type mismatch (BPCC)\n");
goto error;
}
}
} else {
jas_eprintf("warning: superfluous BPCC box\n");
}
}
/* A COLR box must be present. */
if (!dec->colr) {
jas_eprintf("error: no COLR box\n");
goto error;
}
switch (dec->colr->data.colr.method) {
case JP2_COLR_ENUM:
jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));
break;
case JP2_COLR_ICC:
iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,
dec->colr->data.colr.iccplen);
if (!iccprof) {
jas_eprintf("error: failed to parse ICC profile\n");
goto error;
}
jas_iccprof_gethdr(iccprof, &icchdr);
jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc);
jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));
dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);
if (!dec->image->cmprof_) {
jas_iccprof_destroy(iccprof);
goto error;
}
jas_iccprof_destroy(iccprof);
break;
}
/* If a CMAP box is present, a PCLR box must also be present. */
if (dec->cmap && !dec->pclr) {
jas_eprintf("warning: missing PCLR box or superfluous CMAP box\n");
jp2_box_destroy(dec->cmap);
dec->cmap = 0;
}
/* If a CMAP box is not present, a PCLR box must not be present. */
if (!dec->cmap && dec->pclr) {
jas_eprintf("warning: missing CMAP box or superfluous PCLR box\n");
jp2_box_destroy(dec->pclr);
dec->pclr = 0;
}
/* Determine the number of channels (which is essentially the number
of components after any palette mappings have been applied). */
dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :
JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));
/* Perform a basic sanity check on the CMAP box if present. */
if (dec->cmap) {
for (i = 0; i < dec->numchans; ++i) {
/* Is the component number reasonable? */
if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,
jas_image_numcmpts(dec->image))) {
jas_eprintf("error: invalid component number in CMAP box\n");
goto error;
}
/* Is the LUT index reasonable? */
if (dec->cmap->data.cmap.ents[i].pcol >=
dec->pclr->data.pclr.numchans) {
jas_eprintf("error: invalid CMAP LUT index\n");
goto error;
}
}
}
/* Allocate space for the channel-number to component-number LUT. */
if (!(dec->chantocmptlut = jas_alloc2(dec->numchans,
sizeof(uint_fast16_t)))) {
jas_eprintf("error: no memory\n");
goto error;
}
if (!dec->cmap) {
for (i = 0; i < dec->numchans; ++i) {
dec->chantocmptlut[i] = i;
}
} else {
cmapd = &dec->cmap->data.cmap;
pclrd = &dec->pclr->data.pclr;
cdefd = &dec->cdef->data.cdef;
for (channo = 0; channo < cmapd->numchans; ++channo) {
cmapent = &cmapd->ents[channo];
if (cmapent->map == JP2_CMAP_DIRECT) {
dec->chantocmptlut[channo] = channo;
} else if (cmapent->map == JP2_CMAP_PALETTE) {
if (!pclrd->numlutents) {
goto error;
}
lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));
if (!lutents) {
goto error;
}
for (i = 0; i < pclrd->numlutents; ++i) {
lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
}
newcmptno = jas_image_numcmpts(dec->image);
jas_image_depalettize(dec->image, cmapent->cmptno,
pclrd->numlutents, lutents,
JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);
dec->chantocmptlut[channo] = newcmptno;
jas_free(lutents);
#if 0
if (dec->cdef) {
cdefent = jp2_cdef_lookup(cdefd, channo);
if (!cdefent) {
abort();
}
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));
} else {
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));
}
#else
/* suppress -Wunused-but-set-variable */
(void)cdefd;
#endif
} else {
jas_eprintf("error: invalid MTYP in CMAP box\n");
goto error;
}
}
}
/* Ensure that the number of channels being used by the decoder
matches the number of image components. */
if (dec->numchans != jas_image_numcmpts(dec->image)) {
jas_eprintf("error: mismatch in number of components (%d != %d)\n",
dec->numchans, jas_image_numcmpts(dec->image));
goto error;
}
/* Mark all components as being of unknown type. */
for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {
jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);
}
/* Determine the type of each component. */
if (dec->cdef) {
for (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {
/* Is the channel number reasonable? */
if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {
jas_eprintf("error: invalid channel number in CDEF box\n");
goto error;
}
jas_image_setcmpttype(dec->image,
dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],
jp2_getct(jas_image_clrspc(dec->image),
dec->cdef->data.cdef.ents[i].type,
dec->cdef->data.cdef.ents[i].assoc));
}
} else {
for (i = 0; i < dec->numchans; ++i) {
jas_image_setcmpttype(dec->image, dec->chantocmptlut[i],
jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));
}
}
/* Delete any components that are not of interest. */
for (i = jas_image_numcmpts(dec->image); i > 0; --i) {
if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {
jas_image_delcmpt(dec->image, i - 1);
}
}
/* Ensure that some components survived. */
if (!jas_image_numcmpts(dec->image)) {
jas_eprintf("error: no components\n");
goto error;
}
#if 0
jas_eprintf("no of components is %d\n", jas_image_numcmpts(dec->image));
#endif
/* Prevent the image from being destroyed later. */
image = dec->image;
dec->image = 0;
jp2_dec_destroy(dec);
return image;
error:
if (box) {
jp2_box_destroy(box);
}
if (dec) {
jp2_dec_destroy(dec);
}
return 0;
}
| 1 |
[
"CWE-476"
] |
jasper
|
c4144a6fdb2660794136d1daaa80682ee40b138b
| 88,965,041,268,641,220,000,000,000,000,000,000,000 | 385 |
Fixes #268 (A Null Pointer dereference).
The JP2 decoder was not checking if a component number referenced by
a CDEF box was valid. This has now been fixed. A new test case
related to this bug has been added to the test suite as well.
|
void xackCommand(client *c) {
streamCG *group = NULL;
robj *o = lookupKeyRead(c->db,c->argv[1]);
if (o) {
if (checkType(c,o,OBJ_STREAM)) return; /* Type error. */
group = streamLookupCG(o->ptr,c->argv[2]->ptr);
}
/* No key or group? Nothing to ack. */
if (o == NULL || group == NULL) {
addReply(c,shared.czero);
return;
}
/* Start parsing the IDs, so that we abort ASAP if there is a syntax
* error: the return value of this command cannot be an error in case
* the client successfully acknowledged some messages, so it should be
* executed in a "all or nothing" fashion. */
streamID static_ids[STREAMID_STATIC_VECTOR_LEN];
streamID *ids = static_ids;
int id_count = c->argc-3;
if (id_count > STREAMID_STATIC_VECTOR_LEN)
ids = zmalloc(sizeof(streamID)*id_count);
for (int j = 3; j < c->argc; j++) {
if (streamParseStrictIDOrReply(c,c->argv[j],&ids[j-3],0,NULL) != C_OK) goto cleanup;
}
int acknowledged = 0;
for (int j = 3; j < c->argc; j++) {
unsigned char buf[sizeof(streamID)];
streamEncodeID(buf,&ids[j-3]);
/* Lookup the ID in the group PEL: it will have a reference to the
* NACK structure that will have a reference to the consumer, so that
* we are able to remove the entry from both PELs. */
streamNACK *nack = raxFind(group->pel,buf,sizeof(buf));
if (nack != raxNotFound) {
raxRemove(group->pel,buf,sizeof(buf),NULL);
raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL);
streamFreeNACK(nack);
acknowledged++;
server.dirty++;
}
}
addReplyLongLong(c,acknowledged);
cleanup:
if (ids != static_ids) zfree(ids);
}
| 0 |
[
"CWE-703",
"CWE-401"
] |
redis
|
4a7a4e42db8ff757cdf3f4a824f66426036034ef
| 289,806,097,638,408,220,000,000,000,000,000,000,000 | 48 |
Fix memory leak in streamGetEdgeID (#10753)
si is initialized by streamIteratorStart(), we should call
streamIteratorStop() on it when done.
regression introduced in #9127 (redis 7.0)
|
mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb)
{
g_error ("This mono runtime was configured with --enable-minimal=reflection_emit_save, so saving of dynamic assemblies is not supported.");
}
| 0 |
[
"CWE-20"
] |
mono
|
4905ef1130feb26c3150b28b97e4a96752e0d399
| 278,387,093,806,461,950,000,000,000,000,000,000,000 | 4 |
Handle invalid instantiation of generic methods.
* verify.c: Add new function to internal verifier API to check
method instantiations.
* reflection.c (mono_reflection_bind_generic_method_parameters):
Check the instantiation before returning it.
Fixes #655847
|
GF_Err gf_isom_get_chapter(GF_ISOFile *movie, u32 trackNumber, u32 Index, u64 *chapter_time, const char **name)
{
GF_UserDataMap *map;
GF_ChapterListBox *lst;
GF_ChapterEntry *ce;
GF_UserDataBox *udta;
if (!movie || !movie->moov) return GF_BAD_PARAM;
udta = NULL;
if (trackNumber) {
GF_TrackBox *trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak) return GF_BAD_PARAM;
udta = trak->udta;
} else {
udta = movie->moov->udta;
}
if (!udta) return GF_BAD_PARAM;
map = udta_getEntry(movie->moov->udta, GF_ISOM_BOX_TYPE_CHPL, NULL);
if (!map) return GF_BAD_PARAM;
lst = (GF_ChapterListBox *)gf_list_get(map->boxes, 0);
if (!lst) return GF_BAD_PARAM;
ce = (GF_ChapterEntry *)gf_list_get(lst->list, Index-1);
if (!ce) return GF_BAD_PARAM;
if (chapter_time) {
*chapter_time = ce->start_time;
*chapter_time /= 10000L;
}
if (name) *name = ce->name;
return GF_OK;
}
| 0 |
[
"CWE-476"
] |
gpac
|
ebfa346eff05049718f7b80041093b4c5581c24e
| 329,519,403,657,565,520,000,000,000,000,000,000,000 | 32 |
fixed #1706
|
inline uint8_t* WireFormatLite::WriteEnumToArray(
int field_number, const RepeatedField<int>& value, uint8_t* target) {
return WritePrimitiveToArray(field_number, value, WriteEnumToArray, target);
}
| 0 |
[
"CWE-703"
] |
protobuf
|
d1635e1496f51e0d5653d856211e8821bc47adc4
| 67,133,330,113,372,390,000,000,000,000,000,000,000 | 4 |
Apply patch
|
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item)
{
if (array == NULL)
{
return;
}
add_item_to_array(array, create_reference(item, &global_hooks));
}
| 0 |
[
"CWE-754",
"CWE-787"
] |
cJSON
|
be749d7efa7c9021da746e685bd6dec79f9dd99b
| 221,289,158,943,388,280,000,000,000,000,000,000,000 | 9 |
Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays
|
rdp_in_unistr(STREAM s, int in_len, char **string, uint32 * str_size)
{
static iconv_t icv_utf16_to_local;
size_t ibl, obl;
char *pin, *pout;
// if not already open
if (!icv_utf16_to_local)
{
icv_utf16_to_local = iconv_open(g_codepage, WINDOWS_CODEPAGE);
if (icv_utf16_to_local == (iconv_t) - 1)
{
logger(Protocol, Error, "rdp_in_unistr(), iconv_open[%s -> %s] fail %p",
WINDOWS_CODEPAGE, g_codepage, icv_utf16_to_local);
abort();
}
}
/* Dynamic allocate of destination string if not provided */
if (*string == NULL)
{
*string = xmalloc(in_len * 2);
*str_size = in_len * 2;
}
ibl = in_len;
obl = *str_size - 1;
pin = (char *) s->p;
pout = *string;
if (iconv(icv_utf16_to_local, (char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
{
if (errno == E2BIG)
{
logger(Protocol, Warning,
"rdp_in_unistr(), server sent an unexpectedly long string, truncating");
}
else
{
logger(Protocol, Warning, "rdp_in_unistr(), iconv fail, errno %d", errno);
free(*string);
*string = NULL;
*str_size = 0;
}
abort();
}
/* we must update the location of the current STREAM for future reads of s->p */
s->p += in_len;
*pout = 0;
if (*string)
*str_size = pout - *string;
}
| 1 |
[
"CWE-119",
"CWE-125",
"CWE-703",
"CWE-787"
] |
rdesktop
|
4dca546d04321a610c1835010b5dad85163b65e1
| 130,065,328,684,911,340,000,000,000,000,000,000,000 | 57 |
Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.
All vulnerabilities was identified and reported by Eyal Itkin.
* Add rdp_protocol_error function that is used in several fixes
* Refactor of process_bitmap_updates
* Fix possible integer overflow in s_check_rem() on 32bit arch
* Fix memory corruption in process_bitmap_data - CVE-2018-8794
* Fix remote code execution in process_bitmap_data - CVE-2018-8795
* Fix remote code execution in process_plane - CVE-2018-8797
* Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
* Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
* Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
* Fix Denial of Service in sec_recv - CVE-2018-20176
* Fix minor information leak in rdpdr_process - CVE-2018-8791
* Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
* Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
* Fix Denial of Service in process_bitmap_data - CVE-2018-8796
* Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
* Fix Denial of Service in process_secondary_order - CVE-2018-8799
* Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
* Fix major information leak in ui_clip_handle_data - CVE-2018-20174
* Fix memory corruption in rdp_in_unistr - CVE-2018-20177
* Fix Denial of Service in process_demand_active - CVE-2018-20178
* Fix remote code execution in lspci_process - CVE-2018-20179
* Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
* Fix remote code execution in seamless_process - CVE-2018-20181
* Fix remote code execution in seamless_process_line - CVE-2018-20182
|
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
| 0 |
[
"CWE-125"
] |
qemu
|
ff0507c239a246fd7215b31c5658fc6a3ee1e4c5
| 197,856,860,502,898,050,000,000,000,000,000,000,000 | 4 |
block/iscsi:fix heap-buffer-overflow in iscsi_aio_ioctl_cb
There is an overflow, the source 'datain.data[2]' is 100 bytes,
but the 'ss' is 252 bytes.This may cause a security issue because
we can access a lot of unrelated memory data.
The len for sbp copy data should take the minimum of mx_sb_len and
sb_len_wr, not the maximum.
If we use iscsi device for VM backend storage, ASAN show stack:
READ of size 252 at 0xfffd149dcfc4 thread T0
#0 0xaaad433d0d34 in __asan_memcpy (aarch64-softmmu/qemu-system-aarch64+0x2cb0d34)
#1 0xaaad45f9d6d0 in iscsi_aio_ioctl_cb /qemu/block/iscsi.c:996:9
#2 0xfffd1af0e2dc (/usr/lib64/iscsi/libiscsi.so.8+0xe2dc)
#3 0xfffd1af0d174 (/usr/lib64/iscsi/libiscsi.so.8+0xd174)
#4 0xfffd1af19fac (/usr/lib64/iscsi/libiscsi.so.8+0x19fac)
#5 0xaaad45f9acc8 in iscsi_process_read /qemu/block/iscsi.c:403:5
#6 0xaaad4623733c in aio_dispatch_handler /qemu/util/aio-posix.c:467:9
#7 0xaaad4622f350 in aio_dispatch_handlers /qemu/util/aio-posix.c:510:20
#8 0xaaad4622f350 in aio_dispatch /qemu/util/aio-posix.c:520
#9 0xaaad46215944 in aio_ctx_dispatch /qemu/util/async.c:298:5
#10 0xfffd1bed12f4 in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x512f4)
#11 0xaaad46227de0 in glib_pollfds_poll /qemu/util/main-loop.c:219:9
#12 0xaaad46227de0 in os_host_main_loop_wait /qemu/util/main-loop.c:242
#13 0xaaad46227de0 in main_loop_wait /qemu/util/main-loop.c:518
#14 0xaaad43d9d60c in qemu_main_loop /qemu/softmmu/vl.c:1662:9
#15 0xaaad4607a5b0 in main /qemu/softmmu/main.c:49:5
#16 0xfffd1a460b9c in __libc_start_main (/lib64/libc.so.6+0x20b9c)
#17 0xaaad43320740 in _start (aarch64-softmmu/qemu-system-aarch64+0x2c00740)
0xfffd149dcfc4 is located 0 bytes to the right of 100-byte region [0xfffd149dcf60,0xfffd149dcfc4)
allocated by thread T0 here:
#0 0xaaad433d1e70 in __interceptor_malloc (aarch64-softmmu/qemu-system-aarch64+0x2cb1e70)
#1 0xfffd1af0e254 (/usr/lib64/iscsi/libiscsi.so.8+0xe254)
#2 0xfffd1af0d174 (/usr/lib64/iscsi/libiscsi.so.8+0xd174)
#3 0xfffd1af19fac (/usr/lib64/iscsi/libiscsi.so.8+0x19fac)
#4 0xaaad45f9acc8 in iscsi_process_read /qemu/block/iscsi.c:403:5
#5 0xaaad4623733c in aio_dispatch_handler /qemu/util/aio-posix.c:467:9
#6 0xaaad4622f350 in aio_dispatch_handlers /qemu/util/aio-posix.c:510:20
#7 0xaaad4622f350 in aio_dispatch /qemu/util/aio-posix.c:520
#8 0xaaad46215944 in aio_ctx_dispatch /qemu/util/async.c:298:5
#9 0xfffd1bed12f4 in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x512f4)
#10 0xaaad46227de0 in glib_pollfds_poll /qemu/util/main-loop.c:219:9
#11 0xaaad46227de0 in os_host_main_loop_wait /qemu/util/main-loop.c:242
#12 0xaaad46227de0 in main_loop_wait /qemu/util/main-loop.c:518
#13 0xaaad43d9d60c in qemu_main_loop /qemu/softmmu/vl.c:1662:9
#14 0xaaad4607a5b0 in main /qemu/softmmu/main.c:49:5
#15 0xfffd1a460b9c in __libc_start_main (/lib64/libc.so.6+0x20b9c)
#16 0xaaad43320740 in _start (aarch64-softmmu/qemu-system-aarch64+0x2c00740)
Reported-by: Euler Robot <[email protected]>
Signed-off-by: Chen Qun <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Reviewed-by: Daniel P. Berrangé <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
|
static int _zzip_fnmatch(char* pattern, char* string, int flags)
{
puts ("<zzip:mmapped:strcmp>");
return strcmp (pattern, string);
}
| 0 |
[
"CWE-119"
] |
zziplib
|
596d9dfce2624e849417d4301e8d67935608aa5e
| 280,797,853,570,639,100,000,000,000,000,000,000,000 | 5 |
memdisk
(.)
|
int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
{
AVCodecContext *avctx = h->avctx;
int ret;
if (!buf || size <= 0)
return -1;
if (buf[0] == 1) {
int i, cnt, nalsize;
const unsigned char *p = buf;
h->is_avc = 1;
if (size < 7) {
av_log(avctx, AV_LOG_ERROR,
"avcC %d too short\n", size);
return AVERROR_INVALIDDATA;
}
/* sps and pps in the avcC always have length coded with 2 bytes,
* so put a fake nal_length_size = 2 while parsing them */
h->nal_length_size = 2;
// Decode sps from avcC
cnt = *(p + 5) & 0x1f; // Number of sps
p += 6;
for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
if(nalsize > size - (p-buf))
return AVERROR_INVALIDDATA;
ret = decode_nal_units(h, p, nalsize, 1);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"Decoding sps %d from avcC failed\n", i);
return ret;
}
p += nalsize;
}
// Decode pps from avcC
cnt = *(p++); // Number of pps
for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
if(nalsize > size - (p-buf))
return AVERROR_INVALIDDATA;
ret = decode_nal_units(h, p, nalsize, 1);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"Decoding pps %d from avcC failed\n", i);
return ret;
}
p += nalsize;
}
// Store right nal length size that will be used to parse all other nals
h->nal_length_size = (buf[4] & 0x03) + 1;
} else {
h->is_avc = 0;
ret = decode_nal_units(h, buf, size, 1);
if (ret < 0)
return ret;
}
return size;
}
| 0 |
[
"CWE-703"
] |
FFmpeg
|
e8714f6f93d1a32f4e4655209960afcf4c185214
| 208,714,526,255,838,800,000,000,000,000,000,000,000 | 61 |
avcodec/h264: Clear delayed_pic on deallocation
Fixes use of freed memory
Fixes: case5_av_frame_copy_props.mp4
Found-by: Michal Zalewski <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
|
static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals,
int indent)
{
POLICYQUALINFO *qualinfo;
int i;
for (i = 0; i < sk_POLICYQUALINFO_num(quals); i++) {
qualinfo = sk_POLICYQUALINFO_value(quals, i);
switch (OBJ_obj2nid(qualinfo->pqualid)) {
case NID_id_qt_cps:
BIO_printf(out, "%*sCPS: %.*s\n", indent, "",
qualinfo->d.cpsuri->length,
qualinfo->d.cpsuri->data);
break;
case NID_id_qt_unotice:
BIO_printf(out, "%*sUser Notice:\n", indent, "");
print_notice(out, qualinfo->d.usernotice, indent + 2);
break;
default:
BIO_printf(out, "%*sUnknown Qualifier: ", indent + 2, "");
i2a_ASN1_OBJECT(out, qualinfo->pqualid);
BIO_puts(out, "\n");
break;
}
}
}
| 0 |
[
"CWE-125"
] |
openssl
|
5f54e57406ca17731b9ade3afd561d3c652e07f2
| 303,267,815,811,594,070,000,000,000,000,000,000,000 | 28 |
Fix POLICYINFO printing to not assume NUL terminated strings
ASN.1 strings may not be NUL terminated. Don't assume they are.
CVE-2021-3712
Reviewed-by: Viktor Dukhovni <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
|
static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
{
char *str, *hint_charset = NULL;
int str_len, hint_charset_len = 0;
size_t new_len;
long flags = ENT_COMPAT;
char *replaced;
zend_bool double_encode = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) {
return;
}
replaced = php_escape_html_entities_ex(str, str_len, &new_len, all, (int) flags, hint_charset, double_encode TSRMLS_CC);
RETVAL_STRINGL(replaced, (int)new_len, 0);
}
| 1 |
[
"CWE-190"
] |
php-src
|
0da8b8b801f9276359262f1ef8274c7812d3dfda
| 297,086,773,833,989,500,000,000,000,000,000,000,000 | 16 |
Fix bug #72135 - don't create strings with lengths outside int range
|
static MemTxResult flatview_write(struct uc_struct *uc, FlatView *fv, hwaddr addr, MemTxAttrs attrs,
const void *buf, hwaddr len)
{
hwaddr l;
hwaddr addr1;
MemoryRegion *mr;
MemTxResult result = MEMTX_OK;
l = len;
mr = flatview_translate(uc, fv, addr, &addr1, &l, true, attrs);
result = flatview_write_continue(uc, fv, addr, attrs, buf, len,
addr1, l, mr);
return result;
}
| 0 |
[
"CWE-476"
] |
unicorn
|
3d3deac5e6d38602b689c4fef5dac004f07a2e63
| 272,498,938,430,625,000,000,000,000,000,000,000,000 | 15 |
Fix crash when mapping a big memory and calling uc_close
|
print_description(oid * objid, size_t objidlen, /* number of subidentifiers */
int width)
{
fprint_description(stdout, objid, objidlen, width);
}
| 0 |
[
"CWE-59",
"CWE-61"
] |
net-snmp
|
4fd9a450444a434a993bc72f7c3486ccce41f602
| 207,551,884,603,735,300,000,000,000,000,000,000,000 | 5 |
CHANGES: snmpd: Stop reading and writing the mib_indexes/* files
Caching directory contents is something the operating system should do
and is not something Net-SNMP should do. Instead of storing a copy of
the directory contents in ${tmp_dir}/mib_indexes/${n}, always scan a
MIB directory.
|
htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
const char *msg, int val)
{
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
(ctxt->instate == XML_PARSER_EOF))
return;
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error,
XML_ERR_ERROR, NULL, 0, NULL, NULL,
NULL, val, 0, msg, val);
if (ctxt != NULL)
ctxt->wellFormed = 0;
}
| 0 |
[
"CWE-399"
] |
libxml2
|
de0cc20c29cb3f056062925395e0f68d2250a46f
| 101,017,555,805,966,620,000,000,000,000,000,000,000 | 14 |
Fix some buffer conversion issues
https://bugzilla.gnome.org/show_bug.cgi?id=690202
Buffer overflow errors originating from xmlBufGetInputBase in 2.9.0
The pointers from the context input were not properly reset after
that call which can do reallocations.
|
void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd)
{
struct page *page;
spin_lock(&mm->page_table_lock);
if (unlikely(!pmd_trans_huge(*pmd))) {
spin_unlock(&mm->page_table_lock);
return;
}
page = pmd_page(*pmd);
VM_BUG_ON(!page_count(page));
get_page(page);
spin_unlock(&mm->page_table_lock);
split_huge_page(page);
put_page(page);
BUG_ON(pmd_trans_huge(*pmd));
}
| 0 |
[
"CWE-399"
] |
linux
|
78f11a255749d09025f54d4e2df4fbcb031530e2
| 116,070,540,161,932,630,000,000,000,000,000,000,000 | 19 |
mm: thp: fix /dev/zero MAP_PRIVATE and vm_flags cleanups
The huge_memory.c THP page fault was allowed to run if vm_ops was null
(which would succeed for /dev/zero MAP_PRIVATE, as the f_op->mmap wouldn't
setup a special vma->vm_ops and it would fallback to regular anonymous
memory) but other THP logics weren't fully activated for vmas with vm_file
not NULL (/dev/zero has a not NULL vma->vm_file).
So this removes the vm_file checks so that /dev/zero also can safely use
THP (the other albeit safer approach to fix this bug would have been to
prevent the THP initial page fault to run if vm_file was set).
After removing the vm_file checks, this also makes huge_memory.c stricter
in khugepaged for the DEBUG_VM=y case. It doesn't replace the vm_file
check with a is_pfn_mapping check (but it keeps checking for VM_PFNMAP
under VM_BUG_ON) because for a is_cow_mapping() mapping VM_PFNMAP should
only be allowed to exist before the first page fault, and in turn when
vma->anon_vma is null (so preventing khugepaged registration). So I tend
to think the previous comment saying if vm_file was set, VM_PFNMAP might
have been set and we could still be registered in khugepaged (despite
anon_vma was not NULL to be registered in khugepaged) was too paranoid.
The is_linear_pfn_mapping check is also I think superfluous (as described
by comment) but under DEBUG_VM it is safe to stay.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=33682
Signed-off-by: Andrea Arcangeli <[email protected]>
Reported-by: Caspar Zhang <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Cc: <[email protected]> [2.6.38.x]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
static int auth_session_timeout_cb(CALLBACK_FRAME) {
pr_event_generate("core.timeout-session", NULL);
pr_response_send_async(R_421,
_("Session Timeout (%d seconds): closing control connection"),
TimeoutSession);
pr_log_pri(PR_LOG_INFO, "%s", "FTP session timed out, disconnected");
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_TIMEOUT,
"TimeoutSession");
/* no need to restart the timer -- session's over */
return 0;
}
| 0 |
[
"CWE-59",
"CWE-295"
] |
proftpd
|
349addc3be4fcdad9bd4ec01ad1ccd916c898ed8
| 223,077,762,070,557,460,000,000,000,000,000,000,000 | 13 |
Walk the entire DefaultRoot path, checking for symlinks of any component,
when AllowChrootSymlinks is disabled.
|
SYSCALL_DEFINE1(dup, unsigned int, fildes)
{
int ret = -EBADF;
struct file *file = fget_raw(fildes);
if (file) {
ret = get_unused_fd_flags(0);
if (ret >= 0)
fd_install(ret, file);
else
fput(file);
}
return ret;
}
| 0 |
[] |
linux
|
0f2122045b946241a9e549c2a76cea54fa58a7ff
| 127,827,932,866,121,660,000,000,000,000,000,000,000 | 14 |
io_uring: don't rely on weak ->files references
Grab actual references to the files_struct. To avoid circular references
issues due to this, we add a per-task note that keeps track of what
io_uring contexts a task has used. When the tasks execs or exits its
assigned files, we cancel requests based on this tracking.
With that, we can grab proper references to the files table, and no
longer need to rely on stashing away ring_fd and ring_file to check
if the ring_fd may have been closed.
Cc: [email protected] # v5.5+
Reviewed-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
|
handle_cyclelogs(CMD_Request *rx_message, CMD_Reply *tx_message)
{
LOG_CycleLogFiles();
tx_message->status = htons(STT_SUCCESS);
}
| 0 |
[
"CWE-189"
] |
chrony
|
7712455d9aa33d0db0945effaa07e900b85987b1
| 230,727,802,753,073,750,000,000,000,000,000,000,000 | 6 |
Fix buffer overflow when processing crafted command packets
When the length of the REQ_SUBNETS_ACCESSED, REQ_CLIENT_ACCESSES
command requests and the RPY_SUBNETS_ACCESSED, RPY_CLIENT_ACCESSES,
RPY_CLIENT_ACCESSES_BY_INDEX, RPY_MANUAL_LIST command replies is
calculated, the number of items stored in the packet is not validated.
A crafted command request/reply can be used to crash the server/client.
Only clients allowed by cmdallow (by default only localhost) can crash
the server.
With chrony versions 1.25 and 1.26 this bug has a smaller security
impact as the server requires the clients to be authenticated in order
to process the subnet and client accesses commands. In 1.27 and 1.28,
however, the invalid calculated length is included also in the
authentication check which may cause another crash.
|
void __fastcall TSCPFileSystem::SCPSink(const UnicodeString TargetDir,
const UnicodeString FileName, const UnicodeString SourceDir,
const TCopyParamType * CopyParam, bool & Success,
TFileOperationProgressType * OperationProgress, int Params,
int Level)
{
struct
{
int SetTime;
TDateTime Modification;
TRights RemoteRights;
int Attrs;
bool Exists;
} FileData;
bool SkipConfirmed = false;
bool Initialized = (Level > 0);
FileData.SetTime = 0;
FSecureShell->SendNull();
while (!OperationProgress->Cancel)
{
// See (switch ... case 'T':)
if (FileData.SetTime) FileData.SetTime--;
// In case of error occurred before control record arrived.
// We can finally use full path here, as we get current path in FileName param
// (we used to set the file into OperationProgress->FileName, but it collided
// with progress outputting, particularly for scripting)
UnicodeString FullFileName = FileName;
try
{
// Receive control record
UnicodeString Line = FSecureShell->ReceiveLine();
if (Line.Length() == 0) FTerminal->FatalError(NULL, LoadStr(SCP_EMPTY_LINE));
if (IsLastLine(Line))
{
// Remote side finished copying, so remote SCP was closed
// and we don't need to terminate it manually, see CopyToLocal()
OperationProgress->SetCancel(csRemoteAbort);
/* TODO 1 : Show stderror to user? */
FSecureShell->ClearStdError();
try
{
// coIgnoreWarnings should allow batch transfer to continue when
// download of one the files fails (user denies overwriting
// of target local file, no read permissions...)
ReadCommandOutput(coExpectNoOutput | coRaiseExcept |
coOnlyReturnCode | coIgnoreWarnings);
if (!Initialized)
{
throw Exception(L"");
}
}
catch(Exception & E)
{
if (!Initialized && FTerminal->Active)
{
FTerminal->TerminalError(&E, LoadStr(SCP_INIT_ERROR));
}
else
{
throw;
}
}
return;
}
else
{
Initialized = true;
// First character distinguish type of control record
wchar_t Ctrl = Line[1];
Line.Delete(1, 1);
switch (Ctrl) {
case 1:
// Error (already logged by ReceiveLine())
throw EScpFileSkipped(NULL, FMTLOAD(REMOTE_ERROR, (Line)));
case 2:
// Fatal error, terminate copying
FTerminal->TerminalError(Line);
return; // Unreachable
case L'E': // Exit
FSecureShell->SendNull();
return;
case L'T':
unsigned long MTime, ATime;
if (swscanf(Line.c_str(), L"%ld %*d %ld %*d", &MTime, &ATime) == 2)
{
FileData.Modification = UnixToDateTime(MTime, FTerminal->SessionData->DSTMode);
FSecureShell->SendNull();
// File time is only valid until next pass
FileData.SetTime = 2;
continue;
}
else
{
SCPError(LoadStr(SCP_ILLEGAL_TIME_FORMAT), False);
}
case L'C':
case L'D':
break; // continue pass switch{}
default:
FTerminal->FatalError(NULL, FMTLOAD(SCP_INVALID_CONTROL_RECORD, (Ctrl, Line)));
}
TFileMasks::TParams MaskParams;
MaskParams.Modification = FileData.Modification;
// We reach this point only if control record was 'C' or 'D'
try
{
FileData.RemoteRights.Octal = CutToChar(Line, L' ', True);
// do not trim leading spaces of the filename
__int64 TSize = StrToInt64(CutToChar(Line, L' ', False).TrimRight());
MaskParams.Size = TSize;
// Security fix: ensure the file ends up where we asked for it.
// (accept only filename, not path)
UnicodeString OnlyFileName = UnixExtractFileName(Line);
if (Line != OnlyFileName)
{
FTerminal->LogEvent(FORMAT(L"Warning: Remote host set a compound pathname '%s'", (Line)));
}
if ((Level == 0) && (OnlyFileName != UnixExtractFileName(FileName)))
{
SCPError(LoadStr(UNREQUESTED_FILE), False);
}
FullFileName = SourceDir + OnlyFileName;
OperationProgress->SetFile(FullFileName);
OperationProgress->SetTransferSize(TSize);
}
catch (Exception &E)
{
{
TSuspendFileOperationProgress Suspend(OperationProgress);
FTerminal->Log->AddException(&E);
}
SCPError(LoadStr(SCP_ILLEGAL_FILE_DESCRIPTOR), false);
}
// last possibility to cancel transfer before it starts
if (OperationProgress->Cancel)
{
throw ESkipFile(NULL, MainInstructions(LoadStr(USER_TERMINATED)));
}
bool Dir = (Ctrl == L'D');
UnicodeString BaseFileName = FTerminal->GetBaseFileName(FullFileName);
if (!CopyParam->AllowTransfer(BaseFileName, osRemote, Dir, MaskParams, IsUnixHiddenFile(BaseFileName)))
{
FTerminal->LogEvent(FORMAT(L"File \"%s\" excluded from transfer",
(FullFileName)));
SkipConfirmed = true;
SCPError(L"", false);
}
if (CopyParam->SkipTransfer(FullFileName, Dir))
{
SkipConfirmed = true;
SCPError(L"", false);
OperationProgress->AddSkippedFileSize(MaskParams.Size);
}
FTerminal->LogFileDetails(FileName, FileData.Modification, MaskParams.Size);
UnicodeString DestFileNameOnly =
FTerminal->ChangeFileName(
CopyParam, OperationProgress->FileName, osRemote,
Level == 0);
UnicodeString DestFileName =
IncludeTrailingBackslash(TargetDir) + DestFileNameOnly;
FileData.Attrs = FileGetAttrFix(ApiPath(DestFileName));
// If getting attrs fails, we suppose, that file/folder doesn't exists
FileData.Exists = (FileData.Attrs != -1);
if (Dir)
{
if (FileData.Exists && !(FileData.Attrs & faDirectory))
{
SCPError(FMTLOAD(NOT_DIRECTORY_ERROR, (DestFileName)), false);
}
if (!FileData.Exists)
{
FILE_OPERATION_LOOP_BEGIN
{
THROWOSIFFALSE(ForceDirectories(ApiPath(DestFileName)));
}
FILE_OPERATION_LOOP_END(FMTLOAD(CREATE_DIR_ERROR, (DestFileName)));
/* SCP: can we set the timestamp for directories ? */
}
UnicodeString FullFileName = SourceDir + OperationProgress->FileName;
SCPSink(DestFileName, FullFileName, UnixIncludeTrailingBackslash(FullFileName),
CopyParam, Success, OperationProgress, Params, Level + 1);
continue;
}
else if (Ctrl == L'C')
{
TDownloadSessionAction Action(FTerminal->ActionLog);
Action.FileName(FTerminal->AbsolutePath(FullFileName, true));
try
{
HANDLE File = NULL;
TStream * FileStream = NULL;
/* TODO 1 : Turn off read-only attr */
try
{
try
{
if (FileExists(ApiPath(DestFileName)))
{
__int64 MTime;
TOverwriteFileParams FileParams;
FileParams.SourceSize = OperationProgress->TransferSize;
FileParams.SourceTimestamp = FileData.Modification;
FTerminal->OpenLocalFile(DestFileName, GENERIC_READ,
NULL, NULL, NULL, &MTime, NULL,
&FileParams.DestSize);
FileParams.DestTimestamp = UnixToDateTime(MTime,
FTerminal->SessionData->DSTMode);
unsigned int Answer =
ConfirmOverwrite(OperationProgress->FileName, DestFileNameOnly, osLocal,
&FileParams, CopyParam, Params, OperationProgress);
switch (Answer)
{
case qaCancel:
OperationProgress->SetCancel(csCancel); // continue on next case
case qaNo:
SkipConfirmed = true;
EXCEPTION;
}
}
Action.Destination(DestFileName);
if (!FTerminal->CreateLocalFile(DestFileName, OperationProgress,
&File, FLAGSET(Params, cpNoConfirmation)))
{
SkipConfirmed = true;
EXCEPTION;
}
FileStream = new TSafeHandleStream((THandle)File);
}
catch (Exception &E)
{
// In this step we can still cancel transfer, so we do it
SCPError(E.Message, false);
throw;
}
// We succeeded, so we confirm transfer to remote side
FSecureShell->SendNull();
// From now we need to finish file transfer, if not it's fatal error
OperationProgress->SetTransferringFile(true);
// Suppose same data size to transfer as to write
// (not true with ASCII transfer)
OperationProgress->SetLocalSize(OperationProgress->TransferSize);
// Will we use ASCII of BINARY file transfer?
OperationProgress->SetAsciiTransfer(
CopyParam->UseAsciiTransfer(BaseFileName, osRemote, MaskParams));
if (FTerminal->Configuration->ActualLogProtocol >= 0)
{
FTerminal->LogEvent(UnicodeString((OperationProgress->AsciiTransfer ? L"Ascii" : L"Binary")) +
L" transfer mode selected.");
}
try
{
// Buffer for one block of data
TFileBuffer BlockBuf;
bool ConvertToken = false;
do
{
BlockBuf.Size = OperationProgress->TransferBlockSize();
BlockBuf.Position = 0;
FSecureShell->Receive(reinterpret_cast<unsigned char *>(BlockBuf.Data), BlockBuf.Size);
OperationProgress->AddTransferred(BlockBuf.Size);
if (OperationProgress->AsciiTransfer)
{
unsigned int PrevBlockSize = BlockBuf.Size;
BlockBuf.Convert(FTerminal->SessionData->EOLType,
FTerminal->Configuration->LocalEOLType, 0, ConvertToken);
OperationProgress->SetLocalSize(
OperationProgress->LocalSize - PrevBlockSize + BlockBuf.Size);
}
// This is crucial, if it fails during file transfer, it's fatal error
FILE_OPERATION_LOOP_BEGIN
{
BlockBuf.WriteToStream(FileStream, BlockBuf.Size);
}
FILE_OPERATION_LOOP_END_EX(FMTLOAD(WRITE_ERROR, (DestFileName)), folNone);
OperationProgress->AddLocallyUsed(BlockBuf.Size);
if (OperationProgress->Cancel == csCancelTransfer)
{
throw Exception(MainInstructions(LoadStr(USER_TERMINATED)));
}
}
while (!OperationProgress->IsLocallyDone() || !
OperationProgress->IsTransferDone());
}
catch (Exception &E)
{
// Every exception during file transfer is fatal
FTerminal->FatalError(&E,
FMTLOAD(COPY_FATAL, (OperationProgress->FileName)));
}
OperationProgress->SetTransferringFile(false);
try
{
SCPResponse();
// If one of following exception occurs, we still need
// to send confirmation to other side
}
catch (EScp &E)
{
FSecureShell->SendNull();
throw;
}
catch (EScpFileSkipped &E)
{
FSecureShell->SendNull();
throw;
}
FSecureShell->SendNull();
if (FileData.SetTime && CopyParam->PreserveTime)
{
FTerminal->UpdateTargetTime(File, FileData.Modification, FTerminal->SessionData->DSTMode);
}
}
__finally
{
if (File) CloseHandle(File);
if (FileStream) delete FileStream;
}
}
catch(Exception & E)
{
if (SkipConfirmed)
{
Action.Cancel();
}
else
{
FTerminal->RollbackAction(Action, OperationProgress, &E);
}
throw;
}
if (FileData.Attrs == -1) FileData.Attrs = faArchive;
int NewAttrs = CopyParam->LocalFileAttrs(FileData.RemoteRights);
if ((NewAttrs & FileData.Attrs) != NewAttrs)
{
FILE_OPERATION_LOOP_BEGIN
{
THROWOSIFFALSE(FileSetAttr(ApiPath(DestFileName), FileData.Attrs | NewAttrs) == 0);
}
FILE_OPERATION_LOOP_END(FMTLOAD(CANT_SET_ATTRS, (DestFileName)));
}
FTerminal->LogFileDone(OperationProgress, DestFileName);
}
}
}
catch (EScpFileSkipped &E)
{
if (!SkipConfirmed)
{
TSuspendFileOperationProgress Suspend(OperationProgress);
TQueryParams Params(qpAllowContinueOnError);
if (FTerminal->QueryUserException(FMTLOAD(COPY_ERROR, (FullFileName)),
&E, qaOK | qaAbort, &Params, qtError) == qaAbort)
{
OperationProgress->SetCancel(csCancel);
}
FTerminal->Log->AddException(&E);
}
// this was inside above condition, but then transfer was considered
// successful, even when for example user refused to overwrite file
Success = false;
}
catch (ESkipFile &E)
{
SCPSendError(E.Message, false);
Success = false;
if (!FTerminal->HandleException(&E)) throw;
}
}
}
| 0 |
[
"CWE-20"
] |
winscp
|
49d876f2c5fc00bcedaa986a7cf6dedd6bf16f54
| 117,274,214,927,609,920,000,000,000,000,000,000,000 | 418 |
Bug 1675: Prevent SCP server sending files that were not requested
https://winscp.net/tracker/1675
Source commit: 4aa587620973bf793fb6e783052277c0f7be4b55
|
callbacks_drawingarea_button_release_event (GtkWidget *widget, GdkEventButton *event)
{
gint index;
if (event->type != GDK_BUTTON_RELEASE)
return TRUE;
switch (screen.state) {
case IN_MOVE:
screen.off_x = 0;
screen.off_y = 0;
render_refresh_rendered_image_on_screen ();
callbacks_switch_to_normal_tool_cursor (screen.tool);
break;
case IN_ZOOM_OUTLINE:
if ((event->state & GDK_SHIFT_MASK) != 0) {
render_zoom_display (ZOOM_OUT_CMOUSE, 0,
event->x, event->y);
}
/* if the user just clicks without dragging, then simply
zoom in a preset amount */
else if ((abs(screen.start_x - event->x) < 4) &&
(abs(screen.start_y - event->y) < 4)) {
render_zoom_display (ZOOM_IN_CMOUSE, 0,
event->x, event->y);
} else {
render_calculate_zoom_from_outline (widget, event);
}
callbacks_switch_to_normal_tool_cursor (screen.tool);
break;
case IN_SELECTION_DRAG:
/* selection will only work with cairo, so do nothing if it's
not compiled */
index = callbacks_get_selected_row_index ();
if ((index >= 0) && mainProject->file[index]->isVisible) {
enum selection_action sel_action = SELECTION_REPLACE;
if (event->state & GDK_SHIFT_MASK)
sel_action = SELECTION_ADD;
else if (event->state & GDK_CONTROL_MASK)
sel_action = SELECTION_TOGGLE;
/* determine if this was just a click or a box drag */
if ((fabs((double)(screen.last_x - screen.start_x)) < 5)
&& (fabs((double)(screen.last_y - screen.start_y)) < 5)) {
render_fill_selection_buffer_from_mouse_click (
event->x, event->y, index,
sel_action);
} else {
render_fill_selection_buffer_from_mouse_drag (
event->x, event->y,
screen.start_x, screen.start_y,
index, sel_action);
}
/* Check if anything was selected */
update_selected_object_message (TRUE);
check_align_files_possibility (&screen.selectionInfo);
} else {
render_refresh_rendered_image_on_screen ();
}
break;
default:
break;
}
screen.state = NORMAL;
return TRUE;
} /* button_release_event */
| 0 |
[
"CWE-200"
] |
gerbv
|
319a8af890e4d0a5c38e6d08f510da8eefc42537
| 95,407,436,775,169,880,000,000,000,000,000,000,000 | 74 |
Remove local alias to parameter array
Normalizing access to `gerbv_simplified_amacro_t::parameter` as a step to fix CVE-2021-40402
|
static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
{
struct inode *inode = mapping->host;
journal_t *journal;
int err;
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) &&
test_opt(inode->i_sb, DELALLOC)) {
/*
* With delalloc we want to sync the file
* so that we can make sure we allocate
* blocks for file
*/
filemap_write_and_wait(mapping);
}
if (EXT4_JOURNAL(inode) &&
ext4_test_inode_state(inode, EXT4_STATE_JDATA)) {
/*
* This is a REALLY heavyweight approach, but the use of
* bmap on dirty files is expected to be extremely rare:
* only if we run lilo or swapon on a freshly made file
* do we expect this to happen.
*
* (bmap requires CAP_SYS_RAWIO so this does not
* represent an unprivileged user DOS attack --- we'd be
* in trouble if mortal users could trigger this path at
* will.)
*
* NB. EXT4_STATE_JDATA is not set on files other than
* regular files. If somebody wants to bmap a directory
* or symlink and gets confused because the buffer
* hasn't yet been flushed to disk, they deserve
* everything they get.
*/
ext4_clear_inode_state(inode, EXT4_STATE_JDATA);
journal = EXT4_JOURNAL(inode);
jbd2_journal_lock_updates(journal);
err = jbd2_journal_flush(journal);
jbd2_journal_unlock_updates(journal);
if (err)
return 0;
}
return generic_block_bmap(mapping, block, ext4_get_block);
}
| 0 |
[
"CWE-703"
] |
linux
|
744692dc059845b2a3022119871846e74d4f6e11
| 27,651,122,334,551,000,000,000,000,000,000,000,000 | 48 |
ext4: use ext4_get_block_write in buffer write
Allocate uninitialized extent before ext4 buffer write and
convert the extent to initialized after io completes.
The purpose is to make sure an extent can only be marked
initialized after it has been written with new data so
we can safely drop the i_mutex lock in ext4 DIO read without
exposing stale data. This helps to improve multi-thread DIO
read performance on high-speed disks.
Skip the nobh and data=journal mount cases to make things simple for now.
Signed-off-by: Jiaying Zhang <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
|
const String *Item_param::query_val_str(THD *thd, String* str) const
{
switch (state) {
case INT_VALUE:
str->set_int(value.integer, unsigned_flag, &my_charset_bin);
break;
case REAL_VALUE:
str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin);
break;
case DECIMAL_VALUE:
if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value,
0, 0, 0, str) > 1)
return &my_null_string;
break;
case TIME_VALUE:
{
char *buf, *ptr;
str->length(0);
/*
TODO: in case of error we need to notify replication
that binary log contains wrong statement
*/
if (str->reserve(MAX_DATE_STRING_REP_LENGTH+3))
break;
/* Create date string inplace */
buf= str->c_ptr_quick();
ptr= buf;
*ptr++= '\'';
ptr+= (uint) my_TIME_to_str(&value.time, ptr, decimals);
*ptr++= '\'';
str->length((uint32) (ptr - buf));
break;
}
case STRING_VALUE:
case LONG_DATA_VALUE:
{
str->length(0);
append_query_string(thd, value.cs_info.character_set_client, &str_value,
str);
break;
}
case NULL_VALUE:
return &my_null_string;
default:
DBUG_ASSERT(0);
}
return str;
}
| 0 |
[] |
server
|
b000e169562697aa072600695d4f0c0412f94f4f
| 171,745,154,972,431,660,000,000,000,000,000,000,000 | 49 |
Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL))
based on:
commit f7316aa0c9a
Author: Ajo Robert <[email protected]>
Date: Thu Aug 24 17:03:21 2017 +0530
Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
COL), NAME_CONST('NAME', NULL))
Backport of Bug#19143243 fix.
NAME_CONST item can return NULL_ITEM type in case of incorrect arguments.
NULL_ITEM has special processing in Item_func_in function.
In Item_func_in::fix_length_and_dec an array of possible comparators is
created. Since NAME_CONST function has NULL_ITEM type, corresponding
array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE.
ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(),
so the NULL_ITEM is attempted compared with an empty comparator.
The fix is to disable the caching of Item_name_const item.
|
static FDrive *get_drv(FDCtrl *fdctrl, int unit)
{
switch (unit) {
case 0: return drv0(fdctrl);
case 1: return drv1(fdctrl);
#if MAX_FD == 4
case 2: return drv2(fdctrl);
case 3: return drv3(fdctrl);
#endif
default: return NULL;
}
}
| 0 |
[
"CWE-787"
] |
qemu
|
defac5e2fbddf8423a354ff0454283a2115e1367
| 301,106,307,000,240,830,000,000,000,000,000,000,000 | 12 |
hw/block/fdc: Prevent end-of-track overrun (CVE-2021-3507)
Per the 82078 datasheet, if the end-of-track (EOT byte in
the FIFO) is more than the number of sectors per side, the
command is terminated unsuccessfully:
* 5.2.5 DATA TRANSFER TERMINATION
The 82078 supports terminal count explicitly through
the TC pin and implicitly through the underrun/over-
run and end-of-track (EOT) functions. For full sector
transfers, the EOT parameter can define the last
sector to be transferred in a single or multisector
transfer. If the last sector to be transferred is a par-
tial sector, the host can stop transferring the data in
mid-sector, and the 82078 will continue to complete
the sector as if a hardware TC was received. The
only difference between these implicit functions and
TC is that they return "abnormal termination" result
status. Such status indications can be ignored if they
were expected.
* 6.1.3 READ TRACK
This command terminates when the EOT specified
number of sectors have been read. If the 82078
does not find an I D Address Mark on the diskette
after the second· occurrence of a pulse on the
INDX# pin, then it sets the IC code in Status Regis-
ter 0 to "01" (Abnormal termination), sets the MA bit
in Status Register 1 to "1", and terminates the com-
mand.
* 6.1.6 VERIFY
Refer to Table 6-6 and Table 6-7 for information
concerning the values of MT and EC versus SC and
EOT value.
* Table 6·6. Result Phase Table
* Table 6-7. Verify Command Result Phase Table
Fix by aborting the transfer when EOT > # Sectors Per Side.
Cc: [email protected]
Cc: Hervé Poussineau <[email protected]>
Fixes: baca51faff0 ("floppy driver: disk geometry auto detect")
Reported-by: Alexander Bulekov <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/339
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Hanna Reitz <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
|
rdpdr_process(STREAM s)
{
uint32 handle;
uint16 vmin;
uint16 component;
uint16 pakid;
logger(Protocol, Debug, "rdpdr_process()");
/* hexdump(s->p, s->end - s->p); */
in_uint16(s, component);
in_uint16(s, pakid);
if (component == RDPDR_CTYP_CORE)
{
switch (pakid)
{
case PAKID_CORE_DEVICE_IOREQUEST:
rdpdr_process_irp(s);
break;
case PAKID_CORE_SERVER_ANNOUNCE:
/* DR_CORE_SERVER_ANNOUNCE_REQ */
in_uint8s(s, 2); /* skip versionMajor */
in_uint16_le(s, vmin); /* VersionMinor */
in_uint32_le(s, g_client_id); /* ClientID */
/* The RDP client is responsibility to provide a random client id
if server version is < 12 */
if (vmin < 0x000c)
g_client_id = 0x815ed39d; /* IP address (use 127.0.0.1) 0x815ed39d */
g_epoch++;
#if WITH_SCARD
/*
* We need to release all SCARD contexts to end all
* current transactions and pending calls
*/
scard_release_all_contexts();
/*
* According to [MS-RDPEFS] 3.2.5.1.2:
*
* If this packet appears after a sequence of other packets,
* it is a signal that the server has reconnected to a new session
* and the whole sequence has been reset. The client MUST treat
* this packet as the beginning of a new sequence.
* The client MUST also cancel all outstanding requests and release
* previous references to all devices.
*
* If any problem arises in the future, please, pay attention to the
* "If this packet appears after a sequence of other packets" part
*
*/
#endif
rdpdr_send_client_announce_reply();
rdpdr_send_client_name_request();
break;
case PAKID_CORE_CLIENTID_CONFIRM:
rdpdr_send_client_device_list_announce();
break;
case PAKID_CORE_DEVICE_REPLY:
in_uint32(s, handle);
logger(Protocol, Debug,
"rdpdr_process(), server connected to resource %d", handle);
break;
case PAKID_CORE_SERVER_CAPABILITY:
rdpdr_send_client_capability_response();
break;
default:
logger(Protocol, Debug,
"rdpdr_process(), pakid 0x%x of component 0x%x", pakid,
component);
break;
}
}
else if (component == RDPDR_CTYP_PRN)
{
if (pakid == PAKID_PRN_CACHE_DATA)
printercache_process(s);
}
else
logger(Protocol, Warning, "rdpdr_process(), unhandled component 0x%x", component);
}
| 1 |
[
"CWE-119",
"CWE-125",
"CWE-703",
"CWE-787"
] |
rdesktop
|
4dca546d04321a610c1835010b5dad85163b65e1
| 218,449,187,538,483,300,000,000,000,000,000,000,000 | 91 |
Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.
All vulnerabilities was identified and reported by Eyal Itkin.
* Add rdp_protocol_error function that is used in several fixes
* Refactor of process_bitmap_updates
* Fix possible integer overflow in s_check_rem() on 32bit arch
* Fix memory corruption in process_bitmap_data - CVE-2018-8794
* Fix remote code execution in process_bitmap_data - CVE-2018-8795
* Fix remote code execution in process_plane - CVE-2018-8797
* Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
* Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
* Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
* Fix Denial of Service in sec_recv - CVE-2018-20176
* Fix minor information leak in rdpdr_process - CVE-2018-8791
* Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
* Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
* Fix Denial of Service in process_bitmap_data - CVE-2018-8796
* Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
* Fix Denial of Service in process_secondary_order - CVE-2018-8799
* Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
* Fix major information leak in ui_clip_handle_data - CVE-2018-20174
* Fix memory corruption in rdp_in_unistr - CVE-2018-20177
* Fix Denial of Service in process_demand_active - CVE-2018-20178
* Fix remote code execution in lspci_process - CVE-2018-20179
* Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
* Fix remote code execution in seamless_process - CVE-2018-20181
* Fix remote code execution in seamless_process_line - CVE-2018-20182
|
static void put_bool(QEMUFile *f, void *pv, size_t size)
{
bool *v = pv;
qemu_put_byte(f, *v);
}
| 0 |
[
"CWE-119"
] |
qemu
|
d2ef4b61fe6d33d2a5dcf100a9b9440de341ad62
| 59,690,819,704,541,190,000,000,000,000,000,000,000 | 5 |
vmstate: fix buffer overflow in target-arm/machine.c
CVE-2013-4531
cpreg_vmstate_indexes is a VARRAY_INT32. A negative value for
cpreg_vmstate_array_len will cause a buffer overflow.
VMSTATE_INT32_LE was supposed to protect against this
but doesn't because it doesn't validate that input is
non-negative.
Fix this macro to valide the value appropriately.
The only other user of VMSTATE_INT32_LE doesn't
ever use negative numbers so it doesn't care.
Reported-by: Anthony Liguori <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
|
xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNodePtr parent TSRMLS_DC)
{
sdlTypePtr type;
xmlNodePtr ret = NULL;
type = enc->sdl_type;
if (type == NULL) {
ret = guess_xml_convert(enc, data, style, parent TSRMLS_CC);
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, enc);
}
return ret;
}
/*FIXME: restriction support
if (type) {
if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
if (type->restrictions->enumeration) {
if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data));
}
}
if (type->restrictions->minLength &&
Z_STRLEN_P(data) < type->restrictions->minLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'");
}
if (type->restrictions->maxLength &&
Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'");
}
if (type->restrictions->length &&
Z_STRLEN_P(data) != type->restrictions->length->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'");
}
}
}
*/
switch(type->kind) {
case XSD_TYPEKIND_SIMPLE:
if (type->encode && enc != &type->encode->details) {
ret = master_to_xml(type->encode, data, style, parent TSRMLS_CC);
} else {
ret = guess_xml_convert(enc, data, style, parent TSRMLS_CC);
}
break;
case XSD_TYPEKIND_LIST:
ret = to_xml_list(enc, data, style, parent TSRMLS_CC);
break;
case XSD_TYPEKIND_UNION:
ret = to_xml_union(enc, data, style, parent TSRMLS_CC);
break;
case XSD_TYPEKIND_COMPLEX:
case XSD_TYPEKIND_RESTRICTION:
case XSD_TYPEKIND_EXTENSION:
if (type->encode &&
(type->encode->details.type == IS_ARRAY ||
type->encode->details.type == SOAP_ENC_ARRAY)) {
return to_xml_array(enc, data, style, parent TSRMLS_CC);
} else {
return to_xml_object(enc, data, style, parent TSRMLS_CC);
}
break;
default:
soap_error0(E_ERROR, "Encoding: Internal Error");
break;
}
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, enc);
}
return ret;
}
| 0 |
[
"CWE-19"
] |
php-src
|
c8eaca013a3922e8383def6158ece2b63f6ec483
| 202,053,214,338,819,400,000,000,000,000,000,000,000 | 71 |
Added type checks
|
static inline u32 open_file_to_av(struct file *file)
{
u32 av = file_to_av(file);
struct inode *inode = file_inode(file);
if (selinux_policycap_openperm() &&
inode->i_sb->s_magic != SOCKFS_MAGIC)
av |= FILE__OPEN;
return av;
}
| 0 |
[
"CWE-349"
] |
linux
|
fb73974172ffaaf57a7c42f35424d9aece1a5af6
| 33,876,285,257,426,896,000,000,000,000,000,000,000 | 11 |
selinux: properly handle multiple messages in selinux_netlink_send()
Fix the SELinux netlink_send hook to properly handle multiple netlink
messages in a single sk_buff; each message is parsed and subject to
SELinux access control. Prior to this patch, SELinux only inspected
the first message in the sk_buff.
Cc: [email protected]
Reported-by: Dmitry Vyukov <[email protected]>
Reviewed-by: Stephen Smalley <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
BOOL ber_read_sequence_tag(wStream* s, int* length)
{
BYTE byte;
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
Stream_Read_UINT8(s, byte);
if (byte != ((BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_SEQUENCE_OF)))
return FALSE;
return ber_read_length(s, length);
}
| 0 |
[
"CWE-476"
] |
FreeRDP
|
0dc22d5a30a1c7d146b2a835b2032668127c33e9
| 131,980,344,560,456,220,000,000,000,000,000,000,000 | 13 |
Fixed a range of BER boundary encoding bugs which would occur when any NLA packet hit the 127 character mark. Removed ber#get_content_length as it was not behaving deterministically.
|
TEST_F(GrpcHealthCheckerImplTest, GoAwayProbeInProgress) {
setupHCWithUnhealthyThreshold(/*threshold=*/1);
cluster_->prioritySet().getMockHostSet(0)->hosts_ = {
makeTestHost(cluster_->info_, "tcp://127.0.0.1:80", simTime())};
expectSessionCreate();
expectHealthcheckStart(0);
health_checker_->start();
expectHealthcheckStop(0);
EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged));
// GOAWAY with NO_ERROR code during check should be handle gracefully.
test_sessions_[0]->codec_client_->raiseGoAway(Http::GoAwayErrorCode::NoError);
respondServiceStatus(0, grpc::health::v1::HealthCheckResponse::SERVING);
expectHostHealthy(true);
// GOAWAY should cause a new connection to be created.
expectClientCreate(0);
expectHealthcheckStart(0);
test_sessions_[0]->interval_timer_->invokeCallback();
expectHealthcheckStop(0);
// Test host state haven't changed.
EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged));
respondServiceStatus(0, grpc::health::v1::HealthCheckResponse::SERVING);
expectHostHealthy(true);
}
| 0 |
[
"CWE-476"
] |
envoy
|
9b1c3962172a972bc0359398af6daa3790bb59db
| 218,171,757,825,491,320,000,000,000,000,000,000,000 | 28 |
healthcheck: fix grpc inline removal crashes (#749)
Signed-off-by: Matt Klein <[email protected]>
Signed-off-by: Pradeep Rao <[email protected]>
|
buffer_write (ProxySide *side,
Buffer *buffer,
GSocket *socket)
{
gssize res;
GOutputVector v;
GError *error = NULL;
GSocketControlMessage **messages = NULL;
int i, n_messages;
GList *l;
if (buffer->send_credentials &&
G_IS_UNIX_CONNECTION (side->connection))
{
g_assert (buffer->size == 1);
if (!g_unix_connection_send_credentials (G_UNIX_CONNECTION (side->connection),
NULL,
&error))
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
{
g_error_free (error);
return FALSE;
}
g_warning ("Error writing credentials to socket: %s", error->message);
g_error_free (error);
side_closed (side);
return FALSE;
}
buffer->pos = 1;
return TRUE;
}
n_messages = g_list_length (buffer->control_messages);
messages = g_new (GSocketControlMessage *, n_messages);
for (l = buffer->control_messages, i = 0; l != NULL; l = l->next, i++)
messages[i] = l->data;
v.buffer = &buffer->data[buffer->pos];
v.size = buffer->size - buffer->pos;
res = g_socket_send_message (socket, NULL, &v, 1,
messages, n_messages,
G_SOCKET_MSG_NONE, NULL, &error);
g_free (messages);
if (res < 0 && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
{
g_error_free (error);
return FALSE;
}
if (res <= 0)
{
if (res < 0)
{
g_warning ("Error writing credentials to socket: %s", error->message);
g_error_free (error);
}
side_closed (side);
return FALSE;
}
g_list_free_full (buffer->control_messages, g_object_unref);
buffer->control_messages = NULL;
buffer->pos += res;
return TRUE;
}
| 0 |
[
"CWE-284",
"CWE-436"
] |
flatpak
|
52346bf187b5a7f1c0fe9075b328b7ad6abe78f6
| 175,179,869,176,747,270,000,000,000,000,000,000,000 | 73 |
Fix vulnerability in dbus proxy
During the authentication all client data is directly forwarded
to the dbus daemon as is, until we detect the BEGIN command after
which we start filtering the binary dbus protocol.
Unfortunately the detection of the BEGIN command in the proxy
did not exactly match the detection in the dbus daemon. A BEGIN
followed by a space or tab was considered ok in the daemon but
not by the proxy. This could be exploited to send arbitrary
dbus messages to the host, which can be used to break out of
the sandbox.
This was noticed by Gabriel Campana of The Google Security Team.
This fix makes the detection of the authentication phase end
match the dbus code. In addition we duplicate the authentication
line validation from dbus, which includes ensuring all data is
ASCII, and limiting the size of a line to 16k. In fact, we add
some extra stringent checks, disallowing ASCII control chars and
requiring that auth lines start with a capital letter.
|
struct mlx5e_tc_tunnel *mlx5e_get_tc_tun(struct net_device *tunnel_dev)
{
if (netif_is_vxlan(tunnel_dev))
return &vxlan_tunnel;
else if (netif_is_geneve(tunnel_dev))
return &geneve_tunnel;
else if (netif_is_gretap(tunnel_dev) ||
netif_is_ip6gretap(tunnel_dev))
return &gre_tunnel;
else
return NULL;
}
| 0 |
[] |
net
|
6c8991f41546c3c472503dff1ea9daaddf9331c2
| 126,732,629,072,350,370,000,000,000,000,000,000,000 | 12 |
net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup
ipv6_stub uses the ip6_dst_lookup function to allow other modules to
perform IPv6 lookups. However, this function skips the XFRM layer
entirely.
All users of ipv6_stub->ip6_dst_lookup use ip_route_output_flow (via the
ip_route_output_key and ip_route_output helpers) for their IPv4 lookups,
which calls xfrm_lookup_route(). This patch fixes this inconsistent
behavior by switching the stub to ip6_dst_lookup_flow, which also calls
xfrm_lookup_route().
This requires some changes in all the callers, as these two functions
take different arguments and have different return types.
Fixes: 5f81bd2e5d80 ("ipv6: export a stub for IPv6 symbols used by vxlan")
Reported-by: Xiumei Mu <[email protected]>
Signed-off-by: Sabrina Dubroca <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
void bnxt_re_query_fw_str(struct ib_device *ibdev, char *str)
{
struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
snprintf(str, IB_FW_VERSION_NAME_MAX, "%d.%d.%d.%d",
rdev->dev_attr.fw_ver[0], rdev->dev_attr.fw_ver[1],
rdev->dev_attr.fw_ver[2], rdev->dev_attr.fw_ver[3]);
}
| 0 |
[
"CWE-400",
"CWE-401"
] |
linux
|
4a9d46a9fe14401f21df69cea97c62396d5fb053
| 15,539,887,246,250,818,000,000,000,000,000,000,000 | 8 |
RDMA: Fix goto target to release the allocated memory
In bnxt_re_create_srq(), when ib_copy_to_udata() fails allocated memory
should be released by goto fail.
Fixes: 37cb11acf1f7 ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Navid Emamdoost <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
|
stonith_walk_ghash(gpointer key, gpointer value, gpointer user_data)
{
StonithNVpair* u = user_data;
if (NVcur <= NVmax && !NVerr) {
u[NVcur].s_name = STRDUP(key);
u[NVcur].s_value = STRDUP(value);
if (u[NVcur].s_name == NULL || u[NVcur].s_value == NULL) {
/* Memory allocation error */
NVerr = TRUE;
return;
}
++NVcur;
}else{
NVerr = TRUE;
}
}
| 0 |
[
"CWE-287"
] |
cluster-glue
|
3d7b464439ee0271da76e0ee9480f3dc14005879
| 259,854,901,508,300,170,000,000,000,000,000,000,000 | 17 |
Medium: stonith: add -E option to get the configuration from the environment
|
static int compat_prepare_timeout(const struct compat_timespec __user *p,
struct timespec *ts)
{
if (compat_get_timespec(ts, p))
return -EFAULT;
if (!timespec_valid(ts))
return -EINVAL;
return 0;
}
| 0 |
[
"CWE-416"
] |
linux
|
f991af3daabaecff34684fd51fac80319d1baad1
| 136,084,728,441,668,880,000,000,000,000,000,000,000 | 9 |
mqueue: fix a use-after-free in sys_mq_notify()
The retry logic for netlink_attachskb() inside sys_mq_notify()
is nasty and vulnerable:
1) The sock refcnt is already released when retry is needed
2) The fd is controllable by user-space because we already
release the file refcnt
so we when retry but the fd has been just closed by user-space
during this small window, we end up calling netlink_detachskb()
on the error path which releases the sock again, later when
the user-space closes this socket a use-after-free could be
triggered.
Setting 'sock' to NULL here should be sufficient to fix it.
Reported-by: GeneBlue <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Manfred Spraul <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
|
on_ps_internal(Point *pt, LSEG *lseg)
{
return FPeq(point_dt(pt, &lseg->p[0]) + point_dt(pt, &lseg->p[1]),
point_dt(&lseg->p[0], &lseg->p[1]));
}
| 0 |
[
"CWE-703",
"CWE-189"
] |
postgres
|
31400a673325147e1205326008e32135a78b4d8a
| 92,136,865,355,529,280,000,000,000,000,000,000,000 | 5 |
Predict integer overflow to avoid buffer overruns.
Several functions, mostly type input functions, calculated an allocation
size such that the calculation wrapped to a small positive value when
arguments implied a sufficiently-large requirement. Writes past the end
of the inadvertent small allocation followed shortly thereafter.
Coverity identified the path_in() vulnerability; code inspection led to
the rest. In passing, add check_stack_depth() to prevent stack overflow
in related functions.
Back-patch to 8.4 (all supported versions). The non-comment hstore
changes touch code that did not exist in 8.4, so that part stops at 9.0.
Noah Misch and Heikki Linnakangas, reviewed by Tom Lane.
Security: CVE-2014-0064
|
bool fieldsMatch(const BSONObj& lhs, const BSONObj& rhs) {
BSONObjIterator l(lhs);
BSONObjIterator r(rhs);
while (l.more() && r.more()){
if (strcmp(l.next().fieldName(), r.next().fieldName())) {
return false;
}
}
return !(l.more() || r.more()); // false if lhs and rhs have diff nFields()
}
| 0 |
[
"CWE-20"
] |
mongo
|
f9817a6cf64bdba8e1e1cef30a798110df746b58
| 109,474,378,398,345,620,000,000,000,000,000,000,000 | 12 |
SERVER-7769 - turn objcheck on by default and use new fast bson validate
|
ReadVariableOp::ReadVariableOp(OpKernelConstruction* c) : OpKernel(c) {
OP_REQUIRES_OK(c, c->GetAttr("dtype", &dtype_));
}
| 0 |
[
"CWE-369"
] |
tensorflow
|
ac117ee8a8ea57b73d34665cdf00ef3303bc0b11
| 244,900,267,295,678,900,000,000,000,000,000,000,000 | 3 |
Prevent division by 0 in `resource_variable_ops.cc`
PiperOrigin-RevId: 387939939
Change-Id: Ib04902d63756633999959a70613f2eaa30c2c151
|
void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
{
char aBuf[1024];
char aAddrStr[NETADDR_MAXSTRSIZE];
CServer* pThis = static_cast<CServer *>(pUser);
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(pThis->m_aClients[i].m_State != CClient::STATE_EMPTY)
{
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
{
const char *pAuthStr = pThis->m_aClients[i].m_Authed == CServer::AUTHED_ADMIN ? "(Admin)" :
pThis->m_aClients[i].m_Authed == CServer::AUTHED_MOD ? "(Mod)" : "";
str_format(aBuf, sizeof(aBuf), "id=%d addr=%s client=%x name='%s' score=%d %s", i, aAddrStr,
pThis->m_aClients[i].m_Version, pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, pAuthStr);
}
else
str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr);
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
}
}
}
| 0 |
[
"CWE-20",
"CWE-703",
"CWE-400"
] |
teeworlds
|
c68402fa7e279d42886d5951d1ea8ac2facc1ea5
| 163,629,336,651,462,830,000,000,000,000,000,000,000 | 24 |
changed a check
|
cr_tknzr_parse_nl (CRTknzr * a_this,
guchar ** a_start,
guchar ** a_end,
CRParsingLocation *a_location)
{
CRInputPos init_pos;
guchar next_chars[2] = { 0 };
enum CRStatus status = CR_PARSING_ERROR;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_start && a_end, CR_BAD_PARAM_ERROR);
RECORD_INITIAL_POS (a_this, &init_pos);
PEEK_BYTE (a_this, 1, &next_chars[0]);
PEEK_BYTE (a_this, 2, &next_chars[1]);
if ((next_chars[0] == '\r' && next_chars[1] == '\n')) {
SKIP_BYTES (a_this, 1);
if (a_location) {
cr_tknzr_get_parsing_location
(a_this, a_location) ;
}
SKIP_CHARS (a_this, 1);
RECORD_CUR_BYTE_ADDR (a_this, a_end);
status = CR_OK;
} else if (next_chars[0] == '\n'
|| next_chars[0] == '\r' || next_chars[0] == '\f') {
SKIP_CHARS (a_this, 1);
if (a_location) {
cr_tknzr_get_parsing_location
(a_this, a_location) ;
}
RECORD_CUR_BYTE_ADDR (a_this, a_start);
*a_end = *a_start;
status = CR_OK;
} else {
status = CR_PARSING_ERROR;
goto error;
}
return CR_OK ;
error:
cr_tknzr_set_cur_pos (a_this, &init_pos) ;
return status;
}
| 0 |
[
"CWE-119"
] |
libcroco
|
9ad72875e9f08e4c519ef63d44cdbd94aa9504f7
| 8,501,280,982,556,379,000,000,000,000,000,000,000 | 48 |
tknzr: support only max long rgb values
This fixes a possible out of bound when reading rgbs which
are longer than the support MAXLONG
|
xf86SetVerbosity(int verb)
{
int save = xf86Verbose;
xf86Verbose = verb;
LogSetParameter(XLOG_VERBOSITY, verb);
return save;
}
| 0 |
[] |
xserver
|
032b1d79b7d04d47814a5b3a9fdd162249fea74c
| 126,598,753,809,237,900,000,000,000,000,000,000,000 | 8 |
xfree86: use the xf86CheckPrivs() helper for modulepath/logfile
v2: Rebase against updated xf86CheckPrivs() helper.
Reviewed-by: Adam Jackson <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
|
print_addr_act(YAFFSFS_INFO * /*fs_file*/, TSK_OFF_T /*a_off*/,
TSK_DADDR_T addr, char * /*buf*/, size_t /*size*/,
TSK_FS_BLOCK_FLAG_ENUM flags, void *a_ptr)
{
YAFFSFS_PRINT_ADDR *print = (YAFFSFS_PRINT_ADDR *) a_ptr;
if (flags & TSK_FS_BLOCK_FLAG_CONT) {
tsk_fprintf(print->hFile, "%" PRIuDADDR " ", addr);
if (++(print->idx) == 8) {
tsk_fprintf(print->hFile, "\n");
print->idx = 0;
}
}
return TSK_WALK_CONT;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
sleuthkit
|
459ae818fc8dae717549810150de4d191ce158f1
| 189,621,870,566,725,060,000,000,000,000,000,000,000 | 17 |
Fix stack buffer overflow in yaffsfs_istat
Prevent a stack buffer overflow in yaffsfs_istat by increasing the buffer size to the size required by tsk_fs_time_to_str.
|
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader) {
xmlDocPtr doc = NULL;
if (reader == NULL)
return(NULL);
if (reader->doc != NULL)
doc = reader->doc;
else if (reader->ctxt != NULL)
doc = reader->ctxt->myDoc;
if (doc == NULL)
return(NULL);
if (doc->version == NULL)
return(NULL);
else
return(CONSTSTR(doc->version));
}
| 0 |
[
"CWE-399"
] |
libxml2
|
213f1fe0d76d30eaed6e5853057defc43e6df2c9
| 44,323,685,228,383,220,000,000,000,000,000,000,000 | 16 |
CVE-2015-1819 Enforce the reader to run in constant memory
One of the operation on the reader could resolve entities
leading to the classic expansion issue. Make sure the
buffer used for xmlreader operation is bounded.
Introduce a new allocation type for the buffers for this effect.
|
static bool list_intersect(struct ldb_kv_private *ldb_kv,
struct dn_list *list,
const struct dn_list *list2)
{
const struct dn_list *short_list, *long_list;
struct dn_list *list3;
unsigned int i;
if (list->count == 0) {
/* 0 & X == 0 */
return true;
}
if (list2->count == 0) {
/* X & 0 == 0 */
list->count = 0;
list->dn = NULL;
return true;
}
/*
* In both of the below we check for strict and in that
* case do not optimise the intersection of this list,
* we must never return an entry not in this
* list. This allows the index for
* SCOPE_ONELEVEL to be trusted.
*/
/* the indexing code is allowed to return a longer list than
what really matches, as all results are filtered by the
full expression at the end - this shortcut avoids a lot of
work in some cases */
if (list->count < 2 && list2->count > 10 && list2->strict == false) {
return true;
}
if (list2->count < 2 && list->count > 10 && list->strict == false) {
list->count = list2->count;
list->dn = list2->dn;
/* note that list2 may not be the parent of list2->dn,
as list2->dn may be owned by ltdb->idxptr. In that
case we expect this reparent call to fail, which is
OK */
talloc_reparent(list2, list, list2->dn);
return true;
}
if (list->count > list2->count) {
short_list = list2;
long_list = list;
} else {
short_list = list;
long_list = list2;
}
list3 = talloc_zero(list, struct dn_list);
if (list3 == NULL) {
return false;
}
list3->dn = talloc_array(list3, struct ldb_val,
MIN(list->count, list2->count));
if (!list3->dn) {
talloc_free(list3);
return false;
}
list3->count = 0;
for (i=0;i<short_list->count;i++) {
/* For the GUID index case, this is a binary search */
if (ldb_kv_dn_list_find_val(
ldb_kv, long_list, &short_list->dn[i]) != -1) {
list3->dn[list3->count] = short_list->dn[i];
list3->count++;
}
}
list->strict |= list2->strict;
list->dn = talloc_steal(list, list3->dn);
list->count = list3->count;
talloc_free(list3);
return true;
}
| 0 |
[
"CWE-703"
] |
samba
|
08c9016cb9f25105c39488770113a1b00f8a4223
| 171,827,172,238,363,630,000,000,000,000,000,000,000 | 82 |
CVE-2021-3670 ldb: Confirm the request has not yet timed out in ldb filter processing
The LDB filter processing is where the time is spent in the LDB stack
but the timeout event will not get run while this is ongoing, so we
must confirm we have not yet timed out manually.
RN: Ensure that the LDB request has not timed out during filter processing
as the LDAP server MaxQueryDuration is otherwise not honoured.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14694
Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Douglas Bagnall <[email protected]>
(cherry picked from commit 1d5b155619bc532c46932965b215bd73a920e56f)
|
vte_sequence_handler_local_charset (VteTerminal *terminal, GValueArray *params)
{
G_CONST_RETURN char *locale_encoding;
g_get_charset(&locale_encoding);
vte_terminal_set_encoding(terminal, locale_encoding);
}
| 0 |
[] |
vte
|
58bc3a942f198a1a8788553ca72c19d7c1702b74
| 238,377,566,791,939,800,000,000,000,000,000,000,000 | 6 |
fix bug #548272
svn path=/trunk/; revision=2365
|
static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
{
switch (msr->index) {
case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC:
if (!nested)
return 1;
return vmx_get_vmx_msr(&vmcs_config.nested, msr->index, &msr->data);
case MSR_IA32_PERF_CAPABILITIES:
msr->data = vmx_get_perf_capabilities();
return 0;
default:
return KVM_MSR_RET_INVALID;
}
}
| 0 |
[
"CWE-787"
] |
linux
|
04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a
| 166,324,062,831,808,450,000,000,000,000,000,000,000 | 14 |
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for
an array access. Since vcpu->run is (can be) mapped to a user address
space with a writer permission, the 'ndata' could be updated by the
user process at anytime (the user process can set it to outside the
bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.
Fixes: 1aa561b1a4c0 ("kvm: x86: Add "last CPU" to some KVM_EXIT information")
Signed-off-by: Reiji Watanabe <[email protected]>
Reviewed-by: Jim Mattson <[email protected]>
Message-Id: <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
|
void btrt_box_del(GF_Box *s)
{
GF_BitRateBox *ptr = (GF_BitRateBox *)s;
if (ptr) gf_free(ptr);
}
| 0 |
[
"CWE-401"
] |
gpac
|
0a85029d694f992f3631e2f249e4999daee15cbf
| 331,951,551,577,767,470,000,000,000,000,000,000,000 | 5 |
fixed #1785 (fuzz)
|
XStoreName (
register Display *dpy,
Window w,
_Xconst char *name)
{
if (strlen(name) >= USHRT_MAX)
return 0;
return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, /* */
8, PropModeReplace, (_Xconst unsigned char *)name,
name ? (int) strlen(name) : 0);
}
| 0 |
[
"CWE-120"
] |
libx11
|
8d2e02ae650f00c4a53deb625211a0527126c605
| 232,406,707,756,752,440,000,000,000,000,000,000,000 | 11 |
Reject string longer than USHRT_MAX before sending them on the wire
The X protocol uses CARD16 values to represent the length so
this would overflow.
CVE-2021-31535
Signed-off-by: Matthieu Herrb <[email protected]>
|
void oidc_util_hdr_in_set(const request_rec *r, const char *name,
const char *value) {
oidc_util_hdr_table_set(r, r->headers_in, name, value);
}
| 0 |
[
"CWE-79"
] |
mod_auth_openidc
|
55ea0a085290cd2c8cdfdd960a230cbc38ba8b56
| 229,902,656,091,124,400,000,000,000,000,000,000,000 | 4 |
Add a function to escape Javascript characters
|
static int selinux_binder_transfer_binder(struct task_struct *from,
struct task_struct *to)
{
u32 fromsid = task_sid(from);
u32 tosid = task_sid(to);
return avc_has_perm(fromsid, tosid, SECCLASS_BINDER, BINDER__TRANSFER,
NULL);
}
| 0 |
[
"CWE-682"
] |
linux-stable
|
0c461cb727d146c9ef2d3e86214f498b78b7d125
| 245,121,100,587,506,270,000,000,000,000,000,000,000 | 9 |
selinux: fix off-by-one in setprocattr
SELinux tries to support setting/clearing of /proc/pid/attr attributes
from the shell by ignoring terminating newlines and treating an
attribute value that begins with a NUL or newline as an attempt to
clear the attribute. However, the test for clearing attributes has
always been wrong; it has an off-by-one error, and this could further
lead to reading past the end of the allocated buffer since commit
bb646cdb12e75d82258c2f2e7746d5952d3e321a ("proc_pid_attr_write():
switch to memdup_user()"). Fix the off-by-one error.
Even with this fix, setting and clearing /proc/pid/attr attributes
from the shell is not straightforward since the interface does not
support multiple write() calls (so shells that write the value and
newline separately will set and then immediately clear the attribute,
requiring use of echo -n to set the attribute), whereas trying to use
echo -n "" to clear the attribute causes the shell to skip the
write() call altogether since POSIX says that a zero-length write
causes no side effects. Thus, one must use echo -n to set and echo
without -n to clear, as in the following example:
$ echo -n unconfined_u:object_r:user_home_t:s0 > /proc/$$/attr/fscreate
$ cat /proc/$$/attr/fscreate
unconfined_u:object_r:user_home_t:s0
$ echo "" > /proc/$$/attr/fscreate
$ cat /proc/$$/attr/fscreate
Note the use of /proc/$$ rather than /proc/self, as otherwise
the cat command will read its own attribute value, not that of the shell.
There are no users of this facility to my knowledge; possibly we
should just get rid of it.
UPDATE: Upon further investigation it appears that a local process
with the process:setfscreate permission can cause a kernel panic as a
result of this bug. This patch fixes CVE-2017-2618.
Signed-off-by: Stephen Smalley <[email protected]>
[PM: added the update about CVE-2017-2618 to the commit description]
Cc: [email protected] # 3.5: d6ea83ec6864e
Signed-off-by: Paul Moore <[email protected]>
Signed-off-by: James Morris <[email protected]>
|
static int vm_stat_get(void *_offset, u64 *val)
{
unsigned offset = (long)_offset;
struct kvm *kvm;
struct kvm_stat_data stat_tmp = {.offset = offset};
u64 tmp_val;
*val = 0;
spin_lock(&kvm_lock);
list_for_each_entry(kvm, &vm_list, vm_list) {
stat_tmp.kvm = kvm;
vm_stat_get_per_vm((void *)&stat_tmp, &tmp_val);
*val += tmp_val;
}
spin_unlock(&kvm_lock);
return 0;
}
| 0 |
[
"CWE-416",
"CWE-362"
] |
linux
|
cfa39381173d5f969daf43582c95ad679189cbc9
| 242,717,017,845,742,500,000,000,000,000,000,000,000 | 17 |
kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974)
kvm_ioctl_create_device() does the following:
1. creates a device that holds a reference to the VM object (with a borrowed
reference, the VM's refcount has not been bumped yet)
2. initializes the device
3. transfers the reference to the device to the caller's file descriptor table
4. calls kvm_get_kvm() to turn the borrowed reference to the VM into a real
reference
The ownership transfer in step 3 must not happen before the reference to the VM
becomes a proper, non-borrowed reference, which only happens in step 4.
After step 3, an attacker can close the file descriptor and drop the borrowed
reference, which can cause the refcount of the kvm object to drop to zero.
This means that we need to grab a reference for the device before
anon_inode_getfd(), otherwise the VM can disappear from under us.
Fixes: 852b6d57dc7f ("kvm: add device control API")
Cc: [email protected]
Signed-off-by: Jann Horn <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
njs_generate_function_expression(njs_vm_t *vm, njs_generator_t *generator,
njs_parser_node_t *node)
{
njs_int_t ret;
njs_variable_t *var;
njs_function_lambda_t *lambda;
njs_vmcode_function_t *function;
const njs_lexer_entry_t *lex_entry;
var = njs_variable_reference(vm, node->left);
if (njs_slow_path(var == NULL)) {
ret = njs_generate_reference_error(vm, generator, node->left);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
return njs_generator_stack_pop(vm, generator, NULL);
}
lambda = node->u.value.data.u.lambda;
lex_entry = njs_lexer_entry(var->unique_id);
if (njs_slow_path(lex_entry == NULL)) {
return NJS_ERROR;
}
ret = njs_generate_function_scope(vm, generator, lambda, node,
&lex_entry->name);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
njs_generate_code(generator, njs_vmcode_function_t, function,
NJS_VMCODE_FUNCTION, 1, node);
function->lambda = lambda;
function->async = (node->token_type == NJS_TOKEN_ASYNC_FUNCTION_EXPRESSION);
node->index = njs_generate_object_dest_index(vm, generator, node);
if (njs_slow_path(node->index == NJS_INDEX_ERROR)) {
return NJS_ERROR;
}
function->retval = node->index;
return njs_generator_stack_pop(vm, generator, NULL);
}
| 0 |
[
"CWE-703",
"CWE-754"
] |
njs
|
404553896792b8f5f429dc8852d15784a59d8d3e
| 168,953,969,585,953,270,000,000,000,000,000,000,000 | 46 |
Fixed break instruction in a try-catch block.
Previously, JUMP offset for a break instruction inside a try-catch
block was not set to a correct offset during code generation
when a return instruction was present in inner try-catch block.
The fix is to update the JUMP offset appropriately.
This closes #553 issue on Github.
|
_zip_write4(unsigned int i, FILE *fp)
{
putc(i&0xff, fp);
putc((i>>8)&0xff, fp);
putc((i>>16)&0xff, fp);
putc((i>>24)&0xff, fp);
return;
}
| 0 |
[
"CWE-189"
] |
php-src
|
ef8fc4b53d92fbfcd8ef1abbd6f2f5fe2c4a11e5
| 297,860,594,152,016,460,000,000,000,000,000,000,000 | 9 |
Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary
|
static int rtrs_rdma_conn_rejected(struct rtrs_clt_con *con,
struct rdma_cm_event *ev)
{
struct rtrs_path *s = con->c.path;
const struct rtrs_msg_conn_rsp *msg;
const char *rej_msg;
int status, errno;
u8 data_len;
status = ev->status;
rej_msg = rdma_reject_msg(con->c.cm_id, status);
msg = rdma_consumer_reject_data(con->c.cm_id, ev, &data_len);
if (msg && data_len >= sizeof(*msg)) {
errno = (int16_t)le16_to_cpu(msg->errno);
if (errno == -EBUSY)
rtrs_err(s,
"Previous session is still exists on the server, please reconnect later\n");
else
rtrs_err(s,
"Connect rejected: status %d (%s), rtrs errno %d\n",
status, rej_msg, errno);
} else {
rtrs_err(s,
"Connect rejected but with malformed message: status %d (%s)\n",
status, rej_msg);
}
return -ECONNRESET;
}
| 0 |
[
"CWE-415"
] |
linux
|
8700af2cc18c919b2a83e74e0479038fd113c15d
| 338,997,142,319,541,360,000,000,000,000,000,000,000 | 30 |
RDMA/rtrs-clt: Fix possible double free in error case
Callback function rtrs_clt_dev_release() for put_device() calls kfree(clt)
to free memory. We shouldn't call kfree(clt) again, and we can't use the
clt after kfree too.
Replace device_register() with device_initialize() and device_add() so that
dev_set_name can() be used appropriately.
Move mutex_destroy() to the release function so it can be called in
the alloc_clt err path.
Fixes: eab098246625 ("RDMA/rtrs-clt: Refactor the failure cases in alloc_clt")
Link: https://lore.kernel.org/r/[email protected]
Reported-by: Miaoqian Lin <[email protected]>
Signed-off-by: Md Haris Iqbal <[email protected]>
Reviewed-by: Jack Wang <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
|
static int ntop_get_interface_host_activitymap(lua_State* vm) {
NetworkInterface *ntop_interface = getCurrentInterface(vm);
char *host_ip;
GenericHost *h;
u_int16_t vlan_id = 0;
char buf[64];
ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__);
if(!ntop_interface) return(CONST_LUA_ERROR);
if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR);
get_host_vlan_info((char*)lua_tostring(vm, 1), &host_ip, &vlan_id, buf, sizeof(buf));
/* Optional VLAN id */
if(lua_type(vm, 2) == LUA_TNUMBER) vlan_id = (u_int16_t)lua_tonumber(vm, 2);
h = ntop_interface->getHost(host_ip, vlan_id);
if(h == NULL)
return(CONST_LUA_ERROR);
else {
if(h->match(get_allowed_nets(vm))) {
char *json = h->getJsonActivityMap();
lua_pushfstring(vm, "%s", json);
free(json);
}
return(CONST_LUA_OK);
}
}
| 0 |
[
"CWE-476"
] |
ntopng
|
01f47e04fd7c8d54399c9e465f823f0017069f8f
| 169,958,788,991,656,050,000,000,000,000,000,000,000 | 32 |
Security fix: prevents empty host from being used
|
switch (recv_into_rbuf (h)) {
case -1: SET_NEXT_STATE (%.DEAD); return 0;
case 1:
save_reply_state (h);
SET_NEXT_STATE (%.READY);
return 0;
case 0:
length = be32toh (h->sbuf.sr.structured_reply.length);
offset = be64toh (h->sbuf.sr.payload.offset_data.offset);
assert (cmd); /* guaranteed by CHECK */
assert (cmd->data && cmd->type == NBD_CMD_READ);
cmd->data_seen = true;
/* Length of the data following. */
length -= 8;
/* Is the data within bounds? */
if (! structured_reply_in_bounds (offset, length, cmd)) {
SET_NEXT_STATE (%.DEAD);
return 0;
}
/* Now this is the byte offset in the read buffer. */
offset -= cmd->offset;
/* Set up to receive the data directly to the user buffer. */
h->rbuf = cmd->data + offset;
h->rlen = length;
SET_NEXT_STATE (%RECV_OFFSET_DATA_DATA);
}
| 0 |
[] |
libnbd
|
2c1987fc23d6d0f537edc6d4701e95a2387f7917
| 135,021,046,535,239,000,000,000,000,000,000,000,000 | 31 |
lib: Fix stack corruption with structured reply containing negative offset.
Because of improper bounds checking, when receiving a structured reply
some offset/lengths sent by the server could cause libnbd to execute
arbitrary code under control of a malicious server.
A structured reply segment containing (for example):
offset = 18446744073709551615 (== (uint64_t) -1,
or similar negative offsets)
length = 100 (any small positive number < request count)
In both original bounds tests the error case would not be reached:
if (offset < cmd->offset) { // very large < 0
// error case
}
if (offset + length > cmd->count) { // 99 > 512
// error case
}
The result of the negative offset is that data under control of the
server is written to memory before the read buffer supplied by the
client. If the read buffer is located on the stack then this allows
the stack return address from nbd_pread() to be trivially modified,
allowing arbitrary code execution under the control of the server. If
the buffer is located on the heap then other memory objects before the
buffer can be overwritten, which again would usually lead to arbitrary
code execution.
This commit adds a central function to handle bounds checking for all
cases, and the corrected bounds check is written once in this function.
This bug was found by fuzzing libnbd with American Fuzzy Lop as
described here:
https://groups.google.com/forum/#!topic/afl-users/WZzAnfItxM4
(cherry picked from commit f75f602a6361c0c5f42debfeea6980f698ce7f09)
|
TEST_F(OAuth2Test, CookieValidatorInvalidExpiresAt) {
Http::TestRequestHeaderMapImpl request_headers{
{Http::Headers::get().Host.get(), "traffic.example.com"},
{Http::Headers::get().Path.get(), "/anypath"},
{Http::Headers::get().Method.get(), Http::Headers::get().MethodValues.Get},
{Http::Headers::get().Cookie.get(), "OauthExpires=notanumber;version=test"},
{Http::Headers::get().Cookie.get(), "BearerToken=xyztoken;version=test"},
{Http::Headers::get().Cookie.get(),
"OauthHMAC="
"M2NjZmIxYWE0NzQzOGZlZTJjMjQwMzBiZTU5OTdkN2Y0NDRhZjE5MjZiOWNhY2YzNjM0MWRmMTNkMDVmZWFlOQ=="
";version=test"},
};
auto cookie_validator = std::make_shared<OAuth2CookieValidator>(
test_time_, CookieNames{"BearerToken", "OauthHMAC", "OauthExpires"});
cookie_validator->setParams(request_headers, "mock-secret");
EXPECT_TRUE(cookie_validator->hmacIsValid());
EXPECT_FALSE(cookie_validator->timestampIsValid());
EXPECT_FALSE(cookie_validator->isValid());
}
| 0 |
[
"CWE-416"
] |
envoy
|
7ffda4e809dec74449ebc330cebb9d2f4ab61360
| 282,485,540,523,781,750,000,000,000,000,000,000,000 | 21 |
oauth2: do not blindly accept requests with a token in the Authorization headera (781)
The logic was broken because it assumed an additional call would be
performed to the auth server, which isn't the case. Per the filter
documentation, a request is only considered subsequently authenticated
if there's valid cookie that was set after the access token was received
from the auth server:
https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/oauth2_filter
More info about how to validate an access token (which we don't do, per
above):
https://www.oauth.com/oauth2-servers/token-introspection-endpoint/
https://datatracker.ietf.org/doc/html/rfc7662
Also fix the fact that ee shouldn't be calling continueDecoding() after
decoder_callbacks_->encodeHeaders().
Signed-off-by: Raul Gutierrez Segales <[email protected]>
Signed-off-by: Matt Klein <[email protected]>
Signed-off-by: Pradeep Rao <[email protected]>
|
static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
{
__be32 *savep;
uint32_t attrlen, bitmap[2];
int status;
if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
goto xdr_error;
if ((status = decode_attr_bitmap(xdr, bitmap)) != 0)
goto xdr_error;
if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0)
goto xdr_error;
fsinfo->rtmult = fsinfo->wtmult = 512; /* ??? */
if ((status = decode_attr_lease_time(xdr, bitmap, &fsinfo->lease_time)) != 0)
goto xdr_error;
if ((status = decode_attr_maxfilesize(xdr, bitmap, &fsinfo->maxfilesize)) != 0)
goto xdr_error;
if ((status = decode_attr_maxread(xdr, bitmap, &fsinfo->rtmax)) != 0)
goto xdr_error;
fsinfo->rtpref = fsinfo->dtpref = fsinfo->rtmax;
if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0)
goto xdr_error;
fsinfo->wtpref = fsinfo->wtmax;
status = verify_attr_len(xdr, savep, attrlen);
xdr_error:
dprintk("%s: xdr returned %d!\n", __func__, -status);
return status;
}
| 0 |
[
"CWE-703"
] |
linux
|
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
| 140,593,477,416,635,140,000,000,000,000,000,000,000 | 31 |
NFSv4: Convert the open and close ops to use fmode
Signed-off-by: Trond Myklebust <[email protected]>
|
int snd_seq_queue_timer_open(int queueid)
{
int result = 0;
struct snd_seq_queue *queue;
struct snd_seq_timer *tmr;
queue = queueptr(queueid);
if (queue == NULL)
return -EINVAL;
tmr = queue->timer;
if ((result = snd_seq_timer_open(queue)) < 0) {
snd_seq_timer_defaults(tmr);
result = snd_seq_timer_open(queue);
}
queuefree(queue);
return result;
}
| 0 |
[
"CWE-362"
] |
linux
|
3567eb6af614dac436c4b16a8d426f9faed639b3
| 240,927,041,901,921,000,000,000,000,000,000,000,000 | 17 |
ALSA: seq: Fix race at timer setup and close
ALSA sequencer code has an open race between the timer setup ioctl and
the close of the client. This was triggered by syzkaller fuzzer, and
a use-after-free was caught there as a result.
This patch papers over it by adding a proper queue->timer_mutex lock
around the timer-related calls in the relevant code path.
Reported-by: Dmitry Vyukov <[email protected]>
Tested-by: Dmitry Vyukov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
|
Subsets and Splits
CWE 416 & 19
The query filters records related to specific CWEs (Common Weakness Enumerations), providing a basic overview of entries with these vulnerabilities but without deeper analysis.
CWE Frequency in Train Set
Counts the occurrences of each CWE (Common Weakness Enumeration) in the dataset, providing a basic distribution but limited insight.