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
void cliprdr_free_format_list(CLIPRDR_FORMAT_LIST* formatList) { UINT index = 0; if (formatList == NULL) return; if (formatList->formats) { for (index = 0; index < formatList->numFormats; index++) { free(formatList->formats[index].formatName); } free(formatList->formats); } }
1
[ "CWE-125" ]
FreeRDP
b73143cf7ee5fe4cdabcbf56908aa15d8a883821
4,400,417,930,766,210,000,000,000,000,000,000,000
17
Fixed oob read in cliprdr_read_format_list
static int can_contain(cmark_syntax_extension *extension, cmark_node *node, cmark_node_type child_type) { if (node->type == CMARK_NODE_TABLE) { return child_type == CMARK_NODE_TABLE_ROW; } else if (node->type == CMARK_NODE_TABLE_ROW) { return child_type == CMARK_NODE_TABLE_CELL; } else if (node->type == CMARK_NODE_TABLE_CELL) { return child_type == CMARK_NODE_TEXT || child_type == CMARK_NODE_CODE || child_type == CMARK_NODE_EMPH || child_type == CMARK_NODE_STRONG || child_type == CMARK_NODE_LINK || child_type == CMARK_NODE_IMAGE || child_type == CMARK_NODE_STRIKETHROUGH || child_type == CMARK_NODE_HTML_INLINE || child_type == CMARK_NODE_FOOTNOTE_REFERENCE; } return false; }
0
[ "CWE-190" ]
cmark-gfm
b1687e6af1367c596ab75428b03af55666a66530
141,421,546,446,486,390,000,000,000,000,000,000,000
16
prevent integer overflow in row_from_string * added explicit check for UINT16_MAX boundary on row->n_columns * added additional checks for row_from_string NULL returns to prevent NULL dereferences on error cases * added additional check to ensure n_columns between marker and header rows always match prior to any alignment processing * allocate alignment array based on marker rows rather than header rows * prevent memory leak on dangling node when encountering row_from_string error in try_opening_table_row * add explicit integer overflow error marker to not overload offset semantics in row_from_string with other implied error conditions
static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num) { BDRVVPCState *s = bs->opaque; int64_t bat_offset; uint32_t index, bat_value; int ret; uint8_t bitmap[s->bitmap_size]; // Check if sector_num is valid if ((sector_num < 0) || (sector_num > bs->total_sectors)) return -1; // Write entry into in-memory BAT index = (sector_num * 512) / s->block_size; if (s->pagetable[index] != 0xFFFFFFFF) return -1; s->pagetable[index] = s->free_data_block_offset / 512; // Initialize the block's bitmap memset(bitmap, 0xff, s->bitmap_size); ret = bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size); if (ret < 0) { return ret; } // Write new footer (the old one will be overwritten) s->free_data_block_offset += s->block_size + s->bitmap_size; ret = rewrite_footer(bs); if (ret < 0) goto fail; // Write BAT entry to disk bat_offset = s->bat_offset + (4 * index); bat_value = be32_to_cpu(s->pagetable[index]); ret = bdrv_pwrite_sync(bs->file, bat_offset, &bat_value, 4); if (ret < 0) goto fail; return get_sector_offset(bs, sector_num, 0); fail: s->free_data_block_offset -= (s->block_size + s->bitmap_size); return -1; }
0
[ "CWE-20" ]
qemu
97f1c45c6f456572e5b504b8614e4a69e23b8e3a
273,343,768,685,938,360,000,000,000,000,000,000,000
46
vpc/vhd: add bounds check for max_table_entries and block_size (CVE-2014-0144) This adds checks to make sure that max_table_entries and block_size are in sane ranges. Memory is allocated based on max_table_entries, and block_size is used to calculate indices into that allocated memory, so if these values are incorrect that can lead to potential unbounded memory allocation, or invalid memory accesses. Also, the allocation of the pagetable is changed from g_malloc0() to qemu_blockalign(). Signed-off-by: Jeff Cody <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> Reviewed-by: Max Reitz <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]>
static void inode_free_security(struct inode *inode) { struct inode_security_struct *isec = selinux_inode(inode); struct superblock_security_struct *sbsec; if (!isec) return; sbsec = selinux_superblock(inode->i_sb); /* * As not all inode security structures are in a list, we check for * empty list outside of the lock to make sure that we won't waste * time taking a lock doing nothing. * * The list_del_init() function can be safely called more than once. * It should not be possible for this function to be called with * concurrent list_add(), but for better safety against future changes * in the code, we use list_empty_careful() here. */ if (!list_empty_careful(&isec->list)) { spin_lock(&sbsec->isec_lock); list_del_init(&isec->list); spin_unlock(&sbsec->isec_lock); } }
0
[ "CWE-416" ]
linux
a3727a8bac0a9e77c70820655fd8715523ba3db7
225,854,222,432,839,420,000,000,000,000,000,000,000
24
selinux,smack: fix subjective/objective credential use mixups Jann Horn reported a problem with commit eb1231f73c4d ("selinux: clarify task subjective and objective credentials") where some LSM hooks were attempting to access the subjective credentials of a task other than the current task. Generally speaking, it is not safe to access another task's subjective credentials and doing so can cause a number of problems. Further, while looking into the problem, I realized that Smack was suffering from a similar problem brought about by a similar commit 1fb057dcde11 ("smack: differentiate between subjective and objective task credentials"). This patch addresses this problem by restoring the use of the task's objective credentials in those cases where the task is other than the current executing task. Not only does this resolve the problem reported by Jann, it is arguably the correct thing to do in these cases. Cc: [email protected] Fixes: eb1231f73c4d ("selinux: clarify task subjective and objective credentials") Fixes: 1fb057dcde11 ("smack: differentiate between subjective and objective task credentials") Reported-by: Jann Horn <[email protected]> Acked-by: Eric W. Biederman <[email protected]> Acked-by: Casey Schaufler <[email protected]> Signed-off-by: Paul Moore <[email protected]>
static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations *res) { struct xdr_stream xdr; struct compound_hdr hdr; int status; xdr_init_decode(&xdr, &req->rq_rcv_buf, p); status = decode_compound_hdr(&xdr, &hdr); if (status != 0) goto out; if ((status = decode_putfh(&xdr)) != 0) goto out; if ((status = decode_lookup(&xdr)) != 0) goto out; xdr_enter_page(&xdr, PAGE_SIZE); status = decode_getfattr(&xdr, &res->fattr, res->server); out: return status; }
0
[ "CWE-703" ]
linux
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
222,175,501,398,114,040,000,000,000,000,000,000,000
19
NFSv4: Convert the open and close ops to use fmode Signed-off-by: Trond Myklebust <[email protected]>
static int fts3FindFunctionMethod( sqlite3_vtab *pVtab, /* Virtual table handle */ int nArg, /* Number of SQL function arguments */ const char *zName, /* Name of SQL function */ void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */ void **ppArg /* Unused */ ){ struct Overloaded { const char *zName; void (*xFunc)(sqlite3_context*,int,sqlite3_value**); } aOverload[] = { { "snippet", fts3SnippetFunc }, { "offsets", fts3OffsetsFunc }, { "optimize", fts3OptimizeFunc }, { "matchinfo", fts3MatchinfoFunc }, }; int i; /* Iterator variable */ UNUSED_PARAMETER(pVtab); UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(ppArg); for(i=0; i<SizeofArray(aOverload); i++){ if( strcmp(zName, aOverload[i].zName)==0 ){ *pxFunc = aOverload[i].xFunc; return 1; } } /* No function of the specified name was found. Return 0. */ return 0; }
0
[ "CWE-787" ]
sqlite
c72f2fb7feff582444b8ffdc6c900c69847ce8a9
185,587,328,904,326,140,000,000,000,000,000,000,000
32
More improvements to shadow table corruption detection in FTS3. FossilOrigin-Name: 51525f9c3235967bc00a090e84c70a6400698c897aa4742e817121c725b8c99d
push_symbol(Str str, char symbol, int width, int n) { char buf[2], *p; int i; #ifdef USE_M17N if (width == 2) p = alt2_symbol[(int)symbol]; else #endif p = alt_symbol[(int)symbol]; for (i = 0; i < 2 && *p; i++, p++) buf[i] = (*p == ' ') ? NBSP_CODE : *p; Strcat(str, Sprintf("<_SYMBOL TYPE=%d>", symbol)); for (; n > 0; n--) Strcat_charp_n(str, buf, i); Strcat_charp(str, "</_SYMBOL>"); }
1
[ "CWE-119" ]
w3m
0c3f5d0e0d9269ad47b8f4b061d7818993913189
1,681,337,008,445,070,000,000,000,000,000,000,000
19
Prevent array index out of bounds for symbol Bug-Debian: https://github.com/tats/w3m/issues/38
void sctp_assoc_control_transport(struct sctp_association *asoc, struct sctp_transport *transport, sctp_transport_cmd_t command, sctp_sn_error_t error) { struct sctp_ulpevent *event; struct sockaddr_storage addr; int spc_state = 0; bool ulp_notify = true; /* Record the transition on the transport. */ switch (command) { case SCTP_TRANSPORT_UP: /* If we are moving from UNCONFIRMED state due * to heartbeat success, report the SCTP_ADDR_CONFIRMED * state to the user, otherwise report SCTP_ADDR_AVAILABLE. */ if (SCTP_UNCONFIRMED == transport->state && SCTP_HEARTBEAT_SUCCESS == error) spc_state = SCTP_ADDR_CONFIRMED; else spc_state = SCTP_ADDR_AVAILABLE; /* Don't inform ULP about transition from PF to * active state and set cwnd to 1 MTU, see SCTP * Quick failover draft section 5.1, point 5 */ if (transport->state == SCTP_PF) { ulp_notify = false; transport->cwnd = asoc->pathmtu; } transport->state = SCTP_ACTIVE; break; case SCTP_TRANSPORT_DOWN: /* If the transport was never confirmed, do not transition it * to inactive state. Also, release the cached route since * there may be a better route next time. */ if (transport->state != SCTP_UNCONFIRMED) transport->state = SCTP_INACTIVE; else { dst_release(transport->dst); transport->dst = NULL; ulp_notify = false; } spc_state = SCTP_ADDR_UNREACHABLE; break; case SCTP_TRANSPORT_PF: transport->state = SCTP_PF; ulp_notify = false; break; default: return; } /* Generate and send a SCTP_PEER_ADDR_CHANGE notification * to the user. */ if (ulp_notify) { memset(&addr, 0, sizeof(struct sockaddr_storage)); memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len); event = sctp_ulpevent_make_peer_addr_change(asoc, &addr, 0, spc_state, error, GFP_ATOMIC); if (event) sctp_ulpq_tail_event(&asoc->ulpq, event); } /* Select new active and retran paths. */ sctp_select_active_and_retran_path(asoc); }
0
[ "CWE-400", "CWE-399", "CWE-703" ]
linux
b69040d8e39f20d5215a03502a8e8b4c6ab78395
3,190,064,793,292,047,000,000,000,000,000,000,000
75
net: sctp: fix panic on duplicate ASCONF chunks When receiving a e.g. semi-good formed connection scan in the form of ... -------------- INIT[ASCONF; ASCONF_ACK] -------------> <----------- INIT-ACK[ASCONF; ASCONF_ACK] ------------ -------------------- COOKIE-ECHO --------------------> <-------------------- COOKIE-ACK --------------------- ---------------- ASCONF_a; ASCONF_b -----------------> ... where ASCONF_a equals ASCONF_b chunk (at least both serials need to be equal), we panic an SCTP server! The problem is that good-formed ASCONF chunks that we reply with ASCONF_ACK chunks are cached per serial. Thus, when we receive a same ASCONF chunk twice (e.g. through a lost ASCONF_ACK), we do not need to process them again on the server side (that was the idea, also proposed in the RFC). Instead, we know it was cached and we just resend the cached chunk instead. So far, so good. Where things get nasty is in SCTP's side effect interpreter, that is, sctp_cmd_interpreter(): While incoming ASCONF_a (chunk = event_arg) is being marked !end_of_packet and !singleton, and we have an association context, we do not flush the outqueue the first time after processing the ASCONF_ACK singleton chunk via SCTP_CMD_REPLY. Instead, we keep it queued up, although we set local_cork to 1. Commit 2e3216cd54b1 changed the precedence, so that as long as we get bundled, incoming chunks we try possible bundling on outgoing queue as well. Before this commit, we would just flush the output queue. Now, while ASCONF_a's ASCONF_ACK sits in the corked outq, we continue to process the same ASCONF_b chunk from the packet. As we have cached the previous ASCONF_ACK, we find it, grab it and do another SCTP_CMD_REPLY command on it. So, effectively, we rip the chunk->list pointers and requeue the same ASCONF_ACK chunk another time. Since we process ASCONF_b, it's correctly marked with end_of_packet and we enforce an uncork, and thus flush, thus crashing the kernel. Fix it by testing if the ASCONF_ACK is currently pending and if that is the case, do not requeue it. When flushing the output queue we may relink the chunk for preparing an outgoing packet, but eventually unlink it when it's copied into the skb right before transmission. Joint work with Vlad Yasevich. Fixes: 2e3216cd54b1 ("sctp: Follow security requirement of responding with 1 packet") Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int nf_tables_expr_parse(const struct nft_ctx *ctx, const struct nlattr *nla, struct nft_expr_info *info) { const struct nft_expr_type *type; const struct nft_expr_ops *ops; struct nlattr *tb[NFTA_EXPR_MAX + 1]; int err; err = nla_parse_nested_deprecated(tb, NFTA_EXPR_MAX, nla, nft_expr_policy, NULL); if (err < 0) return err; type = nft_expr_type_get(ctx->net, ctx->family, tb[NFTA_EXPR_NAME]); if (IS_ERR(type)) return PTR_ERR(type); if (tb[NFTA_EXPR_DATA]) { err = nla_parse_nested_deprecated(info->tb, type->maxattr, tb[NFTA_EXPR_DATA], type->policy, NULL); if (err < 0) goto err1; } else memset(info->tb, 0, sizeof(info->tb[0]) * (type->maxattr + 1)); if (type->select_ops != NULL) { ops = type->select_ops(ctx, (const struct nlattr * const *)info->tb); if (IS_ERR(ops)) { err = PTR_ERR(ops); #ifdef CONFIG_MODULES if (err == -EAGAIN) if (nft_expr_type_request_module(ctx->net, ctx->family, tb[NFTA_EXPR_NAME]) != -EAGAIN) err = -ENOENT; #endif goto err1; } } else ops = type->ops; info->attr = nla; info->ops = ops; return 0; err1: module_put(type->owner); return err; }
0
[ "CWE-665" ]
linux
ad9f151e560b016b6ad3280b48e42fa11e1a5440
183,726,257,308,937,530,000,000,000,000,000,000,000
53
netfilter: nf_tables: initialize set before expression setup nft_set_elem_expr_alloc() needs an initialized set if expression sets on the NFT_EXPR_GC flag. Move set fields initialization before expression setup. [4512935.019450] ================================================================== [4512935.019456] BUG: KASAN: null-ptr-deref in nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables] [4512935.019487] Read of size 8 at addr 0000000000000070 by task nft/23532 [4512935.019494] CPU: 1 PID: 23532 Comm: nft Not tainted 5.12.0-rc4+ #48 [...] [4512935.019502] Call Trace: [4512935.019505] dump_stack+0x89/0xb4 [4512935.019512] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables] [4512935.019536] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables] [4512935.019560] kasan_report.cold.12+0x5f/0xd8 [4512935.019566] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables] [4512935.019590] nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables] [4512935.019615] nf_tables_newset+0xc7f/0x1460 [nf_tables] Reported-by: [email protected] Fixes: 65038428b2c6 ("netfilter: nf_tables: allow to specify stateful expression in set definition") Signed-off-by: Pablo Neira Ayuso <[email protected]>
static int ocfs2_expand_nonsparse_inode(struct inode *inode, struct buffer_head *di_bh, loff_t pos, unsigned len, struct ocfs2_write_ctxt *wc) { int ret; loff_t newsize = pos + len; BUG_ON(ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))); if (newsize <= i_size_read(inode)) return 0; ret = ocfs2_extend_no_holes(inode, di_bh, newsize, pos); if (ret) mlog_errno(ret); /* There is no wc if this is call from direct. */ if (wc) wc->w_first_new_cpos = ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode)); return ret; }
0
[ "CWE-362" ]
linux
3e4c56d41eef5595035872a2ec5a483f42e8917f
258,060,165,324,401,100,000,000,000,000,000,000,000
24
ocfs2: ip_alloc_sem should be taken in ocfs2_get_block() ip_alloc_sem should be taken in ocfs2_get_block() when reading file in DIRECT mode to prevent concurrent access to extent tree with ocfs2_dio_end_io_write(), which may cause BUGON in the following situation: read file 'A' end_io of writing file 'A' vfs_read __vfs_read ocfs2_file_read_iter generic_file_read_iter ocfs2_direct_IO __blockdev_direct_IO do_blockdev_direct_IO do_direct_IO get_more_blocks ocfs2_get_block ocfs2_extent_map_get_blocks ocfs2_get_clusters ocfs2_get_clusters_nocache() ocfs2_search_extent_list return the index of record which contains the v_cluster, that is v_cluster > rec[i]->e_cpos. ocfs2_dio_end_io ocfs2_dio_end_io_write down_write(&oi->ip_alloc_sem); ocfs2_mark_extent_written ocfs2_change_extent_flag ocfs2_split_extent ... --> modify the rec[i]->e_cpos, resulting in v_cluster < rec[i]->e_cpos. BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos)) [[email protected]: v3] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Fixes: c15471f79506 ("ocfs2: fix sparse file & data ordering issue in direct io") Signed-off-by: Alex Chen <[email protected]> Reviewed-by: Jun Piao <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Reviewed-by: Gang He <[email protected]> Acked-by: Changwei Ge <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; /* this function is called immediately after a message has * been serialized */ OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); if (!frag) return 0; memcpy(frag->fragment, s->init_buf->data, s->init_num); if ( is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; /* save current state*/ frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch; memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)>>8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); return 0; } #if 0 fprintf( stderr, "buffered messge: \ttype = %xx\n", msg_buf->type); fprintf( stderr, "\t\t\t\t\tlen = %d\n", msg_buf->len); fprintf( stderr, "\t\t\t\t\tseq_num = %d\n", msg_buf->seq_num); #endif pqueue_insert(s->d1->sent_messages, item); return 1; }
0
[]
openssl
bff1ce4e6a1c57c3d0a5f9e4f85ba6385fccfe8b
34,148,193,234,520,266,000,000,000,000,000,000,000
63
Avoid double free when processing DTLS packets. The |item| variable, in both of these cases, may contain a pointer to a |pitem| structure within |s->d1->buffered_messages|. It was being freed in the error case while still being in |buffered_messages|. When the error later caused the |SSL*| to be destroyed, the item would be double freed. Thanks to Wah-Teh Chang for spotting that the fix in 1632ef74 was inconsistent with the other error paths (but correct). Fixes CVE-2014-3505 Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Emilia Käsper <[email protected]>
static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff) { struct whiteheat_set_rdb dtr_command; dtr_command.port = port->port_number + 1; dtr_command.state = onoff; return firm_send_command(port, WHITEHEAT_SET_DTR, (__u8 *)&dtr_command, sizeof(dtr_command)); }
0
[ "CWE-399" ]
linux
cbb4be652d374f64661137756b8f357a1827d6a4
117,932,179,341,850,660,000,000,000,000,000,000,000
9
USB: whiteheat: fix potential null-deref at probe Fix potential null-pointer dereference at probe by making sure that the required endpoints are present. The whiteheat driver assumes there are at least five pairs of bulk endpoints, of which the final pair is used for the "command port". An attempt to bind to an interface with fewer bulk endpoints would currently lead to an oops. Fixes CVE-2015-5257. Reported-by: Moein Ghasemzadeh <[email protected]> Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
GF_Err styl_box_size(GF_Box *s) { GF_TextStyleBox*ptr = (GF_TextStyleBox*)s; s->size += 2 + ptr->entry_count * GPP_STYLE_SIZE; return GF_OK; }
0
[ "CWE-476" ]
gpac
d527325a9b72218612455a534a508f9e1753f76e
135,690,606,329,026,390,000,000,000,000,000,000,000
7
fixed #1768
get_dirstack (self) SHELL_VAR *self; { ARRAY *a; WORD_LIST *l; l = get_directory_stack (0); a = array_from_word_list (l); array_dispose (array_cell (self)); dispose_words (l); var_setarray (self, a); return self; }
0
[]
bash
863d31ae775d56b785dc5b0105b6d251515d81d5
174,385,099,404,547,840,000,000,000,000,000,000,000
13
commit bash-20120224 snapshot
template<typename t> CImg<T>& dijkstra(const unsigned int starting_node, const unsigned int ending_node, CImg<t>& previous_node) { return get_dijkstra(starting_node,ending_node,previous_node).move_to(*this);
0
[ "CWE-125" ]
CImg
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
200,335,336,498,200,530,000,000,000,000,000,000,000
4
Fix other issues in 'CImg<T>::load_bmp()'.
bool eq_def(const Field *field) const { return (Field::eq_def(field) && decimals() == field->decimals()); }
0
[ "CWE-416", "CWE-703" ]
server
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
63,033,082,347,326,360,000,000,000,000,000,000,000
4
MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if() vcol_info->expr is allocated on expr_arena at parsing stage. Since expr item is allocated on expr_arena all its containee items must be allocated on expr_arena too. Otherwise fix_session_expr() will encounter prematurely freed item. When table is reopened from cache vcol_info contains stale expression. We refresh expression via TABLE::vcol_fix_exprs() but first we must prepare a proper context (Vcol_expr_context) which meets some requirements: 1. As noted above expr update must be done on expr_arena as there may be new items created. It was a bug in fix_session_expr_for_read() and was just not reproduced because of no second refix. Now refix is done for more cases so it does reproduce. Tests affected: vcol.binlog 2. Also name resolution context must be narrowed to the single table. Tested by: vcol.update main.default vcol.vcol_syntax gcol.gcol_bugfixes 3. sql_mode must be clean and not fail expr update. sql_mode such as MODE_NO_BACKSLASH_ESCAPES, MODE_NO_ZERO_IN_DATE, etc must not affect vcol expression update. If the table was created successfully any further evaluation must not fail. Tests affected: main.func_like Reviewed by: Sergei Golubchik <[email protected]>
ip6t_ext_hdr(u8 nexthdr) { return (nexthdr == IPPROTO_HOPOPTS) || (nexthdr == IPPROTO_ROUTING) || (nexthdr == IPPROTO_FRAGMENT) || (nexthdr == IPPROTO_ESP) || (nexthdr == IPPROTO_AH) || (nexthdr == IPPROTO_NONE) || (nexthdr == IPPROTO_DSTOPTS); }
0
[ "CWE-200" ]
linux-2.6
6a8ab060779779de8aea92ce3337ca348f973f54
336,986,787,724,827,860,000,000,000,000,000,000,000
10
ipv6: netfilter: ip6_tables: fix infoleak to userspace Structures ip6t_replace, compat_ip6t_replace, and xt_get_revision are copied from userspace. Fields of these structs that are zero-terminated strings are not checked. When they are used as argument to a format string containing "%s" in request_module(), some sensitive information is leaked to userspace via argument of spawned modprobe process. The first bug was introduced before the git epoch; the second was introduced in 3bc3fe5e (v2.6.25-rc1); the third is introduced by 6b7d31fc (v2.6.15-rc1). To trigger the bug one should have CAP_NET_ADMIN. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Patrick McHardy <[email protected]>
void CLASS kodak_c330_load_raw() { uchar *pixel; int row, col, y, cb, cr, rgb[3], c; pixel = (uchar *) calloc (raw_width, 2*sizeof *pixel); merror (pixel, "kodak_c330_load_raw()"); #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (row=0; row < height; row++) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif if (fread (pixel, raw_width, 2, ifp) < 2) derror(); if (load_flags && (row & 31) == 31) fseek (ifp, raw_width*32, SEEK_CUR); for (col=0; col < width; col++) { y = pixel[col*2]; cb = pixel[(col*2 & -4) | 1] - 128; cr = pixel[(col*2 & -4) | 3] - 128; rgb[1] = y - ((cb + cr + 2) >> 2); rgb[2] = rgb[1] + cb; rgb[0] = rgb[1] + cr; FORC3 image[row*width+col][c] = curve[LIM(rgb[c],0,255)]; } } #ifdef LIBRAW_LIBRARY_BUILD } catch(...) { free (pixel); throw; } #endif free (pixel); maximum = curve[0xff]; }
1
[ "CWE-787" ]
LibRaw
8682ad204392b914ab1cc6ebcca9c27c19c1a4b4
87,363,785,747,908,690,000,000,000,000,000,000,000
36
0.18.17
_isBidi (const uint32_t *label, size_t llen) { while (llen-- > 0) { int bc = uc_bidi_category (*label++); if (bc == UC_BIDI_R || bc == UC_BIDI_AL || bc == UC_BIDI_AN) return 1; } return 0; }
1
[ "CWE-190" ]
libidn2
16853b6973a1e72fee2b7cccda85472cb9951305
291,301,499,512,973,870,000,000,000,000,000,000,000
11
lib/bidi: Fix integer overflow (found by fuzzing)
ftp_syst(ftpbuf_t *ftp) { char *syst, *end; if (ftp == NULL) { return NULL; } /* default to cached value */ if (ftp->syst) { return ftp->syst; } if (!ftp_putcmd(ftp, "SYST", NULL)) { return NULL; } if (!ftp_getresp(ftp) || ftp->resp != 215) { return NULL; } syst = ftp->inbuf; while (*syst == ' ') { syst++; } if ((end = strchr(syst, ' '))) { *end = 0; } ftp->syst = estrdup(syst); if (end) { *end = ' '; } return ftp->syst; }
0
[ "CWE-189" ]
php-src
ac2832935435556dc593784cd0087b5e576bbe4d
325,449,201,236,079,300,000,000,000,000,000,000,000
31
Fix bug #69545 - avoid overflow when reading list
build_toporder_info (class ipa_topo_info *topo) { topo->order = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count); topo->stack = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count); gcc_checking_assert (topo->stack_top == 0); topo->nnodes = ipa_reduced_postorder (topo->order, true, ignore_edge_p); }
0
[ "CWE-20" ]
gcc
a09ccc22459c565814f79f96586fe4ad083fe4eb
18,417,727,004,568,525,000,000,000,000,000,000,000
9
Avoid segfault when doing IPA-VRP but not IPA-CP (PR 93015) 2019-12-21 Martin Jambor <[email protected]> PR ipa/93015 * ipa-cp.c (ipcp_store_vr_results): Check that info exists testsuite/ * gcc.dg/lto/pr93015_0.c: New test. From-SVN: r279695
static void rgb_background(struct vc_data *vc, const struct rgb *c) { /* For backgrounds, err on the dark side. */ vc->state.color = (vc->state.color & 0x0f) | (c->r&0x80) >> 1 | (c->g&0x80) >> 2 | (c->b&0x80) >> 3; }
0
[ "CWE-125" ]
linux
3c4e0dff2095c579b142d5a0693257f1c58b4804
82,656,927,598,375,220,000,000,000,000,000,000,000
6
vt: Disable KD_FONT_OP_COPY It's buggy: On Fri, Nov 06, 2020 at 10:30:08PM +0800, Minh Yuan wrote: > We recently discovered a slab-out-of-bounds read in fbcon in the latest > kernel ( v5.10-rc2 for now ). The root cause of this vulnerability is that > "fbcon_do_set_font" did not handle "vc->vc_font.data" and > "vc->vc_font.height" correctly, and the patch > <https://lkml.org/lkml/2020/9/27/223> for VT_RESIZEX can't handle this > issue. > > Specifically, we use KD_FONT_OP_SET to set a small font.data for tty6, and > use KD_FONT_OP_SET again to set a large font.height for tty1. After that, > we use KD_FONT_OP_COPY to assign tty6's vc_font.data to tty1's vc_font.data > in "fbcon_do_set_font", while tty1 retains the original larger > height. Obviously, this will cause an out-of-bounds read, because we can > access a smaller vc_font.data with a larger vc_font.height. Further there was only one user ever. - Android's loadfont, busybox and console-tools only ever use OP_GET and OP_SET - fbset documentation only mentions the kernel cmdline font: option, not anything else. - systemd used OP_COPY before release 232 published in Nov 2016 Now unfortunately the crucial report seems to have gone down with gmane, and the commit message doesn't say much. But the pull request hints at OP_COPY being broken https://github.com/systemd/systemd/pull/3651 So in other words, this never worked, and the only project which foolishly every tried to use it, realized that rather quickly too. Instead of trying to fix security issues here on dead code by adding missing checks, fix the entire thing by removing the functionality. Note that systemd code using the OP_COPY function ignored the return value, so it doesn't matter what we're doing here really - just in case a lone server somewhere happens to be extremely unlucky and running an affected old version of systemd. The relevant code from font_copy_to_all_vcs() in systemd was: /* copy font from active VT, where the font was uploaded to */ cfo.op = KD_FONT_OP_COPY; cfo.height = vcs.v_active-1; /* tty1 == index 0 */ (void) ioctl(vcfd, KDFONTOP, &cfo); Note this just disables the ioctl, garbage collecting the now unused callbacks is left for -next. v2: Tetsuo found the old mail, which allowed me to find it on another archive. Add the link too. Acked-by: Peilin Ye <[email protected]> Reported-by: Minh Yuan <[email protected]> References: https://lists.freedesktop.org/archives/systemd-devel/2016-June/036935.html References: https://github.com/systemd/systemd/pull/3651 Cc: Greg KH <[email protected]> Cc: Peilin Ye <[email protected]> Cc: Tetsuo Handa <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
static void apparmor_cred_transfer(struct cred *new, const struct cred *old) { const struct aa_task_cxt *old_cxt = old->security; struct aa_task_cxt *new_cxt = new->security; aa_dup_task_context(new_cxt, old_cxt); }
0
[ "CWE-20" ]
linux
a5b2c5b2ad5853591a6cac6134cd0f599a720865
305,210,964,195,710,940,000,000,000,000,000,000,000
7
AppArmor: fix oops in apparmor_setprocattr When invalid parameters are passed to apparmor_setprocattr a NULL deref oops occurs when it tries to record an audit message. This is because it is passing NULL for the profile parameter for aa_audit. But aa_audit now requires that the profile passed is not NULL. Fix this by passing the current profile on the task that is trying to setprocattr. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: John Johansen <[email protected]> Cc: [email protected] Signed-off-by: James Morris <[email protected]>
_outPlanInfo(StringInfo str, const Plan *node) { WRITE_FLOAT_FIELD(startup_cost, "%.2f"); WRITE_FLOAT_FIELD(total_cost, "%.2f"); WRITE_FLOAT_FIELD(plan_rows, "%.0f"); WRITE_INT_FIELD(plan_width); WRITE_NODE_FIELD(targetlist); WRITE_NODE_FIELD(qual); WRITE_NODE_FIELD(lefttree); WRITE_NODE_FIELD(righttree); WRITE_NODE_FIELD(initPlan); WRITE_BITMAPSET_FIELD(extParam); WRITE_BITMAPSET_FIELD(allParam); }
0
[ "CWE-362" ]
postgres
5f173040e324f6c2eebb90d86cf1b0cdb5890f0a
124,947,165,017,945,400,000,000,000,000,000,000,000
14
Avoid repeated name lookups during table and index DDL. If the name lookups come to different conclusions due to concurrent activity, we might perform some parts of the DDL on a different table than other parts. At least in the case of CREATE INDEX, this can be used to cause the permissions checks to be performed against a different table than the index creation, allowing for a privilege escalation attack. This changes the calling convention for DefineIndex, CreateTrigger, transformIndexStmt, transformAlterTableStmt, CheckIndexCompatible (in 9.2 and newer), and AlterTable (in 9.1 and older). In addition, CheckRelationOwnership is removed in 9.2 and newer and the calling convention is changed in older branches. A field has also been added to the Constraint node (FkConstraint in 8.4). Third-party code calling these functions or using the Constraint node will require updating. Report by Andres Freund. Patch by Robert Haas and Andres Freund, reviewed by Tom Lane. Security: CVE-2014-0062
GooString *PDFDoc::getDocInfoStringEntry(const char *key) { Object infoObj = getDocInfo(); if (!infoObj.isDict()) { return nullptr; } Object entryObj = infoObj.dictLookup(key); GooString *result; if (entryObj.isString()) { result = entryObj.takeString(); } else { result = nullptr; } return result; }
0
[ "CWE-20" ]
poppler
9fd5ec0e6e5f763b190f2a55ceb5427cfe851d5f
192,683,229,871,259,700,000,000,000,000,000,000,000
18
PDFDoc::setup: Fix return value At that point xref can have gone wrong since extractPDFSubtype() can have caused a reconstruct that broke stuff so instead of unconditionally returning true, return xref->isOk() Fixes #706
bool Item_field::fix_fields(THD *thd, Item **reference) { DBUG_ASSERT(fixed == 0); Field *from_field= (Field *)not_found_field; bool outer_fixed= false; SELECT_LEX *select= thd->lex->current_select; if (select && select->in_tvc) { my_error(ER_FIELD_REFERENCE_IN_TVC, MYF(0), full_name()); return(1); } if (!field) // If field is not checked { TABLE_LIST *table_list; /* In case of view, find_field_in_tables() write pointer to view field expression to 'reference', i.e. it substitute that expression instead of this Item_field */ DBUG_ASSERT(context); if ((from_field= find_field_in_tables(thd, this, context->first_name_resolution_table, context->last_name_resolution_table, reference, thd->lex->use_only_table_context ? REPORT_ALL_ERRORS : IGNORE_EXCEPT_NON_UNIQUE, !any_privileges, TRUE)) == not_found_field) { int ret; /* Look up in current select's item_list to find aliased fields */ if (select && select->is_item_list_lookup) { uint counter; enum_resolution_type resolution; Item** res= find_item_in_list(this, select->item_list, &counter, REPORT_EXCEPT_NOT_FOUND, &resolution); if (!res) return 1; if (resolution == RESOLVED_AGAINST_ALIAS) alias_name_used= TRUE; if (res != (Item **)not_found_item) { if ((*res)->type() == Item::FIELD_ITEM) { /* It's an Item_field referencing another Item_field in the select list. Use the field from the Item_field in the select list and leave the Item_field instance in place. */ Field *new_field= (*((Item_field**)res))->field; if (unlikely(new_field == NULL)) { /* The column to which we link isn't valid. */ my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name.str, thd->where); return(1); } /* We can not "move" aggregate function in the place where its arguments are not defined. */ set_max_sum_func_level(thd, select); set_field(new_field); depended_from= (*((Item_field**)res))->depended_from; return 0; } else { /* It's not an Item_field in the select list so we must make a new Item_ref to point to the Item in the select list and replace the Item_field created by the parser with the new Item_ref. */ Item_ref *rf= new (thd->mem_root) Item_ref(thd, context, db_name, table_name, &field_name); if (!rf) return 1; bool err= rf->fix_fields(thd, (Item **) &rf) || rf->check_cols(1); if (err) return TRUE; thd->change_item_tree(reference, select->context_analysis_place == IN_GROUP_BY && alias_name_used ? *rf->ref : rf); /* We can not "move" aggregate function in the place where its arguments are not defined. */ set_max_sum_func_level(thd, select); return FALSE; } } } if (unlikely(!select)) { my_error(ER_BAD_FIELD_ERROR, MYF(0), full_name(), thd->where); goto error; } if ((ret= fix_outer_field(thd, &from_field, reference)) < 0) goto error; outer_fixed= TRUE; if (!ret) goto mark_non_agg_field; } else if (!from_field) goto error; table_list= (cached_table ? cached_table : from_field != view_ref_found ? from_field->table->pos_in_table_list : 0); if (!outer_fixed && table_list && table_list->select_lex && context->select_lex && table_list->select_lex != context->select_lex && !context->select_lex->is_merged_child_of(table_list->select_lex) && is_outer_table(table_list, context->select_lex)) { int ret; if ((ret= fix_outer_field(thd, &from_field, reference)) < 0) goto error; outer_fixed= 1; if (!ret) goto mark_non_agg_field; } if (!thd->lex->current_select->no_wrap_view_item && thd->lex->in_sum_func && thd->lex == select->parent_lex && thd->lex->in_sum_func->nest_level == select->nest_level) set_if_bigger(thd->lex->in_sum_func->max_arg_level, select->nest_level); /* if it is not expression from merged VIEW we will set this field. We can leave expression substituted from view for next PS/SP rexecution (i.e. do not register this substitution for reverting on cleanup() (register_item_tree_changing())), because this subtree will be fix_field'ed during setup_tables()->setup_underlying() (i.e. before all other expressions of query, and references on tables which do not present in query will not make problems. Also we suppose that view can't be changed during PS/SP life. */ if (from_field == view_ref_found) return FALSE; set_field(from_field); } else if (should_mark_column(thd->column_usage)) { TABLE *table= field->table; MY_BITMAP *current_bitmap, *other_bitmap; if (thd->column_usage == MARK_COLUMNS_READ) { current_bitmap= table->read_set; other_bitmap= table->write_set; } else { current_bitmap= table->write_set; other_bitmap= table->read_set; } if (!bitmap_fast_test_and_set(current_bitmap, field->field_index)) { if (!bitmap_is_set(other_bitmap, field->field_index)) { /* First usage of column */ table->used_fields++; // Used to optimize loops /* purecov: begin inspected */ table->covering_keys.intersect(field->part_of_key); /* purecov: end */ } } } #ifndef NO_EMBEDDED_ACCESS_CHECKS if (any_privileges) { const char *db, *tab; db= field->table->s->db.str; tab= field->table->s->table_name.str; if (!(have_privileges= (get_column_grant(thd, &field->table->grant, db, tab, field_name.str) & VIEW_ANY_ACL))) { my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), "ANY", thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, field_name.str, tab); goto error; } } #endif fixed= 1; if (field->vcol_info) fix_session_vcol_expr_for_read(thd, field, field->vcol_info); if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && !outer_fixed && !thd->lex->in_sum_func && select && select->cur_pos_in_select_list != UNDEF_POS && select->join) { select->join->non_agg_fields.push_back(this, thd->mem_root); marker= select->cur_pos_in_select_list; } mark_non_agg_field: /* table->pos_in_table_list can be 0 when fixing partition functions or virtual fields. */ if (fixed && (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY) && field->table->pos_in_table_list) { /* Mark selects according to presence of non aggregated fields. Fields from outer selects added to the aggregate function outer_fields list as it's unknown at the moment whether it's aggregated or not. We're using the select lex of the cached table (if present). */ SELECT_LEX *select_lex; if (cached_table) select_lex= cached_table->select_lex; else if (!(select_lex= field->table->pos_in_table_list->select_lex)) { /* This can only happen when there is no real table in the query. We are using the field's resolution context. context->select_lex is eee safe for use because it's either the SELECT we want to use (the current level) or a stub added by non-SELECT queries. */ select_lex= context->select_lex; } if (!thd->lex->in_sum_func) select_lex->set_non_agg_field_used(true); else { if (outer_fixed) thd->lex->in_sum_func->outer_fields.push_back(this, thd->mem_root); else if (thd->lex->in_sum_func->nest_level != select->nest_level) select_lex->set_non_agg_field_used(true); } } return FALSE; error: context->process_error(thd); return TRUE; }
1
[ "CWE-416" ]
server
c02ebf3510850ba78a106be9974c94c3b97d8585
13,911,727,292,575,295,000,000,000,000,000,000,000
262
MDEV-24176 Preparations 1. moved fix_vcol_exprs() call to open_table() mysql_alter_table() doesn't do lock_tables() so it cannot win from fix_vcol_exprs() from there. Tests affected: main.default_session 2. Vanilla cleanups and comments.
imap_complete_hosts (char *dest, size_t len) { BUFFY* mailbox; CONNECTION* conn; int rc = -1; size_t matchlen; matchlen = mutt_strlen (dest); for (mailbox = Incoming; mailbox; mailbox = mailbox->next) { if (!mutt_strncmp (dest, mutt_b2s (mailbox->pathbuf), matchlen)) { if (rc) { strfcpy (dest, mutt_b2s (mailbox->pathbuf), len); rc = 0; } else longest_common_prefix (dest, mutt_b2s (mailbox->pathbuf), matchlen, len); } } for (conn = mutt_socket_head (); conn; conn = conn->next) { ciss_url_t url; char urlstr[LONG_STRING]; if (conn->account.type != MUTT_ACCT_TYPE_IMAP) continue; mutt_account_tourl (&conn->account, &url); /* FIXME: how to handle multiple users on the same host? */ url.user = NULL; url.path = NULL; url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); if (!mutt_strncmp (dest, urlstr, matchlen)) { if (rc) { strfcpy (dest, urlstr, len); rc = 0; } else longest_common_prefix (dest, urlstr, matchlen, len); } } return rc; }
0
[ "CWE-200", "CWE-319" ]
mutt
3e88866dc60b5fa6aaba6fd7c1710c12c1c3cd01
204,294,435,943,764,020,000,000,000,000,000,000,000
49
Prevent possible IMAP MITM via PREAUTH response. This is similar to CVE-2014-2567 and CVE-2020-12398. STARTTLS is not allowed in the Authenticated state, so previously Mutt would implicitly mark the connection as authenticated and skip any encryption checking/enabling. No credentials are exposed, but it does allow messages to be sent to an attacker, via postpone or fcc'ing for instance. Reuse the $ssl_starttls quadoption "in reverse" to prompt to abort the connection if it is unencrypted. Thanks very much to Damian Poddebniak and Fabian Ising from the Münster University of Applied Sciences for reporting this issue, and their help in testing the fix.
void SetAttrValue(const TensorShapeProto& value, AttrValue* out) { *out->mutable_shape() = value; }
0
[ "CWE-369", "CWE-674" ]
tensorflow
e07e1c3d26492c06f078c7e5bf2d138043e199c1
96,109,878,380,503,080,000,000,000,000,000,000,000
3
Prevent memory overflow in ParseAttrValue from nested tensors. PiperOrigin-RevId: 370108442 Change-Id: I84d64a5e8895a6aeffbf4749841b4c54d51b5889
eval_index( char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose) // give error messages { int evaluate = evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE); int empty1 = FALSE, empty2 = FALSE; typval_T var1, var2; int range = FALSE; char_u *key = NULL; int keylen = -1; int vim9 = in_vim9script(); if (check_can_index(rettv, evaluate, verbose) == FAIL) return FAIL; init_tv(&var1); init_tv(&var2); if (**arg == '.') { /* * dict.name */ key = *arg + 1; for (keylen = 0; eval_isdictc(key[keylen]); ++keylen) ; if (keylen == 0) return FAIL; *arg = key + keylen; } else { /* * something[idx] * * Get the (first) variable from inside the []. */ *arg = skipwhite_and_linebreak(*arg + 1, evalarg); if (**arg == ':') empty1 = TRUE; else if (eval1(arg, &var1, evalarg) == FAIL) // recursive! return FAIL; else if (vim9 && **arg == ':') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg); clear_tv(&var1); return FAIL; } else if (evaluate) { #ifdef FEAT_FLOAT // allow for indexing with float if (vim9 && rettv->v_type == VAR_DICT && var1.v_type == VAR_FLOAT) { var1.vval.v_string = typval_tostring(&var1, TRUE); var1.v_type = VAR_STRING; } #endif if (tv_get_string_chk(&var1) == NULL) { // not a number or string clear_tv(&var1); return FAIL; } } /* * Get the second variable from inside the [:]. */ *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg == ':') { range = TRUE; ++*arg; if (vim9 && !IS_WHITE_OR_NUL(**arg) && **arg != ']') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg - 1); if (!empty1) clear_tv(&var1); return FAIL; } *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg == ']') empty2 = TRUE; else if (eval1(arg, &var2, evalarg) == FAIL) // recursive! { if (!empty1) clear_tv(&var1); return FAIL; } else if (evaluate && tv_get_string_chk(&var2) == NULL) { // not a number or string if (!empty1) clear_tv(&var1); clear_tv(&var2); return FAIL; } } // Check for the ']'. *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg != ']') { if (verbose) emsg(_(e_missing_closing_square_brace)); clear_tv(&var1); if (range) clear_tv(&var2); return FAIL; } *arg = *arg + 1; // skip over the ']' } if (evaluate) { int res = eval_index_inner(rettv, range, empty1 ? NULL : &var1, empty2 ? NULL : &var2, FALSE, key, keylen, verbose); if (!empty1) clear_tv(&var1); if (range) clear_tv(&var2); return res; } return OK; }
0
[ "CWE-122", "CWE-787" ]
vim
605ec91e5a7330d61be313637e495fa02a6dc264
324,934,896,483,379,000,000,000,000,000,000,000,000
133
patch 8.2.3847: illegal memory access when using a lambda with an error Problem: Illegal memory access when using a lambda with an error. Solution: Avoid skipping over the NUL after a string.
find_end_event( char_u *arg, int have_group) // TRUE when group name was found { char_u *pat; char_u *p; if (*arg == '*') { if (arg[1] && !VIM_ISWHITE(arg[1])) { semsg(_(e_illegal_character_after_star_str), arg); return NULL; } pat = arg + 1; } else { for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p) { if ((int)event_name2nr(pat, &p) >= NUM_EVENTS) { if (have_group) semsg(_(e_no_such_event_str), pat); else semsg(_(e_no_such_group_or_event_str), pat); return NULL; } } } return pat; }
0
[ "CWE-122", "CWE-787" ]
vim
5fa9f23a63651a8abdb074b4fc2ec9b1adc6b089
60,512,894,754,338,340,000,000,000,000,000,000,000
32
patch 9.0.0061: ml_get error with nested autocommand Problem: ml_get error with nested autocommand. Solution: Also check line numbers for a nested autocommand. (closes #10761)
void lex_init(void) { uint i; DBUG_ENTER("lex_init"); for (i=0 ; i < array_elements(symbols) ; i++) symbols[i].length=(uchar) strlen(symbols[i].name); for (i=0 ; i < array_elements(sql_functions) ; i++) sql_functions[i].length=(uchar) strlen(sql_functions[i].name); DBUG_VOID_RETURN; }
0
[ "CWE-476" ]
server
3a52569499e2f0c4d1f25db1e81617a9d9755400
187,504,051,360,769,850,000,000,000,000,000,000,000
11
MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294 The asserion failure was caused by this query select /*id=1*/ from t1 where col= ( select /*id=2*/ from ... where corr_cond1 union select /*id=4*/ from ... where corr_cond2) Here, - select with id=2 was correlated due to corr_cond1. - select with id=4 was initially correlated due to corr_cond2, but then the optimizer optimized away the correlation, making the select with id=4 uncorrelated. However, since select with id=2 remained correlated, the execution had to re-compute the whole UNION. When it tried to execute select with id=4, it hit an assertion (join buffer already free'd). This is because select with id=4 has freed its execution structures after it has been executed once. The select is uncorrelated, so it did not expect it would need to be executed for the second time. Fixed this by adding this logic in st_select_lex::optimize_unflattened_subqueries(): If a member of a UNION is correlated, mark all its members as correlated, so that they are prepared to be executed multiple times.
e_ews_config_utils_get_widget_toplevel_window (GtkWidget *widget) { if (!widget) return NULL; if (!GTK_IS_WINDOW (widget)) widget = gtk_widget_get_toplevel (widget); if (GTK_IS_WINDOW (widget)) return GTK_WINDOW (widget); return NULL; }
0
[ "CWE-295" ]
evolution-ews
915226eca9454b8b3e5adb6f2fff9698451778de
67,991,174,821,472,150,000,000,000,000,000,000,000
13
I#27 - SSL Certificates are not validated This depends on https://gitlab.gnome.org/GNOME/evolution-data-server/commit/6672b8236139bd6ef41ecb915f4c72e2a052dba5 too. Closes https://gitlab.gnome.org/GNOME/evolution-ews/issues/27
MagickPrivate MagickBooleanType XQueryColorCompliance(const char *target, XColor *color) { Colormap colormap; static Display *display = (Display *) NULL; Status status; XColor xcolor; /* Initialize color return value. */ assert(color != (XColor *) NULL); color->red=0; color->green=0; color->blue=0; color->flags=(char) (DoRed | DoGreen | DoBlue); if ((target == (char *) NULL) || (*target == '\0')) target="#ffffffffffff"; /* Let the X server define the color for us. */ if (display == (Display *) NULL) display=XOpenDisplay((char *) NULL); if (display == (Display *) NULL) { ThrowXWindowException(XServerError,"ColorIsNotKnownToServer",target); return(MagickFalse); } colormap=XDefaultColormap(display,XDefaultScreen(display)); status=XParseColor(display,colormap,(char *) target,&xcolor); if (status == False) ThrowXWindowException(XServerError,"ColorIsNotKnownToServer",target) else { color->red=xcolor.red; color->green=xcolor.green; color->blue=xcolor.blue; color->flags=xcolor.flags; } return(status != False ? MagickTrue : MagickFalse); }
0
[]
ImageMagick
f391a5f4554fe47eb56d6277ac32d1f698572f0e
140,717,364,723,217,500,000,000,000,000,000,000,000
48
https://github.com/ImageMagick/ImageMagick/issues/1531
static int _find_waiter(struct waiter *w, uint32_t *jp) { return (w->jobid == *jp); }
0
[ "CWE-20" ]
slurm
df545955e4f119974c278bff0c47155257d5afc7
224,787,816,277,918,680,000,000,000,000,000,000,000
4
Validate gid and user_name values provided to slurmd up front. Do not defer until later, and do not potentially miss out on proper validation of the user_name field which can lead to improper authentication handling. CVE-2018-10995.
uripClose(void * context) { if (context == NULL) return(-1); urip_cur = NULL; urip_rlen = 0; return(0); }
0
[ "CWE-125" ]
libxml2
a820dbeac29d330bae4be05d9ecd939ad6b4aa33
156,953,218,641,106,590,000,000,000,000,000,000,000
6
Bug 758605: Heap-based buffer overread in xmlDictAddString <https://bugzilla.gnome.org/show_bug.cgi?id=758605> Reviewed by David Kilzer. * HTMLparser.c: (htmlParseName): Add bounds check. (htmlParseNameComplex): Ditto. * result/HTML/758605.html: Added. * result/HTML/758605.html.err: Added. * result/HTML/758605.html.sax: Added. * runtest.c: (pushParseTest): The input for the new test case was so small (4 bytes) that htmlParseChunk() was never called after htmlCreatePushParserCtxt(), thereby creating a false positive test failure. Fixed by using a do-while loop so we always call htmlParseChunk() at least once. * test/HTML/758605.html: Added.
xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { xmlListPtr ref_list; xmlRefTablePtr table; xmlChar *ID; xmlRemoveMemo target; if (doc == NULL) return(-1); if (attr == NULL) return(-1); table = (xmlRefTablePtr) doc->refs; if (table == NULL) return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (ID == NULL) return(-1); ref_list = xmlHashLookup(table, ID); if(ref_list == NULL) { xmlFree(ID); return (-1); } /* At this point, ref_list refers to a list of references which * have the same key as the supplied attr. Our list of references * is ordered by reference address and we don't have that information * here to use when removing. We'll have to walk the list and * check for a matching attribute, when we find one stop the walk * and remove the entry. * The list is ordered by reference, so that means we don't have the * key. Passing the list and the reference to the walker means we * will have enough data to be able to remove the entry. */ target.l = ref_list; target.ap = attr; /* Remove the supplied attr from our list */ xmlListWalk(ref_list, xmlWalkRemoveRef, &target); /*If the list is empty then remove the list entry in the hash */ if (xmlListEmpty(ref_list)) xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator) xmlFreeRefList); xmlFree(ID); return(0); }
0
[]
libxml2
932cc9896ab41475d4aa429c27d9afd175959d74
214,482,737,079,528,060,000,000,000,000,000,000,000
46
Fix buffer size checks in xmlSnprintfElementContent xmlSnprintfElementContent failed to correctly check the available buffer space in two locations. Fixes bug 781333 (CVE-2017-9047) and bug 781701 (CVE-2017-9048). Thanks to Marcel Böhme and Thuan Pham for the report.
QPDF::calculateHOutline( std::map<int, QPDFXRefEntry> const& xref, std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber) { HGeneric& cho = this->m->c_outline_data; if (cho.nobjects == 0) { return; } HGeneric& ho = this->m->outline_hints; ho.first_object = (*(obj_renumber.find(cho.first_object))).second; ho.first_object_offset = (*(xref.find(ho.first_object))).second.getOffset(); ho.nobjects = cho.nobjects; ho.group_length = outputLengthNextN( cho.first_object, ho.nobjects, lengths, obj_renumber); }
0
[ "CWE-787" ]
qpdf
d71f05ca07eb5c7cfa4d6d23e5c1f2a800f52e8e
148,116,970,927,084,520,000,000,000,000,000,000,000
22
Fix sign and conversion warnings (major) This makes all integer type conversions that have potential data loss explicit with calls that do range checks and raise an exception. After this commit, qpdf builds with no warnings when -Wsign-conversion -Wconversion is used with gcc or clang or when -W3 -Wd4800 is used with MSVC. This significantly reduces the likelihood of potential crashes from bogus integer values. There are some parts of the code that take int when they should take size_t or an offset. Such places would make qpdf not support files with more than 2^31 of something that usually wouldn't be so large. In the event that such a file shows up and is valid, at least qpdf would raise an error in the right spot so the issue could be legitimately addressed rather than failing in some weird way because of a silent overflow condition.
inline unsigned count_digits(uint64_t n) { // Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 // and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits. int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12; return to_unsigned(t) - (n < Data::POWERS_OF_10_64[t]) + 1; }
0
[ "CWE-134", "CWE-119", "CWE-787" ]
fmt
8cf30aa2be256eba07bb1cefb998c52326e846e7
185,218,229,935,191,450,000,000,000,000,000,000,000
6
Fix segfault on complex pointer formatting (#642)
xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlNodePtr cur = NULL; xmlXPathObjectPtr obj = NULL; long val; xmlChar str[30]; xmlDocPtr doc; if (nargs == 0) { cur = ctxt->context->node; } else if (nargs == 1) { xmlNodeSetPtr nodelist; int i, ret; if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) { ctxt->error = XPATH_INVALID_TYPE; xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "generate-id() : invalid arg expecting a node-set\n"); return; } obj = valuePop(ctxt); nodelist = obj->nodesetval; if ((nodelist == NULL) || (nodelist->nodeNr <= 0)) { xmlXPathFreeObject(obj); valuePush(ctxt, xmlXPathNewCString("")); return; } cur = nodelist->nodeTab[0]; for (i = 1;i < nodelist->nodeNr;i++) { ret = xmlXPathCmpNodes(cur, nodelist->nodeTab[i]); if (ret == -1) cur = nodelist->nodeTab[i]; } } else { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "generate-id() : invalid number of args %d\n", nargs); ctxt->error = XPATH_INVALID_ARITY; return; } /* * Okay this is ugly but should work, use the NodePtr address * to forge the ID */ if (cur->type != XML_NAMESPACE_DECL) doc = cur->doc; else { xmlNsPtr ns = (xmlNsPtr) cur; if (ns->context != NULL) doc = ns->context; else doc = ctxt->context->doc; } if (obj) xmlXPathFreeObject(obj); val = (long)((char *)cur - (char *)doc); if (val >= 0) { sprintf((char *)str, "idp%ld", val); } else { sprintf((char *)str, "idm%ld", -val); } valuePush(ctxt, xmlXPathNewString(str)); }
0
[]
libxslt
6c99c519d97e5fcbec7a9537d190efb442e4e833
206,727,646,622,063,200,000,000,000,000,000,000,000
65
Crash when passing an uninitialized variable to document() https://bugzilla.gnome.org/show_bug.cgi?id=685330 Missing check for NULL
eval_isnamec1(int c) { return ASCII_ISALPHA(c) || c == '_'; }
0
[ "CWE-122", "CWE-787" ]
vim
605ec91e5a7330d61be313637e495fa02a6dc264
103,623,751,654,219,400,000,000,000,000,000,000,000
4
patch 8.2.3847: illegal memory access when using a lambda with an error Problem: Illegal memory access when using a lambda with an error. Solution: Avoid skipping over the NUL after a string.
static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx) { php_curl *ch = (php_curl *) ctx; php_curl_write *t = ch->handlers->write_header; size_t length = size * nmemb; TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); switch (t->method) { case PHP_CURL_STDOUT: /* Handle special case write when we're returning the entire transfer */ if (ch->handlers->write->method == PHP_CURL_RETURN && length > 0) { smart_str_appendl(&ch->handlers->write->buf, data, (int) length); } else { PHPWRITE(data, length); } break; case PHP_CURL_FILE: return fwrite(data, size, nmemb, t->fp); case PHP_CURL_USER: { zval **argv[2]; zval *handle = NULL; zval *zdata = NULL; zval *retval_ptr; int error; zend_fcall_info fci; MAKE_STD_ZVAL(handle); MAKE_STD_ZVAL(zdata); ZVAL_RESOURCE(handle, ch->id); zend_list_addref(ch->id); ZVAL_STRINGL(zdata, data, length, 1); argv[0] = &handle; argv[1] = &zdata; fci.size = sizeof(fci); fci.function_table = EG(function_table); fci.function_name = t->func_name; fci.symbol_table = NULL; fci.object_ptr = NULL; fci.retval_ptr_ptr = &retval_ptr; fci.param_count = 2; fci.params = argv; fci.no_separation = 0; ch->in_callback = 1; error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC); ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (retval_ptr) { _php_curl_verify_handlers(ch, 1 TSRMLS_CC); if (Z_TYPE_P(retval_ptr) != IS_LONG) { convert_to_long_ex(&retval_ptr); } length = Z_LVAL_P(retval_ptr); zval_ptr_dtor(&retval_ptr); } zval_ptr_dtor(argv[0]); zval_ptr_dtor(argv[1]); break; } case PHP_CURL_IGNORE: return length; default: return -1; } return length; }
0
[]
php-src
0ea75af9be8a40836951fc89f723dd5390b8b46f
115,317,003,119,831,000,000,000,000,000,000,000,000
75
Fixed bug #69316 (Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER)
static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) { struct nfs4_server_caps_arg args = { .fhandle = fhandle, }; struct nfs4_server_caps_res res = {}; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], .rpc_argp = &args, .rpc_resp = &res, }; int status; status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); if (status == 0) { memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| NFS_CAP_SYMLINKS|NFS_CAP_FILEID| NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER| NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME| NFS_CAP_CTIME|NFS_CAP_MTIME); if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) server->caps |= NFS_CAP_ACLS; if (res.has_links != 0) server->caps |= NFS_CAP_HARDLINKS; if (res.has_symlinks != 0) server->caps |= NFS_CAP_SYMLINKS; if (res.attr_bitmask[0] & FATTR4_WORD0_FILEID) server->caps |= NFS_CAP_FILEID; if (res.attr_bitmask[1] & FATTR4_WORD1_MODE) server->caps |= NFS_CAP_MODE; if (res.attr_bitmask[1] & FATTR4_WORD1_NUMLINKS) server->caps |= NFS_CAP_NLINK; if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER) server->caps |= NFS_CAP_OWNER; if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER_GROUP) server->caps |= NFS_CAP_OWNER_GROUP; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_ACCESS) server->caps |= NFS_CAP_ATIME; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_METADATA) server->caps |= NFS_CAP_CTIME; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY) server->caps |= NFS_CAP_MTIME; memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; server->acl_bitmask = res.acl_bitmask; } return status; }
0
[ "CWE-703", "CWE-189" ]
linux
bf118a342f10dafe44b14451a1392c3254629a1f
107,425,286,645,647,230,000,000,000,000,000,000,000
52
NFSv4: include bitmap in nfsv4 get acl data The NFSv4 bitmap size is unbounded: a server can return an arbitrary sized bitmap in an FATTR4_WORD0_ACL request. Replace using the nfs4_fattr_bitmap_maxsz as a guess to the maximum bitmask returned by a server with the inclusion of the bitmap (xdr length plus bitmasks) and the acl data xdr length to the (cached) acl page data. This is a general solution to commit e5012d1f "NFSv4.1: update nfs4_fattr_bitmap_maxsz" and fixes hitting a BUG_ON in xdr_shrink_bufhead when getting ACLs. Fix a bug in decode_getacl that returned -EINVAL on ACLs > page when getxattr was called with a NULL buffer, preventing ACL > PAGE_SIZE from being retrieved. Cc: [email protected] Signed-off-by: Andy Adamson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
authdir_policy_valid_address(uint32_t addr, uint16_t port) { if (! addr_policy_permits_address(addr, port, authdir_invalid_policy)) return 0; return !addr_is_in_cc_list(addr, get_options()->AuthDirInvalidCCs); }
0
[]
tor
1afc2ed956a35b40dfd1d207652af5b50c295da7
126,744,127,040,946,280,000,000,000,000,000,000,000
6
Fix policies.c instance of the "if (r=(a-b)) return r" pattern I think this one probably can't underflow, since the input ranges are small. But let's not tempt fate. This patch also replaces the "cmp" functions here with just "eq" functions, since nothing actually checked for anything besides 0 and nonzero. Related to 21278.
long do_sigpending(void __user *set, unsigned long sigsetsize) { long error = -EINVAL; sigset_t pending; if (sigsetsize > sizeof(sigset_t)) goto out; spin_lock_irq(&current->sighand->siglock); sigorsets(&pending, &current->pending.signal, &current->signal->shared_pending.signal); spin_unlock_irq(&current->sighand->siglock); /* Outside the lock because only this thread touches it. */ sigandsets(&pending, &current->blocked, &pending); error = -EFAULT; if (!copy_to_user(set, &pending, sigsetsize)) error = 0; out: return error; }
0
[]
linux-2.6
0083fc2c50e6c5127c2802ad323adf8143ab7856
330,009,348,740,986,940,000,000,000,000,000,000,000
23
do_sigaltstack: avoid copying 'stack_t' as a structure to user space Ulrich Drepper correctly points out that there is generally padding in the structure on 64-bit hosts, and that copying the structure from kernel to user space can leak information from the kernel stack in those padding bytes. Avoid the whole issue by just copying the three members one by one instead, which also means that the function also can avoid the need for a stack frame. This also happens to match how we copy the new structure from user space, so it all even makes sense. [ The obvious solution of adding a memset() generates horrid code, gcc does really stupid things. ] Reported-by: Ulrich Drepper <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
bool __weak kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu) { return false;
0
[ "CWE-459" ]
linux
683412ccf61294d727ead4a73d97397396e69a6b
186,028,007,590,471,240,000,000,000,000,000,000,000
4
KVM: SEV: add cache flush to solve SEV cache incoherency issues Flush the CPU caches when memory is reclaimed from an SEV guest (where reclaim also includes it being unmapped from KVM's memslots). Due to lack of coherency for SEV encrypted memory, failure to flush results in silent data corruption if userspace is malicious/broken and doesn't ensure SEV guest memory is properly pinned and unpinned. Cache coherency is not enforced across the VM boundary in SEV (AMD APM vol.2 Section 15.34.7). Confidential cachelines, generated by confidential VM guests have to be explicitly flushed on the host side. If a memory page containing dirty confidential cachelines was released by VM and reallocated to another user, the cachelines may corrupt the new user at a later time. KVM takes a shortcut by assuming all confidential memory remain pinned until the end of VM lifetime. Therefore, KVM does not flush cache at mmu_notifier invalidation events. Because of this incorrect assumption and the lack of cache flushing, malicous userspace can crash the host kernel: creating a malicious VM and continuously allocates/releases unpinned confidential memory pages when the VM is running. Add cache flush operations to mmu_notifier operations to ensure that any physical memory leaving the guest VM get flushed. In particular, hook mmu_notifier_invalidate_range_start and mmu_notifier_release events and flush cache accordingly. The hook after releasing the mmu lock to avoid contention with other vCPUs. Cc: [email protected] Suggested-by: Sean Christpherson <[email protected]> Reported-by: Mingwei Zhang <[email protected]> Signed-off-by: Mingwei Zhang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static void flush_change(H264Context *h) { int i, j; h->outputed_poc = h->next_outputed_poc = INT_MIN; h->prev_interlaced_frame = 1; idr(h); h->prev_frame_num = -1; if (h->cur_pic_ptr) { h->cur_pic_ptr->reference = 0; for (j=i=0; h->delayed_pic[i]; i++) if (h->delayed_pic[i] != h->cur_pic_ptr) h->delayed_pic[j++] = h->delayed_pic[i]; h->delayed_pic[j] = NULL; } h->first_field = 0; memset(h->ref_list[0], 0, sizeof(h->ref_list[0])); memset(h->ref_list[1], 0, sizeof(h->ref_list[1])); memset(h->default_ref_list[0], 0, sizeof(h->default_ref_list[0])); memset(h->default_ref_list[1], 0, sizeof(h->default_ref_list[1])); ff_h264_reset_sei(h); h->recovery_frame= -1; h->sync= 0; h->list_count = 0; h->current_slice = 0; }
0
[ "CWE-703" ]
FFmpeg
29ffeef5e73b8f41ff3a3f2242d356759c66f91f
145,800,008,831,434,810,000,000,000,000,000,000,000
27
avcodec/h264: do not trust last_pic_droppable when marking pictures as done This simplifies the code and fixes a deadlock Fixes Ticket2927 Signed-off-by: Michael Niedermayer <[email protected]>
static void scalar_min_max_mul(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { s64 smin_val = src_reg->smin_value; u64 umin_val = src_reg->umin_value; u64 umax_val = src_reg->umax_value; dst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg->var_off); if (smin_val < 0 || dst_reg->smin_value < 0) { /* Ain't nobody got time to multiply that sign */ __mark_reg_unbounded(dst_reg); __update_reg_bounds(dst_reg); return; } /* Both values are positive, so we can work with unsigned and * copy the result to signed (unless it exceeds S64_MAX). */ if (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) { /* Potential overflow, we know nothing */ __mark_reg_unbounded(dst_reg); /* (except what we can learn from the var_off) */ __update_reg_bounds(dst_reg); return; } dst_reg->umin_value *= umin_val; dst_reg->umax_value *= umax_val; if (dst_reg->umax_value > S64_MAX) { /* Overflow possible, we know nothing */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } }
0
[]
linux
294f2fc6da27620a506e6c050241655459ccd6bd
305,266,281,143,365,700,000,000,000,000,000,000,000
35
bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds() Currently, for all op verification we call __red_deduce_bounds() and __red_bound_offset() but we only call __update_reg_bounds() in bitwise ops. However, we could benefit from calling __update_reg_bounds() in BPF_ADD, BPF_SUB, and BPF_MUL cases as well. For example, a register with state 'R1_w=invP0' when we subtract from it, w1 -= 2 Before coerce we will now have an smin_value=S64_MIN, smax_value=U64_MAX and unsigned bounds umin_value=0, umax_value=U64_MAX. These will then be clamped to S32_MIN, U32_MAX values by coerce in the case of alu32 op as done in above example. However tnum will be a constant because the ALU op is done on a constant. Without update_reg_bounds() we have a scenario where tnum is a const but our unsigned bounds do not reflect this. By calling update_reg_bounds after coerce to 32bit we further refine the umin_value to U64_MAX in the alu64 case or U32_MAX in the alu32 case above. Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/158507151689.15666.566796274289413203.stgit@john-Precision-5820-Tower
gstd_get_display_name(gss_name_t client) { OM_uint32 maj; OM_uint32 min; gss_buffer_desc buf; char *ret; maj = gss_display_name(&min, client, &buf, NULL); GSTD_GSS_ERROR(maj, min, NULL, "gss_display_name"); if ((ret = (char *)malloc(buf.length + 1)) == NULL) { LOG(LOG_ERR, ("unable to malloc")); gss_release_buffer(&min, &buf); return NULL; } memcpy(ret, buf.value, buf.length); ret[buf.length] = '\0'; gss_release_buffer(&min, &buf); return ret; }
0
[ "CWE-400", "CWE-703" ]
knc
f237f3e09ecbaf59c897f5046538a7b1a3fa40c1
8,850,270,864,907,287,000,000,000,000,000,000,000
23
knc: fix a couple of memory leaks. One of these can be remotely triggered during the authentication phase which leads to a remote DoS possibility. Pointed out by: Imre Rad <[email protected]>
bool st_select_lex::add_group_to_list(THD *thd, Item *item, bool asc) { return add_to_list(thd, group_list, item, asc); }
0
[ "CWE-476" ]
server
3a52569499e2f0c4d1f25db1e81617a9d9755400
199,970,563,220,452,650,000,000,000,000,000,000,000
4
MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294 The asserion failure was caused by this query select /*id=1*/ from t1 where col= ( select /*id=2*/ from ... where corr_cond1 union select /*id=4*/ from ... where corr_cond2) Here, - select with id=2 was correlated due to corr_cond1. - select with id=4 was initially correlated due to corr_cond2, but then the optimizer optimized away the correlation, making the select with id=4 uncorrelated. However, since select with id=2 remained correlated, the execution had to re-compute the whole UNION. When it tried to execute select with id=4, it hit an assertion (join buffer already free'd). This is because select with id=4 has freed its execution structures after it has been executed once. The select is uncorrelated, so it did not expect it would need to be executed for the second time. Fixed this by adding this logic in st_select_lex::optimize_unflattened_subqueries(): If a member of a UNION is correlated, mark all its members as correlated, so that they are prepared to be executed multiple times.
ModuleExport size_t RegisterSFWImage(void) { MagickInfo *entry; entry=AcquireMagickInfo("SFW","SFW","Seattle Film Works"); entry->decoder=(DecodeImageHandler *) ReadSFWImage; entry->magick=(IsImageFormatHandler *) IsSFW; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }
0
[ "CWE-119" ]
ImageMagick
d4145e664aea3752ca6d3bf1ee825352b595dab5
47,499,817,498,175,100,000,000,000,000,000,000,000
13
https://github.com/ImageMagick/ImageMagick/issues/682
inline double DistanceTransform(double x) { static bool linear = FLAGS_linear; if (linear) { return x; } else { /* Using log^2 scale because log scale produces big white gap at the bottom of image. */ return log(x) * log(x); } }
0
[ "CWE-120" ]
brotli
223d80cfbec8fd346e32906c732c8ede21f0cea6
279,599,794,825,595,800,000,000,000,000,000,000,000
10
Update (#826) * IMPORTANT: decoder: fix potential overflow when input chunk is >2GiB * simplify max Huffman table size calculation * eliminate symbol duplicates (static arrays in .h files) * minor combing in research/ code
static struct dwc3_trb *dwc3_ep_prev_trb(struct dwc3_ep *dep, u8 index) { u8 tmp = index; if (!tmp) tmp = DWC3_TRB_NUM - 1; return &dep->trb_pool[tmp - 1]; }
0
[ "CWE-703", "CWE-667", "CWE-189" ]
linux
c91815b596245fd7da349ecc43c8def670d2269e
4,174,882,567,518,535,300,000,000,000,000,000,000
9
usb: dwc3: gadget: never call ->complete() from ->ep_queue() This is a requirement which has always existed but, somehow, wasn't reflected in the documentation and problems weren't found until now when Tuba Yavuz found a possible deadlock happening between dwc3 and f_hid. She described the situation as follows: spin_lock_irqsave(&hidg->write_spinlock, flags); // first acquire /* we our function has been disabled by host */ if (!hidg->req) { free_ep_req(hidg->in_ep, hidg->req); goto try_again; } [...] status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC); => [...] => usb_gadget_giveback_request => f_hidg_req_complete => spin_lock_irqsave(&hidg->write_spinlock, flags); // second acquire Note that this happens because dwc3 would call ->complete() on a failed usb_ep_queue() due to failed Start Transfer command. This is, anyway, a theoretical situation because dwc3 currently uses "No Response Update Transfer" command for Bulk and Interrupt endpoints. It's still good to make this case impossible to happen even if the "No Reponse Update Transfer" command is changed. Reported-by: Tuba Yavuz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
uint32 get_field_buffer_size(void) { return value.alloced_length(); }
0
[ "CWE-416", "CWE-703" ]
server
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
233,333,893,067,550,600,000,000,000,000,000,000,000
1
MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if() vcol_info->expr is allocated on expr_arena at parsing stage. Since expr item is allocated on expr_arena all its containee items must be allocated on expr_arena too. Otherwise fix_session_expr() will encounter prematurely freed item. When table is reopened from cache vcol_info contains stale expression. We refresh expression via TABLE::vcol_fix_exprs() but first we must prepare a proper context (Vcol_expr_context) which meets some requirements: 1. As noted above expr update must be done on expr_arena as there may be new items created. It was a bug in fix_session_expr_for_read() and was just not reproduced because of no second refix. Now refix is done for more cases so it does reproduce. Tests affected: vcol.binlog 2. Also name resolution context must be narrowed to the single table. Tested by: vcol.update main.default vcol.vcol_syntax gcol.gcol_bugfixes 3. sql_mode must be clean and not fail expr update. sql_mode such as MODE_NO_BACKSLASH_ESCAPES, MODE_NO_ZERO_IN_DATE, etc must not affect vcol expression update. If the table was created successfully any further evaluation must not fail. Tests affected: main.func_like Reviewed by: Sergei Golubchik <[email protected]>
WALInsertSlotReleaseOne(int slotno) { volatile XLogInsertSlot *slot = &XLogCtl->Insert.insertSlots[slotno].slot; PGPROC *head; PGPROC *proc; /* Acquire mutex. Time spent holding mutex should be short! */ SpinLockAcquire(&slot->mutex); /* we must be holding it */ Assert(slot->exclusive == 1 && slot->owner == MyProc); slot->xlogInsertingAt = InvalidXLogRecPtr; /* Release my hold on the slot */ slot->exclusive = 0; slot->owner = NULL; /* * See if I need to awaken any waiters.. */ head = slot->head; if (head != NULL) { if (slot->releaseOK) { /* * Remove the to-be-awakened PGPROCs from the queue. */ bool releaseOK = true; proc = head; /* * First wake up any backends that want to be woken up without * acquiring the lock. These are always in the front of the queue. */ while (proc->lwWaitMode == LW_WAIT_UNTIL_FREE && proc->lwWaitLink) proc = proc->lwWaitLink; /* * Awaken the first exclusive-waiter, if any. */ if (proc->lwWaitLink) { Assert(proc->lwWaitLink->lwWaitMode == LW_EXCLUSIVE); proc = proc->lwWaitLink; releaseOK = false; } /* proc is now the last PGPROC to be released */ slot->head = proc->lwWaitLink; proc->lwWaitLink = NULL; slot->releaseOK = releaseOK; } else head = NULL; } /* We are done updating shared state of the slot itself. */ SpinLockRelease(&slot->mutex); /* * Awaken any waiters I removed from the queue. */ while (head != NULL) { proc = head; head = proc->lwWaitLink; proc->lwWaitLink = NULL; proc->lwWaiting = false; PGSemaphoreUnlock(&proc->sem); } /* * Now okay to allow cancel/die interrupts. */ END_CRIT_SECTION(); }
0
[ "CWE-119" ]
postgres
01824385aead50e557ca1af28640460fa9877d51
340,096,065,303,526,440,000,000,000,000,000,000,000
79
Prevent potential overruns of fixed-size buffers. Coverity identified a number of places in which it couldn't prove that a string being copied into a fixed-size buffer would fit. We believe that most, perhaps all of these are in fact safe, or are copying data that is coming from a trusted source so that any overrun is not really a security issue. Nonetheless it seems prudent to forestall any risk by using strlcpy() and similar functions. Fixes by Peter Eisentraut and Jozef Mlich based on Coverity reports. In addition, fix a potential null-pointer-dereference crash in contrib/chkpass. The crypt(3) function is defined to return NULL on failure, but chkpass.c didn't check for that before using the result. The main practical case in which this could be an issue is if libc is configured to refuse to execute unapproved hashing algorithms (e.g., "FIPS mode"). This ideally should've been a separate commit, but since it touches code adjacent to one of the buffer overrun changes, I included it in this commit to avoid last-minute merge issues. This issue was reported by Honza Horak. Security: CVE-2014-0065 for buffer overruns, CVE-2014-0066 for crypt()
set_ref_in_insexpand_funcs(int copyID) { int abort = FALSE; abort = set_ref_in_callback(&cfu_cb, copyID); abort = abort || set_ref_in_callback(&ofu_cb, copyID); abort = abort || set_ref_in_callback(&tsrfu_cb, copyID); return abort; }
0
[ "CWE-125" ]
vim
f12129f1714f7d2301935bb21d896609bdac221c
278,641,298,776,835,020,000,000,000,000,000,000,000
10
patch 9.0.0020: with some completion reading past end of string Problem: With some completion reading past end of string. Solution: Check the length of the string.
char *string(char *buf, char *end, const char *s, struct printf_spec spec) { int len = 0; size_t lim = spec.precision; if ((unsigned long)s < PAGE_SIZE) s = "(null)"; while (lim--) { char c = *s++; if (!c) break; if (buf < end) *buf = c; ++buf; ++len; } return widen_string(buf, len, end, spec); }
0
[ "CWE-200" ]
linux
ad67b74d2469d9b82aaa572d76474c95bc484d57
123,115,635,652,379,900,000,000,000,000,000,000,000
19
printk: hash addresses printed with %p Currently there exist approximately 14 000 places in the kernel where addresses are being printed using an unadorned %p. This potentially leaks sensitive information regarding the Kernel layout in memory. Many of these calls are stale, instead of fixing every call lets hash the address by default before printing. This will of course break some users, forcing code printing needed addresses to be updated. Code that _really_ needs the address will soon be able to use the new printk specifier %px to print the address. For what it's worth, usage of unadorned %p can be broken down as follows (thanks to Joe Perches). $ git grep -E '%p[^A-Za-z0-9]' | cut -f1 -d"/" | sort | uniq -c 1084 arch 20 block 10 crypto 32 Documentation 8121 drivers 1221 fs 143 include 101 kernel 69 lib 100 mm 1510 net 40 samples 7 scripts 11 security 166 sound 152 tools 2 virt Add function ptr_to_id() to map an address to a 32 bit unique identifier. Hash any unadorned usage of specifier %p and any malformed specifiers. Signed-off-by: Tobin C. Harding <[email protected]>
static void bh_put(struct gfs2_quota_data *qd) { struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; mutex_lock(&sdp->sd_quota_mutex); gfs2_assert(sdp, qd->qd_bh_count); if (!--qd->qd_bh_count) { brelse(qd->qd_bh); qd->qd_bh = NULL; qd->qd_bh_qc = NULL; } mutex_unlock(&sdp->sd_quota_mutex); }
0
[ "CWE-399" ]
linux-2.6
7e619bc3e6252dc746f64ac3b486e784822e9533
143,382,261,977,236,950,000,000,000,000,000,000,000
13
GFS2: Fix writing to non-page aligned gfs2_quota structures This is the upstream fix for this bug. This patch differs from the RHEL5 fix (Red Hat bz #555754) which simply writes to the 8-byte value field of the quota. In upstream quota code, we're required to write the entire quota (88 bytes) which can be split across a page boundary. We check for such quotas, and read/write the two parts from/to the corresponding pages holding these parts. With this patch, I don't see the bug anymore using the reproducer in Red Hat bz 555754. I successfully ran a couple of simple tests/mounts/ umounts and it doesn't seem like this patch breaks anything else. Signed-off-by: Abhi Das <[email protected]> Signed-off-by: Steven Whitehouse <[email protected]>
static struct xps_map *expand_xps_map(struct xps_map *map, int attr_index, u16 index, bool is_rxqs_map) { struct xps_map *new_map; int alloc_len = XPS_MIN_MAP_ALLOC; int i, pos; for (pos = 0; map && pos < map->len; pos++) { if (map->queues[pos] != index) continue; return map; } /* Need to add tx-queue to this CPU's/rx-queue's existing map */ if (map) { if (pos < map->alloc_len) return map; alloc_len = map->alloc_len * 2; } /* Need to allocate new map to store tx-queue on this CPU's/rx-queue's * map */ if (is_rxqs_map) new_map = kzalloc(XPS_MAP_SIZE(alloc_len), GFP_KERNEL); else new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL, cpu_to_node(attr_index)); if (!new_map) return NULL; for (i = 0; i < pos; i++) new_map->queues[i] = map->queues[i]; new_map->alloc_len = alloc_len; new_map->len = pos; return new_map;
0
[ "CWE-416" ]
linux
a4270d6795b0580287453ea55974d948393e66ef
77,082,994,703,338,890,000,000,000,000,000,000,000
39
net-gro: fix use-after-free read in napi_gro_frags() If a network driver provides to napi_gro_frags() an skb with a page fragment of exactly 14 bytes, the call to gro_pull_from_frag0() will 'consume' the fragment by calling skb_frag_unref(skb, 0), and the page might be freed and reused. Reading eth->h_proto at the end of napi_frags_skb() might read mangled data, or crash under specific debugging features. BUG: KASAN: use-after-free in napi_frags_skb net/core/dev.c:5833 [inline] BUG: KASAN: use-after-free in napi_gro_frags+0xc6f/0xd10 net/core/dev.c:5841 Read of size 2 at addr ffff88809366840c by task syz-executor599/8957 CPU: 1 PID: 8957 Comm: syz-executor599 Not tainted 5.2.0-rc1+ #32 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:188 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 kasan_report+0x12/0x20 mm/kasan/common.c:614 __asan_report_load_n_noabort+0xf/0x20 mm/kasan/generic_report.c:142 napi_frags_skb net/core/dev.c:5833 [inline] napi_gro_frags+0xc6f/0xd10 net/core/dev.c:5841 tun_get_user+0x2f3c/0x3ff0 drivers/net/tun.c:1991 tun_chr_write_iter+0xbd/0x156 drivers/net/tun.c:2037 call_write_iter include/linux/fs.h:1872 [inline] do_iter_readv_writev+0x5f8/0x8f0 fs/read_write.c:693 do_iter_write fs/read_write.c:970 [inline] do_iter_write+0x184/0x610 fs/read_write.c:951 vfs_writev+0x1b3/0x2f0 fs/read_write.c:1015 do_writev+0x15b/0x330 fs/read_write.c:1058 Fixes: a50e233c50db ("net-gro: restore frag0 optimization") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: syzbot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) { u32 exit_intr_info; if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)) return; vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); exit_intr_info = vmx->exit_intr_info; /* Handle machine checks before interrupts are enabled */ if (is_machine_check(exit_intr_info)) kvm_machine_check(); /* We need to handle NMIs before interrupts are enabled */ if (is_nmi(exit_intr_info)) { kvm_before_handle_nmi(&vmx->vcpu); asm("int $2"); kvm_after_handle_nmi(&vmx->vcpu); } }
0
[ "CWE-388" ]
linux
ef85b67385436ddc1998f45f1d6a210f935b3388
98,979,761,716,345,050,000,000,000,000,000,000,000
22
kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF) When L2 exits to L0 due to "exception or NMI", software exceptions (#BP and #OF) for which L1 has requested an intercept should be handled by L1 rather than L0. Previously, only hardware exceptions were forwarded to L1. Signed-off-by: Jim Mattson <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
xps_setlogop(gx_device_vector *vdev, gs_logical_operation_t lop, gs_logical_operation_t diff) { if_debug2m('_', vdev->memory, "xps_setlogop(%u,%u) set logical operation\n", lop, diff); /* XPS can fake some simpler modes, but we ignore this for now. */ return 0; }
0
[]
ghostpdl
94d8955cb7725eb5f3557ddc02310c76124fdd1a
329,540,880,923,050,070,000,000,000,000,000,000,000
8
Bug 701818: better handling of error during PS/PDF image In the xps device, if an error occurred after xps_begin_image() but before xps_image_end_image(), *if* the Postscript had called 'restore' as part of the error handling, the image enumerator would have been freed (by the restore) despite the xps device still holding a reference to it. Simply changing to an allocator unaffected save/restore doesn't work because the enumerator holds references to other objects (graphics state, color space, possibly others) whose lifespans are inherently controlled by save/restore. So, add a finalize method for the XPS device's image enumerator (xps_image_enum_finalize()) which takes over cleaning up the memory it allocates and also deals with cleaning up references from the device to the enumerator and from the enumerator to the device.
lseg_in(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); LSEG *lseg; int isopen; char *s; lseg = (LSEG *) palloc(sizeof(LSEG)); if ((!path_decode(TRUE, 2, str, &isopen, &s, &(lseg->p[0]))) || (*s != '\0')) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type lseg: \"%s\"", str))); #ifdef NOT_USED lseg->m = point_sl(&lseg->p[0], &lseg->p[1]); #endif PG_RETURN_LSEG_P(lseg); }
0
[ "CWE-703", "CWE-189" ]
postgres
31400a673325147e1205326008e32135a78b4d8a
243,344,770,022,564,700,000,000,000,000,000,000,000
21
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
secure_getenv (const char *name) { if (getauxval (AT_SECURE)) return NULL; return getenv (name); }
0
[ "CWE-190" ]
p11-kit
bd670b1d4984b27d6a397b9ddafaf89ab26e4e7f
30,960,635,763,342,315,000,000,000,000,000,000,000
6
Follow-up to arithmetic overflow fix Check if nmemb is zero in p11_rpc_message_alloc_extra_array to avoid a division by zero trap. Additionally, change the reallocarray compatibility shim so that it won't assert when resizing an array to zero, and add the same nmemb != 0 check there.
curwin_init(void) { win_init_empty(curwin); }
0
[ "CWE-416" ]
vim
ec66c41d84e574baf8009dbc0bd088d2bc5b2421
273,784,350,465,031,900,000,000,000,000,000,000,000
4
patch 8.1.2136: using freed memory with autocmd from fuzzer Problem: using freed memory with autocmd from fuzzer. (Dhiraj Mishra, Dominique Pelle) Solution: Avoid using "wp" after autocommands. (closes #5041)
static void cmd_nctcp(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { const char *target, *text; void *free_arg; CMD_IRC_SERVER(server); if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &text)) return; if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); signal_emit("message irc own_notice", 3, server, text, target); cmd_params_free(free_arg); }
0
[ "CWE-416" ]
irssi
36564717c9f701e3a339da362ab46d220d27e0c1
58,987,587,515,742,625,000,000,000,000,000,000,000
19
Merge branch 'security' into 'master' Security See merge request irssi/irssi!34 (cherry picked from commit b0d9cb33cd9ef9da7c331409e8b7c57a6f3aef3f)
xml_node_iter_get_current (xmlNodeIter *iter) { return iter->cur_node; }
0
[]
gvfs
f81ff2108ab3b6e370f20dcadd8708d23f499184
7,688,080,329,731,066,000,000,000,000,000,000,000
4
dav: don't unescape the uri twice path_equal tries to unescape path before comparing. Unfortunately this function is used also for already unescaped paths. Therefore unescaping can fail. This commit reverts changes which was done in commit 50af53d and unescape just uris, which aren't unescaped yet. https://bugzilla.gnome.org/show_bug.cgi?id=743298
SYSCALL_DEFINE1(osf_utsname, char __user *, name) { int error; down_read(&uts_sem); error = -EFAULT; if (copy_to_user(name + 0, utsname()->sysname, 32)) goto out; if (copy_to_user(name + 32, utsname()->nodename, 32)) goto out; if (copy_to_user(name + 64, utsname()->release, 32)) goto out; if (copy_to_user(name + 96, utsname()->version, 32)) goto out; if (copy_to_user(name + 128, utsname()->machine, 32)) goto out; error = 0; out: up_read(&uts_sem); return error; }
0
[ "CWE-703", "CWE-264", "CWE-189" ]
linux
21c5977a836e399fc710ff2c5367845ed5c2527f
66,108,529,206,650,780,000,000,000,000,000,000,000
22
alpha: fix several security issues Fix several security issues in Alpha-specific syscalls. Untested, but mostly trivial. 1. Signedness issue in osf_getdomainname allows copying out-of-bounds kernel memory to userland. 2. Signedness issue in osf_sysinfo allows copying large amounts of kernel memory to userland. 3. Typo (?) in osf_getsysinfo bounds minimum instead of maximum copy size, allowing copying large amounts of kernel memory to userland. 4. Usage of user pointer in osf_wait4 while under KERNEL_DS allows privilege escalation via writing return value of sys_wait4 to kernel memory. Signed-off-by: Dan Rosenberg <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int vcpu_mmio_read(struct kvm_vcpu *vcpu, gpa_t addr, int len, void *v) { if (vcpu->arch.apic && !kvm_iodevice_read(&vcpu->arch.apic->dev, addr, len, v)) return 0; return kvm_io_bus_read(vcpu->kvm, KVM_MMIO_BUS, addr, len, v); }
0
[ "CWE-200" ]
kvm
831d9d02f9522e739825a51a11e3bc5aa531a905
53,323,160,952,588,200,000,000,000,000,000,000,000
8
KVM: x86: fix information leak to userland Structures kvm_vcpu_events, kvm_debugregs, kvm_pit_state2 and kvm_clock_data are copied to userland with some padding and reserved fields unitialized. It leads to leaking of contents of kernel stack memory. We have to initialize them to zero. In patch v1 Jan Kiszka suggested to fill reserved fields with zeros instead of memset'ting the whole struct. It makes sense as these fields are explicitly marked as padding. No more fields need zeroing. KVM-Stable-Tag. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
void AbstractSqlStorage::dbConnect(QSqlDatabase &db) { if (!db.open()) { quWarning() << "Unable to open database" << displayName() << "for thread" << QThread::currentThread(); quWarning() << "-" << db.lastError().text(); } else { if (!initDbSession(db)) { quWarning() << "Unable to initialize database" << displayName() << "for thread" << QThread::currentThread(); db.close(); } } }
0
[ "CWE-89" ]
quassel
6605882f41331c80f7ac3a6992650a702ec71283
19,940,179,961,668,175,000,000,000,000,000,000,000
13
Execute initDbSession() on DB reconnects Previously, the initDbSession() function would only be run on the initial connect. Since the initDbSession() code in PostgreSQL is used to fix the CVE-2013-4422 SQL Injection bug, this means that Quassel was still vulnerable to that CVE if the PostgreSQL server is restarted or the connection is lost at any point while Quassel is running. This bug also causes the Qt5 psql timezone fix to stop working after a reconnect. The fix is to disable Qt's automatic reconnecting, check the connection status ourselves, and reconnect if necessary, executing the initDbSession() function afterward.
static int mcryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, struct mcryptd_queue *queue) { struct hashd_instance_ctx *ctx; struct ahash_instance *inst; struct hash_alg_common *halg; struct crypto_alg *alg; u32 type = 0; u32 mask = 0; int err; mcryptd_check_internal(tb, &type, &mask); halg = ahash_attr_alg(tb[1], type, mask); if (IS_ERR(halg)) return PTR_ERR(halg); alg = &halg->base; pr_debug("crypto: mcryptd hash alg: %s\n", alg->cra_name); inst = mcryptd_alloc_instance(alg, ahash_instance_headroom(), sizeof(*ctx)); err = PTR_ERR(inst); if (IS_ERR(inst)) goto out_put_alg; ctx = ahash_instance_ctx(inst); ctx->queue = queue; err = crypto_init_ahash_spawn(&ctx->spawn, halg, ahash_crypto_instance(inst)); if (err) goto out_free_inst; type = CRYPTO_ALG_ASYNC; if (alg->cra_flags & CRYPTO_ALG_INTERNAL) type |= CRYPTO_ALG_INTERNAL; inst->alg.halg.base.cra_flags = type; inst->alg.halg.digestsize = halg->digestsize; inst->alg.halg.statesize = halg->statesize; inst->alg.halg.base.cra_ctxsize = sizeof(struct mcryptd_hash_ctx); inst->alg.halg.base.cra_init = mcryptd_hash_init_tfm; inst->alg.halg.base.cra_exit = mcryptd_hash_exit_tfm; inst->alg.init = mcryptd_hash_init_enqueue; inst->alg.update = mcryptd_hash_update_enqueue; inst->alg.final = mcryptd_hash_final_enqueue; inst->alg.finup = mcryptd_hash_finup_enqueue; inst->alg.export = mcryptd_hash_export; inst->alg.import = mcryptd_hash_import; inst->alg.setkey = mcryptd_hash_setkey; inst->alg.digest = mcryptd_hash_digest_enqueue; err = ahash_register_instance(tmpl, inst); if (err) { crypto_drop_ahash(&ctx->spawn); out_free_inst: kfree(inst); } out_put_alg: crypto_mod_put(alg); return err; }
1
[ "CWE-476", "CWE-284" ]
linux
48a992727d82cb7db076fa15d372178743b1f4cd
327,830,603,762,624,040,000,000,000,000,000,000,000
65
crypto: mcryptd - Check mcryptd algorithm compatibility Algorithms not compatible with mcryptd could be spawned by mcryptd with a direct crypto_alloc_tfm invocation using a "mcryptd(alg)" name construct. This causes mcryptd to crash the kernel if an arbitrary "alg" is incompatible and not intended to be used with mcryptd. It is an issue if AF_ALG tries to spawn mcryptd(alg) to expose it externally. But such algorithms must be used internally and not be exposed. We added a check to enforce that only internal algorithms are allowed with mcryptd at the time mcryptd is spawning an algorithm. Link: http://marc.info/?l=linux-crypto-vger&m=148063683310477&w=2 Cc: [email protected] Reported-by: Mikulas Patocka <[email protected]> Signed-off-by: Tim Chen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int phar_hex_str(const char *digest, size_t digest_len, char **signature) /* {{{ */ { int pos = -1; size_t len = 0; *signature = (char*)safe_pemalloc(digest_len, 2, 1, PHAR_G(persist)); for (; len < digest_len; ++len) { (*signature)[++pos] = hexChars[((const unsigned char *)digest)[len] >> 4]; (*signature)[++pos] = hexChars[((const unsigned char *)digest)[len] & 0x0F]; } (*signature)[++pos] = '\0'; return pos; }
0
[ "CWE-119", "CWE-787" ]
php-src
0bfb970f43acd1e81d11be1154805f86655f15d5
20,340,399,852,849,933,000,000,000,000,000,000,000
14
Fix bug #72928 - Out of bound when verify signature of zip phar in phar_parse_zipfile (cherry picked from commit 19484ab77466f99c78fc0e677f7e03da0584d6a2)
static inline size_t drbg_max_request_bytes(struct drbg_state *drbg) { /* SP800-90A requires the limit 2**19 bits, but we return bytes */ return (1 << 16); }
0
[ "CWE-476" ]
linux
8fded5925d0a733c46f8d0b5edd1c9b315882b1d
34,544,298,412,647,603,000,000,000,000,000,000,000
5
crypto: drbg - Convert to new rng interface This patch converts the DRBG implementation to the new low-level rng interface. This allows us to get rid of struct drbg_gen by using the new RNG API instead. Signed-off-by: Herbert Xu <[email protected]> Acked-by: Stephan Mueller <[email protected]>
static void set_xsi_nil(xmlNodePtr node) { set_ns_prop(node, XSI_NAMESPACE, "nil", "true"); }
0
[ "CWE-19" ]
php-src
c8eaca013a3922e8383def6158ece2b63f6ec483
211,339,995,846,373,400,000,000,000,000,000,000,000
4
Added type checks
static int php_stream_memory_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */ { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; size_t newsize; switch(option) { case PHP_STREAM_OPTION_TRUNCATE_API: switch (value) { case PHP_STREAM_TRUNCATE_SUPPORTED: return PHP_STREAM_OPTION_RETURN_OK; case PHP_STREAM_TRUNCATE_SET_SIZE: if (ms->mode & TEMP_STREAM_READONLY) { return PHP_STREAM_OPTION_RETURN_ERR; } newsize = *(size_t*)ptrparam; if (newsize <= ms->fsize) { if (newsize < ms->fpos) { ms->fpos = newsize; } } else { ms->data = erealloc(ms->data, newsize); memset(ms->data+ms->fsize, 0, newsize - ms->fsize); ms->fsize = newsize; } ms->fsize = newsize; return PHP_STREAM_OPTION_RETURN_OK; } default: return PHP_STREAM_OPTION_RETURN_NOTIMPL; } }
0
[ "CWE-20" ]
php-src
6297a117d77fa3a0df2e21ca926a92c231819cd5
85,578,455,705,201,210,000,000,000,000,000,000,000
32
Fixed bug #71323 - Output of stream_get_meta_data can be falsified by its input
changedir_func( char_u *new_dir, int forceit, cdscope_T scope) { char_u *tofree; char_u *pdir = NULL; int dir_differs; int retval = FALSE; if (new_dir == NULL || allbuf_locked()) return FALSE; if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit) { emsg(_("E747: Cannot change directory, buffer is modified (add ! to override)")); return FALSE; } // ":cd -": Change to previous directory if (STRCMP(new_dir, "-") == 0) { pdir = get_prevdir(scope); if (pdir == NULL) { emsg(_("E186: No previous directory")); return FALSE; } new_dir = pdir; } // Free the previous directory tofree = get_prevdir(scope); // Save current directory for next ":cd -" if (mch_dirname(NameBuff, MAXPATHL) == OK) pdir = vim_strsave(NameBuff); else pdir = NULL; if (scope == CDSCOPE_WINDOW) curwin->w_prevdir = pdir; else if (scope == CDSCOPE_TABPAGE) curtab->tp_prevdir = pdir; else prev_dir = pdir; #if defined(UNIX) || defined(VMS) // for UNIX ":cd" means: go to home directory if (*new_dir == NUL) { // use NameBuff for home directory name # ifdef VMS char_u *p; p = mch_getenv((char_u *)"SYS$LOGIN"); if (p == NULL || *p == NUL) // empty is the same as not set NameBuff[0] = NUL; else vim_strncpy(NameBuff, p, MAXPATHL - 1); # else expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); # endif new_dir = NameBuff; } #endif dir_differs = new_dir == NULL || pdir == NULL || pathcmp((char *)pdir, (char *)new_dir, -1) != 0; if (new_dir == NULL || (dir_differs && vim_chdir(new_dir))) emsg(_(e_failed)); else { char_u *acmd_fname; post_chdir(scope); if (dir_differs) { if (scope == CDSCOPE_WINDOW) acmd_fname = (char_u *)"window"; else if (scope == CDSCOPE_TABPAGE) acmd_fname = (char_u *)"tabpage"; else acmd_fname = (char_u *)"global"; apply_autocmds(EVENT_DIRCHANGED, acmd_fname, new_dir, FALSE, curbuf); } retval = TRUE; } vim_free(tofree); return retval; }
0
[ "CWE-122" ]
vim
35a319b77f897744eec1155b736e9372c9c5575f
208,495,858,138,984,860,000,000,000,000,000,000,000
92
patch 8.2.3489: ml_get error after search with range Problem: ml_get error after search with range. Solution: Limit the line number to the buffer line count.
translate_into_utf8(const char* str, const char* enc) { PyObject *utf8; PyObject* buf = PyUnicode_Decode(str, strlen(str), enc, NULL); if (buf == NULL) return NULL; utf8 = PyUnicode_AsUTF8String(buf); Py_DECREF(buf); return utf8; }
0
[ "CWE-125" ]
cpython
dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c
126,218,811,763,087,450,000,000,000,000,000,000,000
9
bpo-35766: Merge typed_ast back into CPython (GH-11645)
void zinterstoreCommand(client *c) { zunionInterGenericCommand(c,c->argv[1], SET_OP_INTER); }
0
[ "CWE-190" ]
redis
f6a40570fa63d5afdd596c78083d754081d80ae3
21,510,137,668,712,295,000,000,000,000,000,000,000
3
Fix ziplist and listpack overflows and truncations (CVE-2021-32627, CVE-2021-32628) - fix possible heap corruption in ziplist and listpack resulting by trying to allocate more than the maximum size of 4GB. - prevent ziplist (hash and zset) from reaching size of above 1GB, will be converted to HT encoding, that's not a useful size. - prevent listpack (stream) from reaching size of above 1GB. - XADD will start a new listpack if the new record may cause the previous listpack to grow over 1GB. - XADD will respond with an error if a single stream record is over 1GB - List type (ziplist in quicklist) was truncating strings that were over 4GB, now it'll respond with an error.
static zend_bool early_find_sid_in(zval *dest, int where, php_session_rfc1867_progress *progress TSRMLS_DC) /* {{{ */ { zval **ppid; if (!PG(http_globals)[where]) { return 0; } if (zend_hash_find(Z_ARRVAL_P(PG(http_globals)[where]), PS(session_name), progress->sname_len+1, (void **)&ppid) == SUCCESS && Z_TYPE_PP(ppid) == IS_STRING) { zval_dtor(dest); ZVAL_ZVAL(dest, *ppid, 1, 0); return 1; } return 0; } /* }}} */
0
[ "CWE-264" ]
php-src
25e8fcc88fa20dc9d4c47184471003f436927cde
134,664,801,185,121,900,000,000,000,000,000,000,000
17
Strict session
static void install_list_entry(const char *lib) { assert(lib); // filename check int len = strlen(lib); if (strcspn(lib, "\\&!?\"'<>%^(){}[];,") != (size_t)len || strstr(lib, "..")) { fprintf(stderr, "Error: \"%s\" is an invalid library\n", lib); exit(1); } // if this is a full path, use it as is if (*lib == '/') return load_library(lib); // find the library int i; for (i = 0; default_lib_paths[i]; i++) { char *fname = NULL; if (asprintf(&fname, "%s/%s", default_lib_paths[i], lib) == -1) errExit("asprintf"); #define DO_GLOBBING #ifdef DO_GLOBBING // globbing glob_t globbuf; int globerr = glob(fname, GLOB_NOCHECK | GLOB_NOSORT | GLOB_PERIOD, NULL, &globbuf); if (globerr) { fprintf(stderr, "Error: failed to glob private-lib pattern %s\n", fname); exit(1); } size_t j; for (j = 0; j < globbuf.gl_pathc; j++) { assert(globbuf.gl_pathv[j]); //printf("glob %s\n", globbuf.gl_pathv[j]); // GLOB_NOCHECK - no pattern matched returns the original pattern; try to load it anyway load_library(globbuf.gl_pathv[j]); } globfree(&globbuf); #else load_library(fname); #endif free(fname); } // fwarning("%s library not found, skipping...\n", lib); return; }
0
[ "CWE-284", "CWE-732" ]
firejail
eecf35c2f8249489a1d3e512bb07f0d427183134
260,745,975,098,883,600,000,000,000,000,000,000,000
50
mount runtime seccomp files read-only (#2602) avoid creating locations in the file system that are both writable and executable (in this case for processes with euid of the user). for the same reason also remove user owned libfiles when it is not needed any more
ConnectionManagerStats ConnectionManagerImpl::generateStats(const std::string& prefix, Stats::Scope& scope) { return ConnectionManagerStats( {ALL_HTTP_CONN_MAN_STATS(POOL_COUNTER_PREFIX(scope, prefix), POOL_GAUGE_PREFIX(scope, prefix), POOL_HISTOGRAM_PREFIX(scope, prefix))}, prefix, scope); }
0
[ "CWE-400" ]
envoy
0e49a495826ea9e29134c1bd54fdeb31a034f40c
128,823,687,489,467,530,000,000,000,000,000,000,000
7
http/2: add stats and stream flush timeout (#139) This commit adds a new stream flush timeout to guard against a remote server that does not open window once an entire stream has been buffered for flushing. Additional stats have also been added to better understand the codecs view of active streams as well as amount of data buffered. Signed-off-by: Matt Klein <[email protected]>
static void defer_open_done(struct tevent_req *req) { struct defer_open_state *state = tevent_req_callback_data( req, struct defer_open_state); NTSTATUS status; bool ret; status = dbwrap_record_watch_recv(req, talloc_tos(), NULL); TALLOC_FREE(req); if (!NT_STATUS_IS_OK(status)) { DEBUG(5, ("dbwrap_record_watch_recv returned %s\n", nt_errstr(status))); /* * Even if it failed, retry anyway. TODO: We need a way to * tell a re-scheduled open about that error. */ } DEBUG(10, ("scheduling mid %llu\n", (unsigned long long)state->mid)); ret = schedule_deferred_open_message_smb(state->sconn, state->mid); SMB_ASSERT(ret); TALLOC_FREE(state); }
0
[]
samba
60f922bf1bd8816eacbb32c24793ad1f97a1d9f2
132,797,743,562,475,090,000,000,000,000,000,000,000
24
Fix bug #10229 - No access check verification on stream files. https://bugzilla.samba.org/show_bug.cgi?id=10229 We need to check if the requested access mask could be used to open the underlying file (if it existed), as we're passing in zero for the access mask to the base filename. Signed-off-by: Jeremy Allison <[email protected]> Reviewed-by: Stefan Metzmacher <[email protected]> Reviewed-by: David Disseldorp <[email protected]>
static void delay(int ms) { unsigned long timeout = jiffies + ((ms * HZ) / 1000); while (time_before(jiffies, timeout)) cpu_relax(); }
0
[ "CWE-401" ]
linux
29eb31542787e1019208a2e1047bb7c76c069536
217,794,484,032,867,000,000,000,000,000,000,000,000
6
yam: fix a memory leak in yam_siocdevprivate() ym needs to be free when ym->cmd != SIOCYAMSMCS. Fixes: 0781168e23a2 ("yam: fix a missing-check bug") Signed-off-by: Hangyu Hua <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void cgsem_destroy(cgsem_t *cgsem) { sem_destroy(cgsem); }
0
[ "CWE-20", "CWE-703" ]
sgminer
910c36089940e81fb85c65b8e63dcd2fac71470c
32,497,349,174,831,500,000,000,000,000,000,000,000
4
stratum: parse_notify(): Don't die on malformed bbversion/prev_hash/nbit/ntime. Might have introduced a memory leak, don't have time to check. :( Should the other hex2bin()'s be checked? Thanks to Mick Ayzenberg <mick.dejavusecurity.com> for finding this.
obj_to_asn1null(VALUE obj) { ASN1_NULL *null; if(!NIL_P(obj)) ossl_raise(eASN1Error, "nil expected"); if(!(null = ASN1_NULL_new())) ossl_raise(eASN1Error, NULL); return null; }
0
[ "CWE-119" ]
openssl
1648afef33c1d97fb203c82291b8a61269e85d3b
171,052,876,035,628,980,000,000,000,000,000,000,000
11
asn1: fix out-of-bounds read in decoding constructed objects OpenSSL::ASN1.{decode,decode_all,traverse} have a bug of out-of-bounds read. int_ossl_asn1_decode0_cons() does not give the correct available length to ossl_asn1_decode() when decoding the inner components of a constructed object. This can cause out-of-bounds read if a crafted input given. Reference: https://hackerone.com/reports/170316
static void vfs_init_default(connection_struct *conn) { DEBUG(3, ("Initialising default vfs hooks\n")); vfs_init_custom(conn, DEFAULT_VFS_MODULE_NAME); }
0
[ "CWE-22" ]
samba
bd269443e311d96ef495a9db47d1b95eb83bb8f4
188,734,883,996,025,700,000,000,000,000,000,000,000
5
Fix bug 7104 - "wide links" and "unix extensions" are incompatible. Change parameter "wide links" to default to "no". Ensure "wide links = no" if "unix extensions = yes" on a share. Fix man pages to refect this. Remove "within share" checks for a UNIX symlink set - even if widelinks = no. The server will not follow that link anyway. Correct DEBUG message in check_reduced_name() to add missing "\n" so it's really clear when a path is being denied as it's outside the enclosing share path. Jeremy.
void splice_from_pipe_begin(struct splice_desc *sd) { sd->num_spliced = 0; sd->need_wakeup = false; }
0
[ "CWE-284", "CWE-264" ]
linux
8d0207652cbe27d1f962050737848e5ad4671958
201,915,136,497,132,870,000,000,000,000,000,000,000
5
->splice_write() via ->write_iter() iter_file_splice_write() - a ->splice_write() instance that gathers the pipe buffers, builds a bio_vec-based iov_iter covering those and feeds it to ->write_iter(). A bunch of simple cases coverted to that... [AV: fixed the braino spotted by Cyrill] Signed-off-by: Al Viro <[email protected]>
TEST_F(HttpHealthCheckerImplTest, ZeroRetryInterval) { const std::string host = "fake_cluster"; const std::string path = "/healthcheck"; const std::string yaml = R"EOF( timeout: 1s interval: 1s no_traffic_interval: 1s interval_jitter_percent: 40 unhealthy_threshold: 2 healthy_threshold: 2 http_health_check: service_name_matcher: prefix: locations path: /healthcheck )EOF"; allocHealthChecker(yaml); addCompletionCallback(); EXPECT_CALL(runtime_.snapshot_, featureEnabled("health_check.verify_cluster", 100)) .WillOnce(Return(true)); EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged)); cluster_->prioritySet().getMockHostSet(0)->hosts_ = { makeTestHost(cluster_->info_, "tcp://127.0.0.1:80", simTime())}; cluster_->info_->stats().upstream_cx_total_.inc(); expectSessionCreate(); expectStreamCreate(0); EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _)); EXPECT_CALL(test_sessions_[0]->request_encoder_, encodeHeaders(_, true)) .WillOnce(Invoke([&](const Http::RequestHeaderMap& headers, bool) -> Http::Status { EXPECT_EQ(headers.getHostValue(), host); EXPECT_EQ(headers.getPathValue(), path); EXPECT_EQ(headers.getSchemeValue(), Http::Headers::get().SchemeValues.Http); return Http::okStatus(); })); health_checker_->start(); EXPECT_CALL(runtime_.snapshot_, getInteger("health_check.max_interval", _)).WillOnce(Return(0)); EXPECT_CALL(runtime_.snapshot_, getInteger("health_check.min_interval", _)).WillOnce(Return(0)); EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(std::chrono::milliseconds(1), _)); EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer()); absl::optional<std::string> health_checked_cluster("locations-production-iad"); respond(0, "200", false, false, true, false, health_checked_cluster); EXPECT_EQ(Host::Health::Healthy, cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health()); }
0
[ "CWE-476" ]
envoy
9b1c3962172a972bc0359398af6daa3790bb59db
59,656,553,675,695,855,000,000,000,000,000,000,000
47
healthcheck: fix grpc inline removal crashes (#749) Signed-off-by: Matt Klein <[email protected]> Signed-off-by: Pradeep Rao <[email protected]>
bool Item::fix_fields(THD *thd, Item **ref) { // We do not check fields which are fixed during construction DBUG_ASSERT(fixed == 0 || basic_const_item()); fixed= 1; return FALSE; }
0
[]
server
b000e169562697aa072600695d4f0c0412f94f4f
233,902,767,212,099,200,000,000,000,000,000,000,000
8
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.
const CImg<T>& _save_pnk(std::FILE *const file, const char *const filename) const { if (!file && !filename) throw CImgArgumentException(_cimg_instance "save_pnk(): Specified filename is (null).", cimg_instance); if (is_empty()) { cimg::fempty(file,filename); return *this; } if (_spectrum>1) cimg::warn(_cimg_instance "save_pnk(): Instance is multispectral, only the first channel will be saved in file '%s'.", cimg_instance, filename?filename:"(FILE*)"); const ulongT buf_size = std::min((ulongT)1024*1024,(ulongT)_width*_height*_depth); std::FILE *const nfile = file?file:cimg::fopen(filename,"wb"); const T *ptr = data(0,0,0,0); if (!cimg::type<T>::is_float() && sizeof(T)==1 && _depth<2) // Can be saved as regular PNM file _save_pnm(file,filename,0); else if (!cimg::type<T>::is_float() && sizeof(T)==1) { // Save as extended P5 file: Binary byte-valued 3D std::fprintf(nfile,"P5\n%u %u %u\n255\n",_width,_height,_depth); CImg<ucharT> buf((unsigned int)buf_size); for (longT to_write = (longT)width()*height()*depth(); to_write>0; ) { const ulongT N = std::min((ulongT)to_write,buf_size); unsigned char *ptrd = buf._data; for (ulongT i = N; i>0; --i) *(ptrd++) = (unsigned char)*(ptr++); cimg::fwrite(buf._data,N,nfile); to_write-=N; } } else if (!cimg::type<T>::is_float()) { // Save as P8: Binary int32-valued 3D if (_depth>1) std::fprintf(nfile,"P8\n%u %u %u\n%d\n",_width,_height,_depth,(int)max()); else std::fprintf(nfile,"P8\n%u %u\n%d\n",_width,_height,(int)max()); CImg<intT> buf((unsigned int)buf_size); for (longT to_write = (longT)width()*height()*depth(); to_write>0; ) { const ulongT N = std::min((ulongT)to_write,buf_size); int *ptrd = buf._data; for (ulongT i = N; i>0; --i) *(ptrd++) = (int)*(ptr++); cimg::fwrite(buf._data,N,nfile); to_write-=N; } } else { // Save as P9: Binary float-valued 3D if (_depth>1) std::fprintf(nfile,"P9\n%u %u %u\n%g\n",_width,_height,_depth,(double)max()); else std::fprintf(nfile,"P9\n%u %u\n%g\n",_width,_height,(double)max()); CImg<floatT> buf((unsigned int)buf_size); for (longT to_write = (longT)width()*height()*depth(); to_write>0; ) { const ulongT N = std::min((ulongT)to_write,buf_size); float *ptrd = buf._data; for (ulongT i = N; i>0; --i) *(ptrd++) = (float)*(ptr++); cimg::fwrite(buf._data,N,nfile); to_write-=N; } } if (!file) cimg::fclose(nfile); return *this;
0
[ "CWE-119", "CWE-787" ]
CImg
ac8003393569aba51048c9d67e1491559877b1d1
257,371,453,395,314,200,000,000,000,000,000,000,000
55
.
ofputil_pull_ofp11_group_mod(struct ofpbuf *msg, enum ofp_version ofp_version, struct ofputil_group_mod *gm) { const struct ofp11_group_mod *ogm; enum ofperr error; ogm = ofpbuf_pull(msg, sizeof *ogm); gm->command = ntohs(ogm->command); gm->type = ogm->type; gm->group_id = ntohl(ogm->group_id); gm->command_bucket_id = OFPG15_BUCKET_ALL; error = ofputil_pull_ofp11_buckets(msg, msg->size, ofp_version, &gm->buckets); /* OF1.3.5+ prescribes an error when an OFPGC_DELETE includes buckets. */ if (!error && ofp_version >= OFP13_VERSION && gm->command == OFPGC11_DELETE && !ovs_list_is_empty(&gm->buckets)) { error = OFPERR_OFPGMFC_INVALID_GROUP; ofputil_bucket_list_destroy(&gm->buckets); } return error; }
0
[ "CWE-772" ]
ovs
77ad4225d125030420d897c873e4734ac708c66b
141,968,198,712,821,020,000,000,000,000,000,000,000
26
ofp-util: Fix memory leaks on error cases in ofputil_decode_group_mod(). Found by libFuzzer. Reported-by: Bhargava Shastry <[email protected]> Signed-off-by: Ben Pfaff <[email protected]> Acked-by: Justin Pettit <[email protected]>
static void *ddgencharlist(void *_fv,int32 *len) { int i,j,cnt, gid; FontView *fv = (FontView *) _fv; SplineFont *sf = fv->b.sf; EncMap *map = fv->b.map; char *data; for ( i=cnt=0; i<map->enccount; ++i ) if ( fv->b.selected[i] && (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL ) cnt += strlen(sf->glyphs[gid]->name)+1; data = malloc(cnt+1); data[0] = '\0'; for ( cnt=0, j=1 ; j<=fv->sel_index; ++j ) { for ( i=cnt=0; i<map->enccount; ++i ) if ( fv->b.selected[i] && (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL ) { strcpy(data+cnt,sf->glyphs[gid]->name); cnt += strlen(sf->glyphs[gid]->name); strcpy(data+cnt++," "); } } if ( cnt>0 ) data[--cnt] = '\0'; *len = cnt; return( data ); }
0
[ "CWE-119", "CWE-787" ]
fontforge
626f751752875a0ddd74b9e217b6f4828713573c
142,736,547,770,668,650,000,000,000,000,000,000,000
23
Warn users before discarding their unsaved scripts (#3852) * Warn users before discarding their unsaved scripts This closes #3846.
move_files_prepare (CopyMoveJob *job, const char *dest_fs_id, char **dest_fs_type, GList **fallbacks) { CommonJob *common; GList *l; GFile *src; gboolean same_fs; int i; GdkPoint *point; int total, left; common = &job->common; total = left = g_list_length (job->files); report_preparing_move_progress (job, total, left); i = 0; for (l = job->files; l != NULL && !job_aborted (common); l = l->next) { src = l->data; if (i < job->n_icon_positions) { point = &job->icon_positions[i]; } else { point = NULL; } same_fs = FALSE; if (dest_fs_id) { same_fs = has_fs_id (src, dest_fs_id); } move_file_prepare (job, src, job->destination, same_fs, dest_fs_type, job->debuting_files, point, fallbacks, left); report_preparing_move_progress (job, total, --left); i++; } *fallbacks = g_list_reverse (*fallbacks); }
0
[ "CWE-20" ]
nautilus
1630f53481f445ada0a455e9979236d31a8d3bb0
303,611,540,442,373,460,000,000,000,000,000,000,000
54
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
bool is_result_field() { return result_field != 0; }
0
[]
mysql-server
f7316aa0c9a3909fc7498e7b95d5d3af044a7e21
259,886,618,672,557,070,000,000,000,000,000,000,000
1
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.
MHD_create_post_processor (struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iter, void *iter_cls) { struct MHD_PostProcessor *ret; const char *encoding; const char *boundary; size_t blen; if ( (buffer_size < 256) || (NULL == connection) || (NULL == iter)) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); if (MHD_NO == MHD_lookup_connection_value_n (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE, MHD_STATICSTR_LEN_ ( MHD_HTTP_HEADER_CONTENT_TYPE), &encoding, NULL)) return NULL; boundary = NULL; if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, encoding, MHD_STATICSTR_LEN_ ( MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) { if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, encoding, MHD_STATICSTR_LEN_ ( MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) return NULL; boundary = &encoding[MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)]; /* Q: should this be "strcasestr"? */ boundary = strstr (boundary, "boundary="); if (NULL == boundary) return NULL; /* failed to determine boundary */ boundary += MHD_STATICSTR_LEN_ ("boundary="); blen = strlen (boundary); if ( (blen == 0) || (blen * 2 + 2 > buffer_size) ) return NULL; /* (will be) out of memory or invalid boundary */ if ( (boundary[0] == '"') && (boundary[blen - 1] == '"') ) { /* remove enclosing quotes */ ++boundary; blen -= 2; } } else blen = 0; buffer_size += 4; /* round up to get nice block sizes despite boundary search */ /* add +1 to ensure we ALWAYS have a zero-termination at the end */ if (NULL == (ret = MHD_calloc_ (1, sizeof (struct MHD_PostProcessor) + buffer_size + 1))) return NULL; ret->connection = connection; ret->ikvi = iter; ret->cls = iter_cls; ret->encoding = encoding; ret->buffer_size = buffer_size; ret->state = PP_Init; ret->blen = blen; ret->boundary = boundary; ret->skip_rn = RN_Inactive; return ret; }
0
[ "CWE-120" ]
libmicrohttpd
a110ae6276660bee3caab30e9ff3f12f85cf3241
94,606,575,714,493,860,000,000,000,000,000,000,000
74
fix buffer overflow and add test
xfs_merge_ioc_xflags( unsigned int flags, unsigned int start) { unsigned int xflags = start; if (flags & FS_IMMUTABLE_FL) xflags |= XFS_XFLAG_IMMUTABLE; else xflags &= ~XFS_XFLAG_IMMUTABLE; if (flags & FS_APPEND_FL) xflags |= XFS_XFLAG_APPEND; else xflags &= ~XFS_XFLAG_APPEND; if (flags & FS_SYNC_FL) xflags |= XFS_XFLAG_SYNC; else xflags &= ~XFS_XFLAG_SYNC; if (flags & FS_NOATIME_FL) xflags |= XFS_XFLAG_NOATIME; else xflags &= ~XFS_XFLAG_NOATIME; if (flags & FS_NODUMP_FL) xflags |= XFS_XFLAG_NODUMP; else xflags &= ~XFS_XFLAG_NODUMP; return xflags; }
0
[ "CWE-200" ]
linux-2.6
af24ee9ea8d532e16883251a6684dfa1be8eec29
160,441,832,999,232,290,000,000,000,000,000,000,000
29
xfs: zero proper structure size for geometry calls Commit 493f3358cb289ccf716c5a14fa5bb52ab75943e5 added this call to xfs_fs_geometry() in order to avoid passing kernel stack data back to user space: + memset(geo, 0, sizeof(*geo)); Unfortunately, one of the callers of that function passes the address of a smaller data type, cast to fit the type that xfs_fs_geometry() requires. As a result, this can happen: Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: f87aca93 Pid: 262, comm: xfs_fsr Not tainted 2.6.38-rc6-493f3358cb2+ #1 Call Trace: [<c12991ac>] ? panic+0x50/0x150 [<c102ed71>] ? __stack_chk_fail+0x10/0x18 [<f87aca93>] ? xfs_ioc_fsgeometry_v1+0x56/0x5d [xfs] Fix this by fixing that one caller to pass the right type and then copy out the subset it is interested in. Note: This patch is an alternative to one originally proposed by Eric Sandeen. Reported-by: Jeffrey Hundstad <[email protected]> Signed-off-by: Alex Elder <[email protected]> Reviewed-by: Eric Sandeen <[email protected]> Tested-by: Jeffrey Hundstad <[email protected]>
xmlParseElementStart(xmlParserCtxtPtr ctxt) { const xmlChar *name; const xmlChar *prefix = NULL; const xmlChar *URI = NULL; xmlParserNodeInfo node_info; int line, tlen = 0; xmlNodePtr ret; int nsNr = ctxt->nsNr; if (((unsigned int) ctxt->nameNr > xmlParserMaxDepth) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, "Excessive depth in document: %d use XML_PARSE_HUGE option\n", xmlParserMaxDepth); xmlHaltParser(ctxt); return(-1); } /* Capture start position */ if (ctxt->record_info) { node_info.begin_pos = ctxt->input->consumed + (CUR_PTR - ctxt->input->base); node_info.begin_line = ctxt->input->line; } if (ctxt->spaceNr == 0) spacePush(ctxt, -1); else if (*ctxt->space == -2) spacePush(ctxt, -1); else spacePush(ctxt, *ctxt->space); line = ctxt->input->line; #ifdef LIBXML_SAX1_ENABLED if (ctxt->sax2) #endif /* LIBXML_SAX1_ENABLED */ name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen); #ifdef LIBXML_SAX1_ENABLED else name = xmlParseStartTag(ctxt); #endif /* LIBXML_SAX1_ENABLED */ if (ctxt->instate == XML_PARSER_EOF) return(-1); if (name == NULL) { spacePop(ctxt); return(-1); } if (ctxt->sax2) nameNsPush(ctxt, name, prefix, URI, ctxt->nsNr - nsNr); #ifdef LIBXML_SAX1_ENABLED else namePush(ctxt, name); #endif /* LIBXML_SAX1_ENABLED */ ret = ctxt->node; #ifdef LIBXML_VALID_ENABLED /* * [ VC: Root Element Type ] * The Name in the document type declaration must match the element * type of the root element. */ if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc && ctxt->node && (ctxt->node == ctxt->myDoc->children)) ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); #endif /* LIBXML_VALID_ENABLED */ /* * Check for an Empty Element. */ if ((RAW == '/') && (NXT(1) == '>')) { SKIP(2); if (ctxt->sax2) { if ((ctxt->sax != NULL) && (ctxt->sax->endElementNs != NULL) && (!ctxt->disableSAX)) ctxt->sax->endElementNs(ctxt->userData, name, prefix, URI); #ifdef LIBXML_SAX1_ENABLED } else { if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL) && (!ctxt->disableSAX)) ctxt->sax->endElement(ctxt->userData, name); #endif /* LIBXML_SAX1_ENABLED */ } namePop(ctxt); spacePop(ctxt); if (nsNr != ctxt->nsNr) nsPop(ctxt, ctxt->nsNr - nsNr); if ( ret != NULL && ctxt->record_info ) { node_info.end_pos = ctxt->input->consumed + (CUR_PTR - ctxt->input->base); node_info.end_line = ctxt->input->line; node_info.node = ret; xmlParserAddNodeInfo(ctxt, &node_info); } return(1); } if (RAW == '>') { NEXT1; } else { xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_GT_REQUIRED, "Couldn't find end of Start Tag %s line %d\n", name, line, NULL); /* * end of parsing of this node. */ nodePop(ctxt); namePop(ctxt); spacePop(ctxt); if (nsNr != ctxt->nsNr) nsPop(ctxt, ctxt->nsNr - nsNr); /* * Capture end position and add node */ if ( ret != NULL && ctxt->record_info ) { node_info.end_pos = ctxt->input->consumed + (CUR_PTR - ctxt->input->base); node_info.end_line = ctxt->input->line; node_info.node = ret; xmlParserAddNodeInfo(ctxt, &node_info); } return(-1); } return(0); }
0
[]
libxml2
0e1a49c8907645d2e155f0d89d4d9895ac5112b5
77,283,806,347,955,370,000,000,000,000,000,000,000
126
Fix infinite loop in xmlStringLenDecodeEntities When ctxt->instate == XML_PARSER_EOF,xmlParseStringEntityRef return NULL which cause a infinite loop in xmlStringLenDecodeEntities Found with libFuzzer. Signed-off-by: Zhipeng Xie <[email protected]>
int nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl, struct posix_acl **pacl, struct posix_acl **dpacl, unsigned int flags) { struct posix_acl_state effective_acl_state, default_acl_state; struct nfs4_ace *ace; int ret; ret = init_state(&effective_acl_state, acl->naces); if (ret) return ret; ret = init_state(&default_acl_state, acl->naces); if (ret) goto out_estate; ret = -EINVAL; for (ace = acl->aces; ace < acl->aces + acl->naces; ace++) { if (ace->type != NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE && ace->type != NFS4_ACE_ACCESS_DENIED_ACE_TYPE) goto out_dstate; if (ace->flag & ~NFS4_SUPPORTED_FLAGS) goto out_dstate; if ((ace->flag & NFS4_INHERITANCE_FLAGS) == 0) { process_one_v4_ace(&effective_acl_state, ace); continue; } if (!(flags & NFS4_ACL_DIR)) goto out_dstate; /* * Note that when only one of FILE_INHERIT or DIRECTORY_INHERIT * is set, we're effectively turning on the other. That's OK, * according to rfc 3530. */ process_one_v4_ace(&default_acl_state, ace); if (!(ace->flag & NFS4_ACE_INHERIT_ONLY_ACE)) process_one_v4_ace(&effective_acl_state, ace); } *pacl = posix_state_to_acl(&effective_acl_state, flags); if (IS_ERR(*pacl)) { ret = PTR_ERR(*pacl); *pacl = NULL; goto out_dstate; } *dpacl = posix_state_to_acl(&default_acl_state, flags | NFS4_ACL_TYPE_DEFAULT); if (IS_ERR(*dpacl)) { ret = PTR_ERR(*dpacl); *dpacl = NULL; posix_acl_release(*pacl); *pacl = NULL; goto out_dstate; } sort_pacl(*pacl); sort_pacl(*dpacl); ret = 0; out_dstate: free_state(&default_acl_state); out_estate: free_state(&effective_acl_state); return ret; }
0
[ "CWE-119" ]
linux-2.6
91b80969ba466ba4b915a4a1d03add8c297add3f
232,241,552,094,274,920,000,000,000,000,000,000,000
60
nfsd: fix buffer overrun decoding NFSv4 acl The array we kmalloc() here is not large enough. Thanks to Johann Dahm and David Richter for bug report and testing. Signed-off-by: J. Bruce Fields <[email protected]> Cc: David Richter <[email protected]> Tested-by: Johann Dahm <[email protected]>
png_handle_pHYs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_byte buf[9]; png_uint_32 res_x, res_y; int unit_type; png_debug(1, "in png_handle_pHYs"); if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) png_chunk_error(png_ptr, "missing IHDR"); else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "out of place"); return; } else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "duplicate"); return; } if (length != 9) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "invalid"); return; } png_crc_read(png_ptr, buf, 9); if (png_crc_finish(png_ptr, 0) != 0) return; res_x = png_get_uint_32(buf); res_y = png_get_uint_32(buf + 4); unit_type = buf[8]; png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type); }
0
[ "CWE-120" ]
libpng
a901eb3ce6087e0afeef988247f1a1aa208cb54d
298,011,215,727,571,720,000,000,000,000,000,000,000
42
[libpng16] Prevent reading over-length PLTE chunk (Cosmin Truta).
SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp) { VFS_FIND(sys_acl_get_fd); return handle->fns->sys_acl_get_fd(handle, fsp); }
0
[ "CWE-22" ]
samba
bd269443e311d96ef495a9db47d1b95eb83bb8f4
232,936,942,958,833,160,000,000,000,000,000,000,000
6
Fix bug 7104 - "wide links" and "unix extensions" are incompatible. Change parameter "wide links" to default to "no". Ensure "wide links = no" if "unix extensions = yes" on a share. Fix man pages to refect this. Remove "within share" checks for a UNIX symlink set - even if widelinks = no. The server will not follow that link anyway. Correct DEBUG message in check_reduced_name() to add missing "\n" so it's really clear when a path is being denied as it's outside the enclosing share path. Jeremy.
void Compute(OpKernelContext* context) override { core::RefCountPtr<BoostedTreesEnsembleResource> tree_ensemble_resource; OP_REQUIRES_OK(context, LookupResource(context, HandleFromInput(context, 0), &tree_ensemble_resource)); tf_shared_lock l(*tree_ensemble_resource->get_mutex()); Tensor* output_stamp_token_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape(), &output_stamp_token_t)); output_stamp_token_t->scalar<int64>()() = tree_ensemble_resource->stamp(); Tensor* output_proto_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(1, TensorShape(), &output_proto_t)); output_proto_t->scalar<tstring>()() = tree_ensemble_resource->SerializeAsString(); }
0
[ "CWE-416" ]
tensorflow
5ecec9c6fbdbc6be03295685190a45e7eee726ab
4,619,534,207,414,563,400,000,000,000,000,000,000
15
Prevent use after free. A very old version of the code used `result` as a simple pointer to a resource. Two years later, the pointer got changed to a `unique_ptr` but author forgot to remove the call to `Unref`. Three years after that, we finally uncover the UAF. PiperOrigin-RevId: 387924872 Change-Id: I70fb6f199164de49fac20c168132a07b84903f9b
static void snoop_urb_data(struct urb *urb, unsigned len) { int i, size; len = min(len, usbfs_snoop_max); if (!usbfs_snoop || len == 0) return; if (urb->num_sgs == 0) { print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1, urb->transfer_buffer, len, 1); return; } for (i = 0; i < urb->num_sgs && len; i++) { size = (len > USB_SG_SIZE) ? USB_SG_SIZE : len; print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1, sg_virt(&urb->sg[i]), size, 1); len -= size; } }
0
[ "CWE-200" ]
linux
681fef8380eb818c0b845fca5d2ab1dcbab114ee
268,553,818,540,846,440,000,000,000,000,000,000,000
21
USB: usbfs: fix potential infoleak in devio The stack object “ci” has a total size of 8 bytes. Its last 3 bytes are padding bytes which are not initialized and leaked to userland via “copy_to_user”. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>