anchor_id stringlengths 13 16 | anchor stringlengths 63 78.9k | anchor_diff stringlengths 125 3.42k | positive_id stringlengths 13 16 | positive stringlengths 57 78.9k | positive_diff stringlengths 136 3.42k | negative_id stringlengths 13 16 | negative stringlengths 57 129k | negative_diff stringlengths 136 3.42k | hard_negative stringlengths 103 79k |
|---|---|---|---|---|---|---|---|---|---|
CVE-2024-0321 | char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32)... | --- vulnerable
+++ patched
@@ -71,6 +71,10 @@
GF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, ("[TXTIn] Line too long to convert to utf8 (len: %d)\n", len));
j = GF_ARRAY_LENGTH(szLineConv) -1 ;
}
+ if ( j >= lineSize ) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, ("[TXTIn] UT8 converted line too long for buffer (len: %d,... | CVE-2024-10964 | void handle_add_plugin(nng_aio *aio)
{
neu_plugin_t *plugin = neu_rest_get_plugin();
NEU_PROCESS_HTTP_REQUEST_VALIDATE_JWT(
aio, neu_json_add_plugin_req_t, neu_json_decode_add_plugin_req, {
int ret = 0;
neu_reqresp_head_t header = { 0 };
neu_req... | --- vulnerable
+++ patched
@@ -11,7 +11,7 @@
header.ctx = aio;
header.type = NEU_REQ_ADD_PLUGIN;
header.otel_trace_type = NEU_OTEL_TRACE_TYPE_REST_COMM;
- strcpy(cmd.library, req->library);
+ strncpy(cmd.library, req->library, NEU_PLUGI... | CVE-2025-48964 | int gather_statistics(struct ping_rts *rts, uint8_t *icmph, int icmplen,
int cc, uint16_t seq, int hops,
int csfailed, struct timeval *tv, char *from,
void (*pr_reply)(uint8_t *icmph, int cc), int multicast,
int wrong_source)
{
int dupflag = 0;
long triptime = 0;
uint8_t *ptr = icmph ... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
if (triptime > rts->tmax)
rts->tmax = triptime;
if (!rts->rtt)
- rts->rtt = triptime * 8;
+ rts->rtt = ((uint64_t)triptime) * 8;
else
rts->rtt += triptime - rts->rtt / 8;
if (rts->opt_adaptive) | char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32)... |
CVE-2017-12988 | static int
telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
{
int i, x;
u_int c;
const u_char *osp, *p;
#define FETCH(c, sp, length) \
do { \
if (length < 1) \
goto pktend; \
ND_TCHECK(*sp); \
c = *sp++; \
length--; \
} while (0)
osp = sp;
FETCH(c, sp, length);
if (c... | --- vulnerable
+++ patched
@@ -54,6 +54,7 @@
break;
p++;
}
+ ND_TCHECK(*p);
if (*p != IAC)
goto pktend;
| CVE-2017-12992 | void
ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
{
register const struct rip6 *rp = (const struct rip6 *)dat;
register const struct netinfo6 *ni;
register u_int amt;
register u_int i;
int j;
int trunc;
if (ndo->ndo_snapend < dat)
return;
amt = ndo->ndo_snapend - dat;
i = min... | --- vulnerable
+++ patched
@@ -3,65 +3,74 @@
{
register const struct rip6 *rp = (const struct rip6 *)dat;
register const struct netinfo6 *ni;
- register u_int amt;
- register u_int i;
- int j;
- int trunc;
+ unsigned int length_left;
+ u_int j;
- if (ndo->ndo_snapend < dat)
- return;
- amt = ndo->ndo_snapend - ... | CVE-2022-2522 | static char_u *
ins_compl_infercase_gettext(
char_u *str,
int char_len,
int compl_char_len,
int min_len,
char_u **tofree)
{
int *wca; // Wide character array.
char_u *p;
int i, c;
int has_lower = FALSE;
int was_letter = FALSE;
garray_T gap;
IObuff[0] = NUL;
// Allocate wide... | --- vulnerable
+++ patched
@@ -114,6 +114,7 @@
// growarray. Add the character in the next round.
if (ga_grow(&gap, IOSIZE) == FAIL)
return (char_u *)"[failed]";
+ *p = NUL;
STRCPY(gap.ga_data, IObuff);
gap.ga_len = (int)STRLEN(IObuff);
} | static int
telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
{
int i, x;
u_int c;
const u_char *osp, *p;
#define FETCH(c, sp, length) \
do { \
if (length < 1) \
goto pktend; \
ND_TCHECK(*sp); \
c = *sp++; \
length--; \
} while (0)
osp = sp;
FETCH(c, sp, length);
if (c... |
CVE-2017-14039 | static OPJ_BOOL opj_j2k_write_sod(opj_j2k_t *p_j2k,
opj_tcd_t * p_tile_coder,
OPJ_BYTE * p_data,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_total_data_size,
... | --- vulnerable
+++ patched
@@ -16,6 +16,12 @@
assert(p_stream != 00);
OPJ_UNUSED(p_stream);
+
+ if (p_total_data_size < 4) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Not enough bytes in output buffer to write SOD marker\n");
+ return OPJ_FALSE;
+ }
opj_write_b... | CVE-2017-14164 | static OPJ_BOOL opj_j2k_write_sot(opj_j2k_t *p_j2k,
OPJ_BYTE * p_data,
OPJ_UINT32 * p_data_written,
const opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager
... | --- vulnerable
+++ patched
@@ -1,5 +1,6 @@
static OPJ_BOOL opj_j2k_write_sot(opj_j2k_t *p_j2k,
OPJ_BYTE * p_data,
+ OPJ_UINT32 p_total_data_size,
OPJ_UINT32 * p_data_written,
const ... | CVE-2022-28044 | bool initialise_control(rzip_control *control)
{
time_t now_t, tdiff;
char localeptr[] = "./", *eptr; /* for environment */
size_t len;
memset(control, 0, sizeof(rzip_control));
control->msgout = stderr;
control->msgerr = stderr;
register_outputfile(control, control->msgout);
control->flags = FLAG_SHOW_PROGRES... | --- vulnerable
+++ patched
@@ -9,7 +9,7 @@
control->msgerr = stderr;
register_outputfile(control, control->msgout);
control->flags = FLAG_SHOW_PROGRESS | FLAG_KEEP_FILES | FLAG_THRESHOLD;
- control->suffix = ".lrz";
+ control->suffix = strdup(".lrz");
control->compression_level = 7;
control->ramsize = get_ram... | static OPJ_BOOL opj_j2k_write_sod(opj_j2k_t *p_j2k,
opj_tcd_t * p_tile_coder,
OPJ_BYTE * p_data,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_total_data_size,
... |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-28069 | static int vax_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
op->size = 1;
if (len < 1) {
return -1;
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
switch (buf[0]) {
case 0x04:
op->type = R_ANAL_OP_TYPE_RET;
break;
case 0x2e:
op->type = R_ANAL_OP_TYPE_MOV;
op-... | --- vulnerable
+++ patched
@@ -137,7 +137,7 @@
case 0xfb: // calls
op->type = R_ANAL_OP_TYPE_CALL;
op->size = 7;
- {
+ if (len > 6) {
int oa = 3;
ut32 delta = buf[oa];
delta |= (ut32)(buf[oa + 1]) << 8; | CVE-2017-8069 | static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
{
return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
indx, 0, data, size, 500);
} | --- vulnerable
+++ patched
@@ -1,6 +1,17 @@
static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
{
- return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
- RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
- indx, 0, data, size, 500);
+ void *buf;
+ int ret;
+
+ buf = kmalloc... | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2010-5332 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
{
struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
int i, err = 0;
int free = -1;
mutex_lock(&table->mutex);
for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
if (free < 0 && (table->refs[i] == 0)) {
fr... | --- vulnerable
+++ patched
@@ -19,6 +19,11 @@
++table->refs[i];
goto out;
}
+ }
+
+ if (free < 0) {
+ err = -ENOMEM;
+ goto out;
}
if (table->total == table->max) { | CVE-2016-7799 | MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entr... | --- vulnerable
+++ patched
@@ -122,7 +122,7 @@
break; /* corrupt EXIF */
tag_value=(ssize_t) ReadProfileShort(endian,q);
format=(ssize_t) ReadProfileShort(endian,q+2);
- if ((format-1) >= EXIF_NUM_FORMATS)
+ if ((format < 0) || ((format-1) >= EXIF_NUM_FORMATS))
break;
c... | CVE-2016-10071 | static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image *image, *image2=NULL,
*rotated_image;
register Quantum *q;
unsigned int status;
MATHeader MATLAB_HDR;
size_t size;
size_t CellType;
QuantumInfo *quantum_info;
ImageInfo *clone_info;
int i;
ssize_t ldblk;
... | --- vulnerable
+++ patched
@@ -267,7 +267,7 @@
return(DestroyImageList(image));
/* ----- Load raster data ----- */
- BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(unsigned char)); /* Ldblk was set in the check phase */
+ BImgBuff = (unsigned char *) AcquireQuantumMemory(... | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
{
struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
int i, err = 0;
int free = -1;
mutex_lock(&table->mutex);
for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
if (free < 0 && (table->refs[i] == 0)) {
fr... |
CVE-2023-0433 | static int
same_leader(
linenr_T lnum,
int leader1_len,
char_u *leader1_flags,
int leader2_len,
char_u *leader2_flags)
{
int idx1 = 0, idx2 = 0;
char_u *p;
char_u *line1;
char_u *line2;
if (leader1_len == 0)
return (leader2_len == 0);
// If first leader ha... | --- vulnerable
+++ patched
@@ -14,6 +14,9 @@
if (leader1_len == 0)
return (leader2_len == 0);
+ char_u *lnum_line = NULL;
+ int line_len = 0;
+
// If first leader has 'f' flag, the lines can be joined only if the
// second line does not have a leader.
// If first leader has 'e' flag, ... | CVE-2024-42484 | void espnow_recv_cb(const uint8_t *addr, const uint8_t *data, int size)
#endif
{
espnow_data_t *espnow_data = (espnow_data_t *)data;
wifi_pkt_rx_ctrl_t *rx_ctrl = NULL;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 1)
uint8_t * addr = recv_info->src_addr;
rx_ctrl = recv_info->rx_ctrl;
#else
wifi... | --- vulnerable
+++ patched
@@ -126,12 +126,17 @@
ESP_LOGD(TAG, ">1.2< group_id: " MACSTR ", dest_addr: " MACSTR,
MAC2STR(group_info->group_id), MAC2STR(espnow_data->dest_addr));
- ESP_LOGD(TAG, ">1.2< addr_mun: %d, dest_addr: " MACSTR, group_info->addrs_num,
+ ESP_LOGD(TAG, ">... | CVE-2016-9793 | int sock_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
int val;
int valbool;
struct linger ling;
int ret = 0;
/*
* Options without arguments
*/
if (optname == SO_BINDTODEVICE)
return sock_setbindtodevice(sk, optval, o... | --- vulnerable
+++ patched
@@ -58,7 +58,7 @@
val = min_t(u32, val, sysctl_wmem_max);
set_sndbuf:
sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
- sk->sk_sndbuf = max_t(u32, val * 2, SOCK_MIN_SNDBUF);
+ sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
/* Wake up sending tasks if we upped the value. */
sk->sk_... | static int
same_leader(
linenr_T lnum,
int leader1_len,
char_u *leader1_flags,
int leader2_len,
char_u *leader2_flags)
{
int idx1 = 0, idx2 = 0;
char_u *p;
char_u *line1;
char_u *line2;
if (leader1_len == 0)
return (leader2_len == 0);
char_u *lnum_line = ... |
CVE-2013-1929 | static void tg3_read_vpd(struct tg3 *tp)
{
u8 *vpd_data;
unsigned int block_end, rosize, len;
u32 vpdlen;
int j, i = 0;
vpd_data = (u8 *)tg3_vpd_readblock(tp, &vpdlen);
if (!vpd_data)
goto out_no_vpd;
i = pci_vpd_find_tag(vpd_data, 0, vpdlen, PCI_VPD_LRDT_RO_DATA);
if (i < 0)
goto out_not_found;
rosize ... | --- vulnerable
+++ patched
@@ -41,8 +41,11 @@
if (j + len > block_end)
goto partno;
- memcpy(tp->fw_ver, &vpd_data[j], len);
- strncat(tp->fw_ver, " bc ", vpdlen - len - 1);
+ if (len >= sizeof(tp->fw_ver))
+ len = sizeof(tp->fw_ver) - 1;
+ memset(tp->fw_ver, 0, sizeof(tp->fw_ver));
+ snprintf(tp->fw_ve... | CVE-2024-47248 | static void gen_prov_cont(struct prov_rx *rx, struct os_mbuf *buf)
{
uint8_t seg = CONT_SEG_INDEX(rx->gpc);
BT_DBG("len %u, seg_index %u", buf->om_len, seg);
if (!link.rx.seg && link.rx.id == rx->xact_id) {
if (!ack_pending()) {
BT_DBG("Resending ack");
gen_prov_ack_send(rx->xact_id);
}
return;
}
i... | --- vulnerable
+++ patched
@@ -41,6 +41,11 @@
return;
}
+ if (XACT_SEG_OFFSET(seg) + buf->om_len > RX_BUFFER_MAX) {
+ BT_WARN("Rx buffer overflow. Malformed generic prov frame?");
+ return;
+ }
+
memcpy(XACT_SEG_DATA(seg), buf->om_data, buf->om_len);
XACT_SEG_RECV(seg);
| CVE-2022-2454 | static Fixed lsr_translate_coords(GF_LASeRCodec *lsr, u32 val, u32 nb_bits)
{
#ifdef GPAC_FIXED_POINT
if (val >> (nb_bits-1) ) {
s32 neg = (s32) val - (1<<nb_bits);
if (neg < -FIX_ONE / 2)
return 2 * gf_divfix(INT2FIX(neg/2), lsr->res_factor);
return gf_divfix(INT2FIX(neg), lsr->res_factor);
} else {
if (v... | --- vulnerable
+++ patched
@@ -1,5 +1,7 @@
static Fixed lsr_translate_coords(GF_LASeRCodec *lsr, u32 val, u32 nb_bits)
{
+ if (!nb_bits) return 0;
+
#ifdef GPAC_FIXED_POINT
if (val >> (nb_bits-1) ) {
s32 neg = (s32) val - (1<<nb_bits); | static void tg3_read_vpd(struct tg3 *tp)
{
u8 *vpd_data;
unsigned int block_end, rosize, len;
u32 vpdlen;
int j, i = 0;
vpd_data = (u8 *)tg3_vpd_readblock(tp, &vpdlen);
if (!vpd_data)
goto out_no_vpd;
i = pci_vpd_find_tag(vpd_data, 0, vpdlen, PCI_VPD_LRDT_RO_DATA);
if (i < 0)
goto out_not_found;
rosize ... |
CVE-2023-23456 | void PackTmt::pack(OutputFile *fo) {
big_relocs = 0;
Packer::handleStub(fi, fo, adam_offset);
const unsigned usize = ih.imagesize;
const unsigned rsize = ih.relocsize;
ibuf.alloc(usize + rsize + 128);
obuf.allocForCompression(usize + rsize + 128);
MemBuffer mb_wrkmem;
mb_wrkmem.alloc... | --- vulnerable
+++ patched
@@ -10,7 +10,7 @@
obuf.allocForCompression(usize + rsize + 128);
MemBuffer mb_wrkmem;
- mb_wrkmem.alloc(rsize + EXTRA_INFO); // relocations
+ mb_wrkmem.alloc(rsize + EXTRA_INFO + 4); // relocations + original entry point + relocsize
SPAN_S_VAR(upx_byte, wrkmem, mb_wrkme... | CVE-2023-33975 | static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
size_t offset, unsigned page)
{
union {
gnrc_sixlowpan_frag_rb_base_t *super;
gnrc_sixlowpan_frag_rb_t *rbuf;
gnrc_sixlowpan_frag_vrb_t *vrb;
} entry;
const uint8_t *src = gnrc_netif_hdr_get_s... | --- vulnerable
+++ patched
@@ -168,6 +168,19 @@
else if (IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) &&
sixlowpan_sfr_rfrag_is(pkt->data)) {
entry.super->datagram_size--;
+ /* Check, if fragment is still small enough to fit datagram size.
+ ... | CVE-2013-6763 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
unsigned int len;
unsigned long start=0, off;
struct au1200fb_device *fbdev = info->par;
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
return -EINVAL;
}
start = fbdev->fb_phys & PAGE_MASK;
len = PAGE_ALIGN((start & ~PAGE_MASK) + f... | --- vulnerable
+++ patched
@@ -1,30 +1,9 @@
static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
-
{
- unsigned int len;
- unsigned long start=0, off;
struct au1200fb_device *fbdev = info->par;
-
- if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
- return -EINVAL;
- }
-
- start = fbdev->fb_phys... | void PackTmt::pack(OutputFile *fo) {
big_relocs = 0;
Packer::handleStub(fi, fo, adam_offset);
const unsigned usize = ih.imagesize;
const unsigned rsize = ih.relocsize;
ibuf.alloc(usize + rsize + 128);
obuf.allocForCompression(usize + rsize + 128);
MemBuffer mb_wrkmem;
mb_wrkmem.alloc... |
CVE-2023-46928 | GF_EXPORT
GF_Err gf_media_change_pl(GF_ISOFile *file, u32 track, u32 profile, u32 compat, u32 level)
{
u32 i, count, stype;
GF_Err e;
GF_AVCConfig *avcc;
stype = gf_isom_get_media_subtype(file, track, 1);
switch (stype) {
case GF_ISOM_SUBTYPE_AVC_H264:
case GF_ISOM_SUBTYPE_AVC2_H264:
case GF_ISOM_SUBTYPE_AVC3_... | --- vulnerable
+++ patched
@@ -17,6 +17,10 @@
}
avcc = gf_isom_avc_config_get(file, track, 1);
+
+ if (!avcc)
+ return GF_NON_COMPLIANT_BITSTREAM;
+
if (level) avcc->AVCLevelIndication = level;
if (compat) avcc->profile_compatibility = compat;
if (profile) avcc->AVCProfileIndication = profile; | CVE-2023-46930 | GF_EXPORT
u32 gf_isom_find_od_id_for_track(GF_ISOFile *file, u32 track)
{
u32 i, j, di, the_od_id;
GF_TrackBox *od_tk;
GF_TrackBox *tk = gf_isom_get_track_from_file(file, track);
if (!tk) return 0;
i=0;
while ( (od_tk = (GF_TrackBox*)gf_list_enum(file->moov->trackList, &i))) {
if (od_tk->Media->handler->handle... | --- vulnerable
+++ patched
@@ -8,6 +8,13 @@
i=0;
while ( (od_tk = (GF_TrackBox*)gf_list_enum(file->moov->trackList, &i))) {
+ if (!od_tk || !od_tk->Media || !od_tk->Media->handler || !od_tk->Media->information ||
+ !od_tk->Media->information->sampleTable || !od_tk->Media->information->sampleTable->SampleSize ... | CVE-2017-10671 | static void
de_dotdot( char* file )
{
char* cp;
char* cp2;
int l;
/* Collapse any multiple / sequences. */
while ( ( cp = strstr( file, "//") ) != (char*) 0 )
{
for ( cp2 = cp + 2; *cp2 == '/'; ++cp2 )
continue;
(void) strcpy( cp + 1, cp2 );
}
/* Remove leading ./ and any /./ sequ... | --- vulnerable
+++ patched
@@ -17,7 +17,7 @@
while ( strncmp( file, "./", 2 ) == 0 )
(void) memmove( file, file + 2, strlen( file ) - 1 );
while ( ( cp = strstr( file, "/./") ) != (char*) 0 )
- (void) memmove( cp, cp + 2, strlen( file ) - 1 );
+ (void) memmove( cp, cp + 2, strlen( cp ) - 1 );
/* Alte... | GF_EXPORT
GF_Err gf_media_change_pl(GF_ISOFile *file, u32 track, u32 profile, u32 compat, u32 level)
{
u32 i, count, stype;
GF_Err e;
GF_AVCConfig *avcc;
stype = gf_isom_get_media_subtype(file, track, 1);
switch (stype) {
case GF_ISOM_SUBTYPE_AVC_H264:
case GF_ISOM_SUBTYPE_AVC2_H264:
case GF_ISOM_SUBTYPE_AVC3_... |
CVE-2016-7151 | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
unsigned int mid = ARR_... | --- vulnerable
+++ patched
@@ -3,9 +3,10 @@
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
+ static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
- ... | CVE-2022-0631 | mrb_value
mrb_f_send(mrb_state *mrb, mrb_value self)
{
mrb_sym name;
mrb_value block, *regs;
mrb_method_t m;
struct RClass *c;
mrb_callinfo *ci = mrb->c->ci;
int n = ci->n;
if (ci->cci > CINFO_NONE) {
funcall:;
const mrb_value *argv;
mrb_int argc;
mrb_get_args(mrb, "n*&", &name, &argv, &arg... | --- vulnerable
+++ patched
@@ -19,9 +19,11 @@
regs = mrb->c->ci->stack+1;
if (n == 0) {
+ argnum_error:
mrb_argnum_error(mrb, 0, 1, -1);
}
else if (n == 15) {
+ if (RARRAY_LEN(regs[0]) == 0) goto argnum_error;
name = mrb_obj_to_sym(mrb, RARRAY_PTR(regs[0])[0]);
}
else { | CVE-2022-48468 | static protobuf_c_boolean
parse_required_member(ScannedMember *scanned_member,
void *member,
ProtobufCAllocator *allocator,
protobuf_c_boolean maybe_clear)
{
unsigned len = scanned_member->len;
const uint8_t *data = scanned_member->data;
uint8_t wire_type = scanned_member->wire_type;
switch... | --- vulnerable
+++ patched
@@ -109,10 +109,13 @@
return FALSE;
def_mess = scanned_member->field->default_value;
- subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
- allocator,
- len - pref_len,
- data + pref_len);
+ if (len >= pref_len)
+ subm = protobuf_c_message_unpac... | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_r... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2017-7407 | void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
{
FILE *stream = stdout;
const char *ptr = writeinfo;
char *stringp = NULL;
long longinfo;
double doubleinfo;
while(ptr && *ptr) {
if('%' == *ptr) {
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%',... | --- vulnerable
+++ patched
@@ -7,7 +7,7 @@
double doubleinfo;
while(ptr && *ptr) {
- if('%' == *ptr) {
+ if('%' == *ptr && ptr[1]) {
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%', stream); | CVE-2007-6761 | static int __videobuf_mmap_mapper(struct videobuf_queue *q,
struct vm_area_struct *vma)
{
struct videbuf_vmalloc_memory *mem;
struct videobuf_mapping *map;
unsigned int first;
int retval;
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
if (! (vma->vm_flags & VM_WRITE) || ! (vma->vm_flags & VM_SHARED))
... | --- vulnerable
+++ patched
@@ -27,7 +27,7 @@
}
/* create mapping + update buffer list */
- map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
+ map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
if (NULL == map)
return -ENOMEM;
| void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2013-2021 | static void check_user_password(struct pdf_struct *pdf, int R, const char *O,
const char *U, int32_t P, int EM,
unsigned length, unsigned oulen)
{
unsigned i;
uint8_t result[16];
char data[32];
cli_md5_ctx md5;
struct arc4_state arc4;
unsigned password_empty = 0;
dbg_printhex("U: ",... | --- vulnerable
+++ patched
@@ -24,7 +24,7 @@
password_empty = 1;
/* Algorithm 3.2a could be used to recover encryption key */
}
- } else {
+ } else if ((R >= 2) && (R <= 4)) {
/* 7.6.3.3 Algorithm 2 */
cli_md5_init(&md5);
/* empty password, password == padding */
@@ -38,9 +38,9 @@
cli_md... | CVE-2022-1886 | void
do_put(
int regname,
char_u *expr_result, // result for regname "=" when compiled
int dir, // BACKWARD for 'P', FORWARD for 'p'
long count,
int flags)
{
char_u *ptr;
char_u *newp, *oldp;
int yanklen;
int totlen = 0; // init for gcc
linenr_T lnum;
colnr_T col;
... | --- vulnerable
+++ patched
@@ -696,9 +696,12 @@
len = STRLEN(y_array[y_size - 1]);
col = (colnr_T)len - lendiff;
if (col > 1)
- curbuf->b_op_end.col = col - 1
- - mb_head_off(y_array[y_size - 1],
+ {
+ curbuf->b_op_end.col = col - 1;
+ if (len > 0)
+ curbuf->b_op_end.col -= mb_head_off(... | CVE-2022-0351 | /*
* Handle sixth level expression:
* number number constant
* 0zFFFFFFFF Blob constant
* "string" string constant
* 'string' literal string constant
* &option-name option value
* @r register contents
* identifier variable value
* function() function call
* $VAR environment variable
* (exp... | --- vulnerable
+++ patched
@@ -43,6 +43,7 @@
char_u *start_leader, *end_leader;
int ret = OK;
char_u *alias;
+ static int recurse = 0;
/*
* Initialise variable so that clear_tv() can't mistake this for a
@@ -68,6 +69,15 @@
++*arg;
return FAIL;
}
+
+ // Limit recursion to 1000... | static void check_user_password(struct pdf_struct *pdf, int R, const char *O,
const char *U, int32_t P, int EM,
unsigned length, unsigned oulen)
{
unsigned i;
uint8_t result[16];
char data[32];
cli_md5_ctx md5;
struct arc4_state arc4;
unsigned password_empty = 0;
dbg_printhex("U: ",... |
CVE-2016-7418 | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... | --- vulnerable
+++ patched
@@ -37,10 +37,10 @@
int i;
if (atts) for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && atts[i][0]) {
+ if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {
char tmp_buf[2];
- snprintf(tmp_buf, sizeof(tmp_buf), "%c", (char)strt... | CVE-2023-46724 | int
matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
{
int dl;
int hl;
const bool hostIncludesSubdomains = (*h == '.');
while ('.' == *h)
++h;
hl = strlen(h);
if (hl == 0)
return -1;
dl = strlen(d);
/*
* Start at the ends of the two stri... | --- vulnerable
+++ patched
@@ -14,6 +14,8 @@
return -1;
dl = strlen(d);
+ if (dl == 0)
+ return 1;
/*
* Start at the ends of the two strings and work towards the | CVE-2022-2522 | static char_u *
ins_compl_infercase_gettext(
char_u *str,
int char_len,
int compl_char_len,
int min_len,
char_u **tofree)
{
int *wca; // Wide character array.
char_u *p;
int i, c;
int has_lower = FALSE;
int was_letter = FALSE;
garray_T gap;
IObuff[0] = NUL;
// Allocate wide... | --- vulnerable
+++ patched
@@ -114,6 +114,7 @@
// growarray. Add the character in the next round.
if (ga_grow(&gap, IOSIZE) == FAIL)
return (char_u *)"[failed]";
+ *p = NUL;
STRCPY(gap.ga_data, IObuff);
gap.ga_len = (int)STRLEN(IObuff);
} | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... |
CVE-2022-2566 | static int build_open_gop_key_points(AVStream *st)
{
int k;
int sample_id = 0;
uint32_t cra_index;
MOVStreamContext *sc = st->priv_data;
if (st->codecpar->codec_id != AV_CODEC_ID_HEVC || !sc->sync_group_count)
return 0;
/* Build an unrolled index of the samples */
sc->sample_offset... | --- vulnerable
+++ patched
@@ -10,8 +10,11 @@
/* Build an unrolled index of the samples */
sc->sample_offsets_count = 0;
- for (uint32_t i = 0; i < sc->ctts_count; i++)
+ for (uint32_t i = 0; i < sc->ctts_count; i++) {
+ if (sc->ctts_data[i].count > INT_MAX - sc->sample_offsets_count)
+ ... | CVE-2022-36042 | static RzDyldRebaseInfos *get_rebase_infos(RzDyldCache *cache) {
RzDyldRebaseInfos *result = RZ_NEW0(RzDyldRebaseInfos);
if (!result) {
return NULL;
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
ut32 total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
for (i = 0; i < cach... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
- ut32 total_slide_infos = 0;
+ size_t total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
@@ -14,7 +14,12 @@
if (!rz_buf_read_le32_at(cache->buf, 0x13c + hdr_offset, &n_slide_inf... | CVE-2017-6347 | static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,
int tlen, int offset)
{
__wsum csum = skb->csum;
if (skb->ip_summed != CHECKSUM_COMPLETE)
return;
if (offset != 0)
csum = csum_sub(csum,
csum_partial(skb_transport_header(skb) + tlen,
offset, 0));
put_cmsg(msg, SOL... | --- vulnerable
+++ patched
@@ -6,10 +6,10 @@
if (skb->ip_summed != CHECKSUM_COMPLETE)
return;
- if (offset != 0)
- csum = csum_sub(csum,
- csum_partial(skb_transport_header(skb) + tlen,
- offset, 0));
+ if (offset != 0) {
+ int tend_off = skb_transport_offset(skb) + tlen;
+ csum = csum_sub(csum, s... | static int build_open_gop_key_points(AVStream *st)
{
int k;
int sample_id = 0;
uint32_t cra_index;
MOVStreamContext *sc = st->priv_data;
if (st->codecpar->codec_id != AV_CODEC_ID_HEVC || !sc->sync_group_count)
return 0;
/* Build an unrolled index of the samples */
sc->sample_offset... |
CVE-2016-5114 | int fpm_log_write(char *log_format) /* {{{ */
{
char *s, *b;
char buffer[FPM_LOG_BUFFER+1];
int token, test;
size_t len, len2;
struct fpm_scoreboard_proc_s proc, *proc_p;
struct fpm_scoreboard_s *scoreboard;
char tmp[129];
char format[129];
time_t now_epoch;
#ifdef HAVE_TIMES
clock_t tms_total;
#endif
if (!... | --- vulnerable
+++ patched
@@ -349,6 +349,11 @@
b += len2;
len += len2;
}
+ if (len >= FPM_LOG_BUFFER) {
+ zlog(ZLOG_NOTICE, "the log buffer is full (%d). The access log request has been truncated.", FPM_LOG_BUFFER);
+ len = FPM_LOG_BUFFER;
+ break;
+ }
continue;
}
| CVE-2022-23462 | void iwjson_ftoa(long double val, char buf[static IWNUMBUF_SIZE], size_t *out_len) {
// TODO: review
int len = snprintf(buf, 64, "%.8Lf", val);
if (len <= 0) {
buf[0] = '\0';
*out_len = 0;
return;
}
while (len > 0 && buf[len - 1] == '0') { // trim zeroes from right
buf[len - 1] = '\0';
len... | --- vulnerable
+++ patched
@@ -1,6 +1,6 @@
void iwjson_ftoa(long double val, char buf[static IWNUMBUF_SIZE], size_t *out_len) {
// TODO: review
- int len = snprintf(buf, 64, "%.8Lf", val);
+ int len = snprintf(buf, IWNUMBUF_SIZE, "%.8Lf", val);
if (len <= 0) {
buf[0] = '\0';
*out_len = 0; | CVE-2017-16357 | static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {
ut8 *end, *need = NULL;
const char *section_name = "";
Elf_(Shdr) *link_shdr = NULL;
const char *link_section_name = "";
Sdb *sdb_vernaux = NULL;
Sdb *sdb_version = NULL;
Sdb *sdb = NULL;
int i, cnt;
if (!bin || !bin->dynstr) {... | --- vulnerable
+++ patched
@@ -14,7 +14,7 @@
if (shdr->sh_link > bin->ehdr.e_shnum) {
return NULL;
}
- if (shdr->sh_size < 1) {
+ if (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) {
return NULL;
}
sdb = sdb_new0 (); | int fpm_log_write(char *log_format) /* {{{ */
{
char *s, *b;
char buffer[FPM_LOG_BUFFER+1];
int token, test;
size_t len, len2;
struct fpm_scoreboard_proc_s proc, *proc_p;
struct fpm_scoreboard_s *scoreboard;
char tmp[129];
char format[129];
time_t now_epoch;
#ifdef HAVE_TIMES
clock_t tms_total;
#endif
if (!... |
CVE-2013-4244 | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
*(*fill)++ = suffix[code];
firstchar = oldcode =... | --- vulnerable
+++ patched
@@ -13,6 +13,10 @@
}
if (oldcode == -1) {
+ if (code >= clear) {
+ fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
+ return 0;
+ }
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1; | CVE-2022-2816 | /*
* Check if "name" can be "unlet".
*/
int
check_vim9_unlet(char_u *name)
{
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
// "unlet s:var" is allowed in legacy script.
if (*name == 's' && !script_is_vim9())
return OK;
semsg(_(e_cannot_unlet_str), name);
return FAIL;
}
... | --- vulnerable
+++ patched
@@ -4,6 +4,12 @@
int
check_vim9_unlet(char_u *name)
{
+ if (*name == NUL)
+ {
+ semsg(_(e_argument_required_for_str), "unlet");
+ return FAIL;
+ }
+
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
// "unlet s:var" is allowed in legacy script. | CVE-2022-3028 | static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs)
{
struct pfkey_sock *pfk = pfkey_sk(sk);
struct sk_buff *supp_skb;
if (hdr->sadb_msg_satype > SADB_SATYPE_MAX)
return -EINVAL;
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) {
if (pfk->register... | --- vulnerable
+++ patched
@@ -12,9 +12,12 @@
pfk->registered |= (1<<hdr->sadb_msg_satype);
}
+ mutex_lock(&pfkey_mutex);
xfrm_probe_algs();
supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
+ mutex_unlock(&pfkey_mutex);
+
if (!supp_skb) {
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)... | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
if (code >= clear) {
fprintf(s... |
CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2022-1908 | size_t mobi_get_attribute_value(char *value, const unsigned char *data, const size_t size, const char *attribute, bool only_quoted) {
/* FIXME: this function could be replaced by mobi_find_attrvalue()? */
if (!data) {
debug_print("Data is null%s", "\n");
return SIZE_MAX;
}
size_t length ... | --- vulnerable
+++ patched
@@ -60,7 +60,7 @@
length--;
}
/* self closing tag '/>' */
- if (*(data - 1) == '/' && *data == '>') {
+ if (length && *(data - 1) == '/' && *data == '>') {
value--;
}
*value = '\0'; | CVE-2017-15932 | static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {
const char *section_name = "";
const char *link_section_name = "";
char *end = NULL;
Elf_(Shdr) *link_shdr = NULL;
ut8 dfs[sizeof (Elf_(Verdef))] = {0};
Sdb *sdb;
int cnt, i;
if (shdr->sh_link > bin->ehdr.e_shnum) {
return false... | --- vulnerable
+++ patched
@@ -53,7 +53,12 @@
verdef->vd_hash = READ32 (dfs, j)
verdef->vd_aux = READ32 (dfs, j)
verdef->vd_next = READ32 (dfs, j)
- vstart += verdef->vd_aux;
+ int vdaux = verdef->vd_aux;
+ if (vdaux < 1) {
+ sdb_free (sdb_verdef);
+ goto out_error;
+ }
+ vstart += vdaux;
if (vstar... | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... |
CVE-2011-1477 | static void opl3_setup_voice(int dev, int voice, int chn)
{
struct channel_info *info =
&synth_devs[dev]->chn_info[chn];
opl3_set_instr(dev, voice, info->pgm_num);
devc->voc[voice].bender = 0;
devc->voc[voice].bender_range = info->bender_range;
devc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME];
devc... | --- vulnerable
+++ patched
@@ -1,7 +1,14 @@
static void opl3_setup_voice(int dev, int voice, int chn)
{
- struct channel_info *info =
- &synth_devs[dev]->chn_info[chn];
+ struct channel_info *info;
+
+ if (voice < 0 || voice >= devc->nr_voice)
+ return;
+
+ if (chn < 0 || chn > 15)
+ return;
+
+ info = &synth_devs[... | CVE-2017-13024 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -53,6 +53,8 @@
ND_PRINT((ndo, "(ni: trunc)"));
goto trunc;
}
+ ND_TCHECK_16BITS(&bp[i+2]);
+ ND_TCHECK_16BITS(&bp[i+4]);
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
EXTRACT_16BITS(&bp[i+2]),
EXTRACT_16BITS(&bp[i+4]))); | CVE-2022-1276 | static void
gen_assignment(codegen_scope *s, node *tree, node *rhs, int sp, int val)
{
int idx;
int type = nint(tree->car);
switch (type) {
case NODE_GVAR:
case NODE_ARG:
case NODE_LVAR:
case NODE_IVAR:
case NODE_CVAR:
case NODE_CONST:
case NODE_NIL:
case NODE_MASGN:
if (rhs) {
codegen(... | --- vulnerable
+++ patched
@@ -111,7 +111,7 @@
}
}
if (tree->cdr->car) { /* keyword arguments */
- if (n == 14) {
+ if (n == 13 || n == 14) {
pop_n(n);
genop_2(s, OP_ARRAY, cursp(), n);
push(); | static void opl3_setup_voice(int dev, int voice, int chn)
{
struct channel_info *info;
if (voice < 0 || voice >= devc->nr_voice)
return;
if (chn < 0 || chn > 15)
return;
info = &synth_devs[dev]->chn_info[chn];
opl3_set_instr(dev, voice, info->pgm_num);
devc->voc[voice].bender = 0;
devc->voc[voice].bende... |
CVE-2022-2061 | lzw_result lzw_decode(struct lzw_ctx *ctx,
const uint8_t ** const stack_pos_out)
{
lzw_result res;
uint32_t code_new;
uint32_t code_out;
uint8_t last_value;
uint8_t *stack_pos = ctx->stack_base;
uint32_t clear_code = ctx->clear_code;
uint32_t current_entry = ctx->current_entry;
struct lzw_dictionary_entry * c... | --- vulnerable
+++ patched
@@ -27,6 +27,10 @@
} else if (code_new > current_entry) {
/* Code is invalid */
+ return LZW_BAD_CODE;
+
+ } else if (code_new >= 1 << LZW_CODE_MAX) {
+ /* Don't access out of bound */
return LZW_BAD_CODE;
} else if (code_new < current_entry) { | CVE-2022-39274 | static void ProcessRadioRxDone( void )
{
LoRaMacHeader_t macHdr;
ApplyCFListParams_t applyCFList;
GetPhyParams_t getPhy;
PhyParam_t phyParam;
LoRaMacCryptoStatus_t macCryptoStatus = LORAMAC_CRYPTO_ERROR;
LoRaMacMessageData_t macMsgData;
LoRaMacMessageJoinAccept_t macMsgJoinAccept;
... | --- vulnerable
+++ patched
@@ -73,6 +73,14 @@
}
}
+ // Abort on empty radio frames
+ if( size == 0 )
+ {
+ MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_ERROR;
+ PrepareRxDoneAbort( );
+ return;
+ }
+
macHdr.Value = payload[pktHeaderLen++];
// Acce... | CVE-2022-33099 | l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
luaC_checkGC(L); /* error message uses memory */
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
if (isLua(ci)) /* if Lua function, add sour... | --- vulnerable
+++ patched
@@ -6,7 +6,10 @@
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
- if (isLua(ci)) /* if Lua function, add source:line information */
+ if (isLua(ci)) { /* if Lua function, add source:line information */
luaG_addinfo(L, msg, ci_... | lzw_result lzw_decode(struct lzw_ctx *ctx,
const uint8_t ** const stack_pos_out)
{
lzw_result res;
uint32_t code_new;
uint32_t code_out;
uint8_t last_value;
uint8_t *stack_pos = ctx->stack_base;
uint32_t clear_code = ctx->clear_code;
uint32_t current_entry = ctx->current_entry;
struct lzw_dictionary_entry * c... |
CVE-2016-10197 | static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
struct search_domain *dom;
for (dom = state->head; dom; dom = dom->next) {
if (!n--) {
... | --- vulnerable
+++ patched
@@ -1,8 +1,11 @@
static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
- const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+ char need_to_append_dot;
struct search_doma... | CVE-2022-1908 | size_t mobi_get_attribute_value(char *value, const unsigned char *data, const size_t size, const char *attribute, bool only_quoted) {
/* FIXME: this function could be replaced by mobi_find_attrvalue()? */
if (!data) {
debug_print("Data is null%s", "\n");
return SIZE_MAX;
}
size_t length ... | --- vulnerable
+++ patched
@@ -60,7 +60,7 @@
length--;
}
/* self closing tag '/>' */
- if (*(data - 1) == '/' && *data == '>') {
+ if (length && *(data - 1) == '/' && *data == '>') {
value--;
}
*value = '\0'; | CVE-2023-4734 | /*
* "fullcommand" function
*/
void
f_fullcommand(typval_T *argvars, typval_T *rettv)
{
exarg_T ea;
char_u *name;
char_u *p;
int vim9script = in_vim9script();
int save_cmod_flags = cmdmod.cmod_flags;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
if (in_vim9script()
... | --- vulnerable
+++ patched
@@ -18,7 +18,7 @@
|| check_for_opt_bool_arg(argvars, 1) == FAIL))
return;
- name = argvars[0].vval.v_string;
+ name = tv_get_string(&argvars[0]);
if (name == NULL)
return;
| static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
char need_to_append_dot;
struct search_domain *dom;
if (!base_len) return NULL;
need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
for (dom = state->he... |
CVE-2022-0522 | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... | --- vulnerable
+++ patched
@@ -23,7 +23,6 @@
shift -= 64;
regc = "h";
}
-
if (shift > 0 && shift < 64) {
r_strbuf_appendf (sb, "%d,SWAP,0x%"PFMT64x",&,<<,%s%s,0x%"PFMT64x",&,|,%s%s",
shift, mask, REG64 (n), regc, VEC64_MASK (shift, size), REG64 (n), regc); | CVE-2022-1714 | static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int ret;
struct msp430_cmd cmd;
memset (&cmd, 0, sizeof (cmd));
//op->id = ???;
op->size = -1;
op->nopcode = 1;
op->type = R_ANAL_OP_TYPE_UNK;
op->family = R_ANAL_OP_FAMILY_CPU;
ret = op->size = msp430_deco... | --- vulnerable
+++ patched
@@ -1,15 +1,11 @@
static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
- int ret;
- struct msp430_cmd cmd;
-
- memset (&cmd, 0, sizeof (cmd));
- //op->id = ???;
+ struct msp430_cmd cmd = {0};
op->size = -1;
op->nopcode = 1;
op->type = R... | CVE-2022-23575 | int64_t OpLevelCostEstimator::CalculateTensorSize(
const OpInfo::TensorProperties& tensor, bool* found_unknown_shapes) {
int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes);
int size = DataTypeSize(BaseType(tensor.dtype()));
VLOG(2) << "Count: " << count << " DataTypeSize: " << size;
r... | --- vulnerable
+++ patched
@@ -3,5 +3,11 @@
int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes);
int size = DataTypeSize(BaseType(tensor.dtype()));
VLOG(2) << "Count: " << count << " DataTypeSize: " << size;
- return count * size;
+ int64_t tensor_size = MultiplyWithoutOverflow(count, s... | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... |
CVE-2017-6802 | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
ALLOCCHECK_CHAR(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);
out = comp_Prebuf.size;
- while (out < (comp_Prebuf.size + uncompressedSize)) {
+ while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {
// each flag byte fl... | CVE-2023-4756 | void gf_bt_check_line(GF_BTParser *parser)
{
while (1) {
switch (parser->line_buffer[parser->line_pos]) {
case ' ':
case '\t':
case '\n':
case '\r':
parser->line_pos++;
continue;
default:
break;
}
break;
}
if (parser->line_buffer[parser->line_pos]=='#') {
parser->line_size = parser->line_... | --- vulnerable
+++ patched
@@ -1,6 +1,7 @@
void gf_bt_check_line(GF_BTParser *parser)
{
- while (1) {
+reload_line:
+ while (parser->line_pos < parser->line_size) {
switch (parser->line_buffer[parser->line_pos]) {
case ' ':
case '\t':
@@ -8,16 +9,22 @@
case '\r':
parser->line_pos++;
continue;
+ c... | CVE-2022-23587 | Status OpLevelCostEstimator::PredictCropAndResize(const OpContext& op_context,
NodeCosts* node_costs) const {
bool found_unknown_shapes = false;
const auto method = op_context.op_info.attr().find("method");
bool use_bilinear_interp;
if (method == op_context.op_... | --- vulnerable
+++ patched
@@ -40,27 +40,42 @@
// calculation differs from rough estimate in implementation, as it separates
// out cost per box from cost per pixel and cost per element.
+ // Since crop arguments are user controlled, check for overflow.
+ int64_t crop_area = MultiplyWithoutOverflow(crop_heigh... | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... |
CVE-2017-13024 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -53,6 +53,8 @@
ND_PRINT((ndo, "(ni: trunc)"));
goto trunc;
}
+ ND_TCHECK_16BITS(&bp[i+2]);
+ ND_TCHECK_16BITS(&bp[i+4]);
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
EXTRACT_16BITS(&bp[i+2]),
EXTRACT_16BITS(&bp[i+4]))); | CVE-2022-1207 | static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int opsize = -1;
op->type = -1;
opsize = 2;
switch (buf[0]) {
case 0x3f:
case 0x4f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 4;
break;
case 0x6f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 6;
break;
case 0x7... | --- vulnerable
+++ patched
@@ -2,6 +2,9 @@
int opsize = -1;
op->type = -1;
opsize = 2;
+ if (len < 1) {
+ return -1;
+ }
switch (buf[0]) {
case 0x3f:
case 0x4f:
@@ -16,9 +19,9 @@
op->type = R_ANAL_OP_TYPE_LEA;
if (len > 5) {
op->ptr = buf[2];
- op->ptr |= buf[3]<<8;
- op->ptr |= buf[4]<<16;
-... | CVE-2017-8067 | static int put_chars(u32 vtermno, const char *buf, int count)
{
struct port *port;
struct scatterlist sg[1];
if (unlikely(early_put_chars))
return early_put_chars(vtermno, buf, count);
port = find_port_by_vtermno(vtermno);
if (!port)
return -EPIPE;
sg_init_one(sg, buf, count);
return __send_to_port(port, ... | --- vulnerable
+++ patched
@@ -2,6 +2,8 @@
{
struct port *port;
struct scatterlist sg[1];
+ void *data;
+ int ret;
if (unlikely(early_put_chars))
return early_put_chars(vtermno, buf, count);
@@ -10,6 +12,12 @@
if (!port)
return -EPIPE;
- sg_init_one(sg, buf, count);
- return __send_to_port(port, sg, ... | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... |
CVE-2017-13015 | void
eap_print(netdissect_options *ndo,
register const u_char *cp,
u_int length)
{
const struct eap_frame_t *eap;
const u_char *tptr;
u_int tlen, type, subtype;
int count=0, len;
tptr = cp;
tlen = length;
eap = (const struct eap_frame_t *)cp;
ND_TCHECK(*eap);
/*... | --- vulnerable
+++ patched
@@ -34,7 +34,9 @@
switch (eap->type) {
case EAP_FRAME_TYPE_PACKET:
+ ND_TCHECK_8BITS(tptr);
type = *(tptr);
+ ND_TCHECK_16BITS(tptr+2);
len = EXTRACT_16BITS(tptr+2);
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
tok2str(eap_cod... | CVE-2017-13021 | void
icmp6_print(netdissect_options *ndo,
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
const struct ip6_hdr *oip;
const struct udphdr *ouh;
int dport;
const u_char *ep;
u_int prot;
dp = (const struct icmp6_hdr *)bp;
ip =... | --- vulnerable
+++ patched
@@ -263,6 +263,7 @@
if (ndo->ndo_vflag) {
ND_TCHECK(dp->icmp6_data16[0]);
ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_TCHECK(dp->icmp6_data16[1]);
if (dp->icmp6_data16[1] & 0xc0)
ND_PRINT((ndo," "));
if (dp->icmp6_data16[1] & 0x80) | CVE-2017-6350 | static u_entry_T *
unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name)
{
int i;
u_entry_T *uep;
char_u **array;
char_u *line;
int line_len;
uep = (u_entry_T *)U_ALLOC_LINE(sizeof(u_entry_T));
if (uep == NULL)
return NULL;
vim_memset(uep, 0, sizeof(u_entry_T));
#ifdef U_... | --- vulnerable
+++ patched
@@ -3,7 +3,7 @@
{
int i;
u_entry_T *uep;
- char_u **array;
+ char_u **array = NULL;
char_u *line;
int line_len;
@@ -20,7 +20,8 @@
uep->ue_size = undo_read_4c(bi);
if (uep->ue_size > 0)
{
- array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue... | void
eap_print(netdissect_options *ndo,
register const u_char *cp,
u_int length)
{
const struct eap_frame_t *eap;
const u_char *tptr;
u_int tlen, type, subtype;
int count=0, len;
tptr = cp;
tlen = length;
eap = (const struct eap_frame_t *)cp;
ND_TCHECK(*eap);
/*... |
CVE-2017-6802 | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
ALLOCCHECK_CHAR(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);
out = comp_Prebuf.size;
- while (out < (comp_Prebuf.size + uncompressedSize)) {
+ while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {
// each flag byte fl... | CVE-2022-31001 | sip_method_t sip_method_d(char **ss, char const **return_name)
{
char *s = *ss, c = *s;
char const *name;
int code = sip_method_unknown;
size_t n = 0;
#define MATCH(s, m) (strncmp(s, m, n = sizeof(m) - 1) == 0)
switch (c) {
case 'A': if (MATCH(s, "ACK")) code = sip_method_ack; break;
case 'B': if (MATCH... | --- vulnerable
+++ patched
@@ -45,6 +45,10 @@
#undef MATCH
+ if (strlen(s) < n) {
+ return sip_method_invalid;
+ }
+
if (IS_NON_WS(s[n]))
/* Unknown method */
code = sip_method_unknown; | CVE-2016-10093 | DECLAREreadFunc(readContigTilesIntoBuffer)
{
int status = 1;
tsize_t tilesize = TIFFTileSize(in);
tdata_t tilebuf;
uint32 imagew = TIFFScanlineSize(in);
uint32 tilew = TIFFTileRowSize(in);
int iskew = imagew - tilew;
uint8* bufp = (uint8*) buf;
uint32 tw, tl;
uint32 row;
(void) spp;
tilebuf = _TIFFmalloc(t... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
tdata_t tilebuf;
uint32 imagew = TIFFScanlineSize(in);
uint32 tilew = TIFFTileRowSize(in);
- int iskew = imagew - tilew;
+ int64 iskew = (int64)imagew - (int64)tilew;
uint8* bufp = (uint8*) buf;
uint32 tw, tl;
uint32 row;
@@ -33,7 +33,7 @@
status = 0;
go... | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... |
CVE-2017-13021 | void
icmp6_print(netdissect_options *ndo,
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
const struct ip6_hdr *oip;
const struct udphdr *ouh;
int dport;
const u_char *ep;
u_int prot;
dp = (const struct icmp6_hdr *)bp;
ip =... | --- vulnerable
+++ patched
@@ -263,6 +263,7 @@
if (ndo->ndo_vflag) {
ND_TCHECK(dp->icmp6_data16[0]);
ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_TCHECK(dp->icmp6_data16[1]);
if (dp->icmp6_data16[1] & 0xc0)
ND_PRINT((ndo," "));
if (dp->icmp6_data16[1] & 0x80) | CVE-2023-4756 | void gf_bt_check_line(GF_BTParser *parser)
{
while (1) {
switch (parser->line_buffer[parser->line_pos]) {
case ' ':
case '\t':
case '\n':
case '\r':
parser->line_pos++;
continue;
default:
break;
}
break;
}
if (parser->line_buffer[parser->line_pos]=='#') {
parser->line_size = parser->line_... | --- vulnerable
+++ patched
@@ -1,6 +1,7 @@
void gf_bt_check_line(GF_BTParser *parser)
{
- while (1) {
+reload_line:
+ while (parser->line_pos < parser->line_size) {
switch (parser->line_buffer[parser->line_pos]) {
case ' ':
case '\t':
@@ -8,16 +9,22 @@
case '\r':
parser->line_pos++;
continue;
+ c... | CVE-2017-7882 | void HWPFile::TagsRead()
{
while (true)
{
uint tag;
if (!Read4b(tag))
return;
int size;
if (!Read4b(size))
return;
if (size <= 0 && tag > 0){
continue;
}
if (tag == FILETAG_END_OF_COMPRESSED ||
tag == FILE... | --- vulnerable
+++ patched
@@ -77,6 +77,8 @@
return;
}
+ _hwpInfo.back_info.data.clear();
+
//read potentially compressed data in blocks as its more
//likely large values are simply broken and we'll run out
... | void
icmp6_print(netdissect_options *ndo,
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
const struct ip6_hdr *oip;
const struct udphdr *ouh;
int dport;
const u_char *ep;
u_int prot;
dp = (const struct icmp6_hdr *)bp;
ip =... |
CVE-2016-10169 | static int read_new_config_info (WavpackContext *wpc, WavpackMetadata *wpmd)
{
int bytecnt = wpmd->byte_length;
unsigned char *byteptr = wpmd->data;
wpc->version_five = 1; // just having this block signals version 5.0
wpc->file_format = wpc->config.qmode = wpc->channel_layout = 0;
if (wpc->c... | --- vulnerable
+++ patched
@@ -14,7 +14,7 @@
// if there's any data, the first two bytes are file_format and qmode flags
- if (bytecnt) {
+ if (bytecnt >= 2) {
wpc->file_format = *byteptr++;
wpc->config.qmode = (wpc->config.qmode & ~0xff) | *byteptr++;
bytecnt -= 2;
@@ -47,6 +4... | CVE-2017-13725 | int
rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 _U_)
{
register const struct ip6_rthdr *dp;
register const struct ip6_rthdr0 *dp0;
register const u_char *ep;
int i, len;
register const struct in6_addr *addr;
dp = (const struct ip6_rthdr *)bp;
len = dp->ip6r_len;
/* 'ep' poi... | --- vulnerable
+++ patched
@@ -8,13 +8,13 @@
register const struct in6_addr *addr;
dp = (const struct ip6_rthdr *)bp;
- len = dp->ip6r_len;
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
ND_TCHECK(dp->ip6r_segleft);
+ len = dp->ip6r_len;
ND_PRINT((ndo, "srcrt (len=%d", dp->ip... | CVE-2013-6763 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
unsigned int len;
unsigned long start=0, off;
struct au1200fb_device *fbdev = info->par;
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
return -EINVAL;
}
start = fbdev->fb_phys & PAGE_MASK;
len = PAGE_ALIGN((start & ~PAGE_MASK) + f... | --- vulnerable
+++ patched
@@ -1,30 +1,9 @@
static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
-
{
- unsigned int len;
- unsigned long start=0, off;
struct au1200fb_device *fbdev = info->par;
-
- if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
- return -EINVAL;
- }
-
- start = fbdev->fb_phys... | static int read_new_config_info (WavpackContext *wpc, WavpackMetadata *wpmd)
{
int bytecnt = wpmd->byte_length;
unsigned char *byteptr = wpmd->data;
wpc->version_five = 1; // just having this block signals version 5.0
wpc->file_format = wpc->config.qmode = wpc->channel_layout = 0;
if (wpc->c... |
CVE-2017-14608 | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... | --- vulnerable
+++ patched
@@ -13,8 +13,15 @@
len = MIN (256, width-col);
ret = kodak_65000_decode (buf, len);
for (i=0; i < len; i++)
- if ((RAW(row,col+i) = curve[ret ? buf[i] :
- (pred[i & 1] += buf[i])]) >> 12) derror();
+ {
+ int idx = ret ? buf[i] : (pred[i & 1] += buf[i]);
+ if(idx >=0... | CVE-2017-6802 | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
ALLOCCHECK_CHAR(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);
out = comp_Prebuf.size;
- while (out < (comp_Prebuf.size + uncompressedSize)) {
+ while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {
// each flag byte fl... | CVE-2017-0028 | /***************************************************************************
Parse an expression term.
***************************************************************************/
template<bool buildAST>
ParseNodePtr Parser::ParseTerm(BOOL fAllowCall,
LPCOLESTR pNameHint,
uint32 *pHintLength,
uint32 *pShort... | --- vulnerable
+++ patched
@@ -14,6 +14,7 @@
_Inout_opt_ charcount_t *plastRParen /*= nullptr*/)
{
ParseNodePtr pnode = nullptr;
+ PidRefStack *savedTopAsyncRef = nullptr;
charcount_t ichMin = 0;
size_t iecpMin = 0;
size_t iuMin;
@@ -66,6 +67,13 @@
isLambdaExpr = true;
... | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... |
CVE-2017-13017 | static void
dhcp6opt_print(netdissect_options *ndo,
const u_char *cp, const u_char *ep)
{
const struct dhcp6opt *dh6o;
const u_char *tp;
size_t i;
uint16_t opttype;
size_t optlen;
uint8_t auth_proto;
u_int authinfolen, authrealmlen;
int remain_len; /* Length of remaining options */
int label_le... | --- vulnerable
+++ patched
@@ -240,6 +240,10 @@
ND_PRINT((ndo, "...)"));
break;
case DH6OPT_RECONF_MSG:
+ if (optlen != 1) {
+ ND_PRINT((ndo, " ?)"));
+ break;
+ }
tp = (const u_char *)(dh6o + 1);
switch (*tp) {
case DH6_RENEW: | CVE-2017-16534 | int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
struct usb_interface *intf,
u8 *buffer,
int buflen)
{
/* duplicates are ignored */
struct usb_cdc_union_desc *union_header = NULL;
/* duplicates are not tolerated */
struct usb_cdc_header_desc *header = NULL;
struct usb_cdc_ether_desc *ether ... | --- vulnerable
+++ patched
@@ -23,6 +23,10 @@
dev_err(&intf->dev, "skipping garbage byte\n");
elength = 1;
goto next_desc;
+ }
+ if ((buflen < elength) || (elength < 3)) {
+ dev_err(&intf->dev, "invalid descriptor buffer length\n");
+ break;
}
if (buffer[1] != USB_DT_CS_INTERFACE) {
dev_err(... | CVE-2025-29769 | static int
vips_foreign_save_heif_build(VipsObject *object)
{
VipsForeignSave *save = (VipsForeignSave *) object;
VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) object;
struct heif_error error;
struct heif_writer writer;
char *chroma;
const struct heif_encoder_descriptor *out_encoder;
const struct heif_enc... | --- vulnerable
+++ patched
@@ -173,6 +173,15 @@
if (heif->page_width > 16384 || heif->page_height > 16384) {
vips_error("heifsave", _("image too large"));
+ return -1;
+ }
+
+ /* Reject multiband images.
+ */
+ if (save->ready->Type == VIPS_INTERPRETATION_MULTIBAND) {
+ vips_error("heifsave", _("Unsupported i... | static void
dhcp6opt_print(netdissect_options *ndo,
const u_char *cp, const u_char *ep)
{
const struct dhcp6opt *dh6o;
const u_char *tp;
size_t i;
uint16_t opttype;
size_t optlen;
uint8_t auth_proto;
u_int authinfolen, authrealmlen;
int remain_len; /* Length of remaining options */
int label_le... |
CVE-2017-14608 | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... | --- vulnerable
+++ patched
@@ -13,8 +13,15 @@
len = MIN (256, width-col);
ret = kodak_65000_decode (buf, len);
for (i=0; i < len; i++)
- if ((RAW(row,col+i) = curve[ret ? buf[i] :
- (pred[i & 1] += buf[i])]) >> 12) derror();
+ {
+ int idx = ret ? buf[i] : (pred[i & 1] += buf[i]);
+ if(idx >=0... | CVE-2022-1629 | /*
* Search quote char from string line[col].
* Quote character escaped by one of the characters in "escape" is not counted
* as a quote.
* Returns column number of "quotechar" or -1 when not found.
*/
static int
find_next_quote(
char_u *line,
int col,
int quotechar,
char_u *escape) // escape... | --- vulnerable
+++ patched
@@ -19,7 +19,11 @@
if (c == NUL)
return -1;
else if (escape != NULL && vim_strchr(escape, c))
+ {
++col;
+ if (line[col] == NUL)
+ return -1;
+ }
else if (c == quotechar)
break;
if (has_mbyte) | CVE-2017-14151 | static OPJ_BOOL opj_tcd_code_block_enc_allocate_data(opj_tcd_cblk_enc_t *
p_code_block)
{
OPJ_UINT32 l_data_size;
/* The +1 is needed for https://github.com/uclouvain/openjpeg/issues/835 */
l_data_size = 1 + (OPJ_UINT32)((p_code_block->x1 - p_code_block->x0) *
(p_... | --- vulnerable
+++ patched
@@ -3,8 +3,11 @@
{
OPJ_UINT32 l_data_size;
- /* The +1 is needed for https://github.com/uclouvain/openjpeg/issues/835 */
- l_data_size = 1 + (OPJ_UINT32)((p_code_block->x1 - p_code_block->x0) *
+ /* +1 is needed for https://github.com/uclouvain/openjpeg/issues/835 */
+ /* ... | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... |
CVE-2023-0051 | static void
msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u *buf = NULL;
char_u *p = s;
#ifdef MSWIN
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); // handle CR and NL correctly
#endif
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
if (!(sil... | --- vulnerable
+++ patched
@@ -60,7 +60,8 @@
{
char_u *tofree = NULL;
- if (maxlen > 0 && STRLEN(p) > (size_t)maxlen)
+ if (maxlen > 0 && vim_strlen_maxlen((char *)p, (size_t)maxlen)
+ >= (size_t)maxlen)
{
tofree = vim_strnsave(p, (size_t)maxlen);
p = tofree; | CVE-2023-49285 | static int
make_month(const char *s)
{
int i;
char month[3];
month[0] = xtoupper(*s);
month[1] = xtolower(*(s + 1));
month[2] = xtolower(*(s + 2));
for (i = 0; i < 12; i++)
if (!strncmp(month_names[i], month, 3))
return i;
return -1;
} | --- vulnerable
+++ patched
@@ -5,7 +5,13 @@
char month[3];
month[0] = xtoupper(*s);
+ if (!month[0])
+ return -1; // protects *(s + 1) below
+
month[1] = xtolower(*(s + 1));
+ if (!month[1])
+ return -1; // protects *(s + 2) below
+
month[2] = xtolower(*(s + 2));
for (i ... | CVE-2023-24817 | int gnrc_rpl_srh_process(ipv6_hdr_t *ipv6, gnrc_rpl_srh_t *rh, void **err_ptr)
{
ipv6_addr_t addr;
uint8_t *addr_vec = (uint8_t *) (rh + 1), *current_address;
uint8_t num_addr;
uint8_t current_pos, pref_elided, addr_len, compri_addr_len;
const uint8_t new_seg_left = rh->seg_left - 1;
assert(rh-... | --- vulnerable
+++ patched
@@ -5,6 +5,13 @@
uint8_t num_addr;
uint8_t current_pos, pref_elided, addr_len, compri_addr_len;
const uint8_t new_seg_left = rh->seg_left - 1;
+
+ if ((rh->len * 8) < (GNRC_RPL_SRH_PADDING(rh->pad_resv) +
+ (16 - GNRC_RPL_SRH_COMPRE(rh->compr)))) {
+ ... | static void
msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u *buf = NULL;
char_u *p = s;
#ifdef MSWIN
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); // handle CR and NL correctly
#endif
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
if (!(sil... |
CVE-2017-13023 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -37,6 +37,7 @@
goto trunc;
}
/* units of 4 secs */
+ ND_TCHECK_16BITS(&bp[i+2]);
ND_PRINT((ndo, "(refresh: %u)",
EXTRACT_16BITS(&bp[i+2]) << 2));
break; | CVE-2022-0522 | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... | --- vulnerable
+++ patched
@@ -23,7 +23,6 @@
shift -= 64;
regc = "h";
}
-
if (shift > 0 && shift < 64) {
r_strbuf_appendf (sb, "%d,SWAP,0x%"PFMT64x",&,<<,%s%s,0x%"PFMT64x",&,|,%s%s",
shift, mask, REG64 (n), regc, VEC64_MASK (shift, size), REG64 (n), regc); | CVE-2022-35289 | void IdentifierHashTable::growAndRehash(uint32_t newCapacity) {
assert(llvh::isPowerOf2_32(newCapacity) && "capacity must be power of 2");
CompactTable tmpTable(newCapacity, table_.getCurrentScale());
tmpTable.swap(table_);
for (uint32_t oldIdx = 0; oldIdx < tmpTable.size(); ++oldIdx) {
if (!tmpTable.isVali... | --- vulnerable
+++ patched
@@ -1,4 +1,8 @@
void IdentifierHashTable::growAndRehash(uint32_t newCapacity) {
+ // Guard against potential overflow in the calculation of new capacity.
+ if (LLVM_UNLIKELY(newCapacity <= capacity())) {
+ hermes_fatal("too many identifiers created");
+ }
assert(llvh::isPowerOf2_32(... | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... |
CVE-2017-8073 | char *
irc_ctcp_dcc_filename_without_quotes (const char *filename)
{
int length;
length = strlen (filename);
if (length > 0)
{
if ((filename[0] == '\"') && (filename[length - 1] == '\"'))
return weechat_strndup (filename + 1, length - 2);
}
return strdup (filename);
} | --- vulnerable
+++ patched
@@ -4,7 +4,7 @@
int length;
length = strlen (filename);
- if (length > 0)
+ if (length > 1)
{
if ((filename[0] == '\"') && (filename[length - 1] == '\"'))
return weechat_strndup (filename + 1, length - 2); | CVE-2022-1296 | RList *r_bin_ne_get_relocs(r_bin_ne_obj_t *bin) {
RList *segments = bin->segments;
if (!segments) {
return NULL;
}
RList *entries = bin->entries;
if (!entries) {
return NULL;
}
RList *symbols = bin->symbols;
if (!symbols) {
return NULL;
}
ut16 *modref = calloc (bin->ne_header->ModRefs, sizeof (ut16));
... | --- vulnerable
+++ patched
@@ -75,25 +75,18 @@
free (reloc);
break;
}
- char *name;
-#if NE_BUG
- if (rel.index > 0 && rel.index < bin->ne_header->ModRefs) {
- offset = modref[rel.index - 1] + bin->header_offset + bin->ne_header->ImportNameTable;
- name = __read_nonnull_str_at (bin->buf, ... | CVE-2023-36272 | /** converts UTF-8 to UCS-2. Returns a copy.
TODO: unquote json_cquote as above.
*/
ATTRIBUTE_MALLOC
BITCODE_TU
bit_utf8_to_TU (char *restrict str, const unsigned cquoted)
{
BITCODE_TU wstr;
size_t i = 0;
size_t len = strlen (str);
unsigned char c;
if (len > 0xFFFE)
{
loglevel = 1;
LOG_W... | --- vulnerable
+++ patched
@@ -50,9 +50,11 @@
{
/* ignore invalid utf8 for now */
if (len >= 1)
- wstr[i++] = ((c & 0x1f) << 6) | (str[1] & 0x3f);
- len--;
- str++;
+ {
+ wstr[i++] = ((c & 0x1f) << 6) | (str[1] & 0x3f);
+ l... | char *
irc_ctcp_dcc_filename_without_quotes (const char *filename)
{
int length;
length = strlen (filename);
if (length > 1)
{
if ((filename[0] == '\"') && (filename[length - 1] == '\"'))
return weechat_strndup (filename + 1, length - 2);
}
return strdup (filename);
} |
CVE-2017-7407 | void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
{
FILE *stream = stdout;
const char *ptr = writeinfo;
char *stringp = NULL;
long longinfo;
double doubleinfo;
while(ptr && *ptr) {
if('%' == *ptr) {
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%',... | --- vulnerable
+++ patched
@@ -7,7 +7,7 @@
double doubleinfo;
while(ptr && *ptr) {
- if('%' == *ptr) {
+ if('%' == *ptr && ptr[1]) {
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%', stream); | CVE-2022-28069 | static int vax_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
op->size = 1;
if (len < 1) {
return -1;
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
switch (buf[0]) {
case 0x04:
op->type = R_ANAL_OP_TYPE_RET;
break;
case 0x2e:
op->type = R_ANAL_OP_TYPE_MOV;
op-... | --- vulnerable
+++ patched
@@ -137,7 +137,7 @@
case 0xfb: // calls
op->type = R_ANAL_OP_TYPE_CALL;
op->size = 7;
- {
+ if (len > 6) {
int oa = 3;
ut32 delta = buf[oa];
delta |= (ut32)(buf[oa + 1]) << 8; | CVE-2023-2838 | GF_EXPORT
GF_Err gf_filter_get_stats(GF_Filter *f, GF_FilterStats *stats)
{
u32 i;
Bool set_name=GF_FALSE;
if (!stats || !f) return GF_BAD_PARAM;
memset(stats, 0, sizeof(GF_FilterStats));
stats->filter = f;
stats->filter_alias = f->multi_sink_target;
if (f->multi_sink_target) return GF_OK;
stats->percent = f-... | --- vulnerable
+++ patched
@@ -74,6 +74,9 @@
if ((f->num_input_pids!=1) && f->num_output_pids)
continue;
+ if (!pidi->pid)
+ continue;
+
if (!stats->codecid)
stats->codecid = pidi->pid->codecid;
if (!stats->stream_type) | void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
{
FILE *stream = stdout;
const char *ptr = writeinfo;
char *stringp = NULL;
long longinfo;
double doubleinfo;
while(ptr && *ptr) {
if('%' == *ptr && ptr[1]) {
if('%' == ptr[1]) {
/* an escaped %-letter */
... |
CVE-2017-6419 | void lzxd_free(struct lzxd_stream *lzx) {
struct mspack_system *sys;
if (lzx) {
sys = lzx->sys;
sys->free(lzx->inbuf);
sys->free(lzx->window);
sys->free(lzx);
}
} | --- vulnerable
+++ patched
@@ -2,8 +2,10 @@
struct mspack_system *sys;
if (lzx) {
sys = lzx->sys;
- sys->free(lzx->inbuf);
- sys->free(lzx->window);
+ if(lzx->inbuf)
+ sys->free(lzx->inbuf);
+ if(lzx->window)
+ sys->free(lzx->window);
sys->free(lzx);
}
} | CVE-2022-3077 | static int ismt_access(struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data *data)
{
int ret;
unsigned long time_left;
dma_addr_t dma_addr = 0; /* address of the data buffer */
u8 dma_size = 0;
enum dma_data_direction dma_direction ... | --- vulnerable
+++ patched
@@ -135,6 +135,9 @@
case I2C_SMBUS_BLOCK_PROC_CALL:
dev_dbg(dev, "I2C_SMBUS_BLOCK_PROC_CALL\n");
+ if (data->block[0] > I2C_SMBUS_BLOCK_MAX)
+ return -EINVAL;
+
dma_size = I2C_SMBUS_BLOCK_MAX;
desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, 1);
desc->wr_len_cmd = data->block[0] ... | CVE-2022-0522 | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... | --- vulnerable
+++ patched
@@ -23,7 +23,6 @@
shift -= 64;
regc = "h";
}
-
if (shift > 0 && shift < 64) {
r_strbuf_appendf (sb, "%d,SWAP,0x%"PFMT64x",&,<<,%s%s,0x%"PFMT64x",&,|,%s%s",
shift, mask, REG64 (n), regc, VEC64_MASK (shift, size), REG64 (n), regc); | void lzxd_free(struct lzxd_stream *lzx) {
struct mspack_system *sys;
if (lzx) {
sys = lzx->sys;
if(lzx->inbuf)
sys->free(lzx->inbuf);
if(lzx->window)
sys->free(lzx->window);
sys->free(lzx);
}
} |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-1714 | static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int ret;
struct msp430_cmd cmd;
memset (&cmd, 0, sizeof (cmd));
//op->id = ???;
op->size = -1;
op->nopcode = 1;
op->type = R_ANAL_OP_TYPE_UNK;
op->family = R_ANAL_OP_FAMILY_CPU;
ret = op->size = msp430_deco... | --- vulnerable
+++ patched
@@ -1,15 +1,11 @@
static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
- int ret;
- struct msp430_cmd cmd;
-
- memset (&cmd, 0, sizeof (cmd));
- //op->id = ???;
+ struct msp430_cmd cmd = {0};
op->size = -1;
op->nopcode = 1;
op->type = R... | CVE-2025-29088 | static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
#ifndef SQLITE_OMIT_LOOKASIDE
void *pStart;
sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt;
int nBig; /* Number of full-size slots */
int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */
if( sqlite3LookasideUsed(db,0)>0 ){
retu... | --- vulnerable
+++ patched
@@ -1,9 +1,14 @@
-static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
+static int setupLookaside(
+ sqlite3 *db, /* Database connection being configured */
+ void *pBuf, /* Memory to use for lookaside. May be NULL */
+ int sz, /* Desired size of each lookas... | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2017-12991 | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... | --- vulnerable
+++ patched
@@ -58,6 +58,7 @@
ND_TCHECK(tptr[0]);
ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_open_values,
"?", tptr[0])));
+ ND_TCHECK(tptr[1]);
for (i = 0; i < tptr[1] * as_size; i += as_size) {
ND_TCHECK2(... | CVE-2023-4778 | char *gf_bt_get_next(GF_BTParser *parser, Bool point_break)
{
u32 has_quote;
Bool go = 1;
s32 i;
gf_bt_check_line(parser);
i=0;
has_quote = 0;
while (go) {
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
if (parser-... | --- vulnerable
+++ patched
@@ -7,12 +7,12 @@
i=0;
has_quote = 0;
while (go) {
+ if (parser->line_pos+i>=parser->line_size) break;
+
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
-
- if (parser->line_pos+i==parse... | CVE-2022-2522 | static char_u *
ins_compl_infercase_gettext(
char_u *str,
int char_len,
int compl_char_len,
int min_len,
char_u **tofree)
{
int *wca; // Wide character array.
char_u *p;
int i, c;
int has_lower = FALSE;
int was_letter = FALSE;
garray_T gap;
IObuff[0] = NUL;
// Allocate wide... | --- vulnerable
+++ patched
@@ -114,6 +114,7 @@
// growarray. Add the character in the next round.
if (ga_grow(&gap, IOSIZE) == FAIL)
return (char_u *)"[failed]";
+ *p = NUL;
STRCPY(gap.ga_data, IObuff);
gap.ga_len = (int)STRLEN(IObuff);
} | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... |
CVE-2010-5331 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
struct drm_display_mode *mode)
{
struct radeon_mode_info *mode_info = &rdev->mode_info;
ATOM_ANALOG_TV_INFO *tv_info;
ATOM_ANALOG_TV_INFO_V1_2 *tv_info_v1_2;
ATOM_DTD_FORMAT *dtd_timings;
int data_index = GetIndexIntoMasterTable(DATA, Analo... | --- vulnerable
+++ patched
@@ -16,7 +16,7 @@
switch (crev) {
case 1:
tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset);
- if (index > MAX_SUPPORTED_TV_TIMING)
+ if (index >= MAX_SUPPORTED_TV_TIMING)
return false;
mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index]... | CVE-2017-13021 | void
icmp6_print(netdissect_options *ndo,
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
const struct ip6_hdr *oip;
const struct udphdr *ouh;
int dport;
const u_char *ep;
u_int prot;
dp = (const struct icmp6_hdr *)bp;
ip =... | --- vulnerable
+++ patched
@@ -263,6 +263,7 @@
if (ndo->ndo_vflag) {
ND_TCHECK(dp->icmp6_data16[0]);
ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_TCHECK(dp->icmp6_data16[1]);
if (dp->icmp6_data16[1] & 0xc0)
ND_PRINT((ndo," "));
if (dp->icmp6_data16[1] & 0x80) | CVE-2016-9538 | static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
uint32 width, uint16 spp,
struct dump_opts *dump)
{
int i, j, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
int32 bytes_read = 0;
uint1... | --- vulnerable
+++ patched
@@ -2,9 +2,12 @@
uint32 width, uint16 spp,
struct dump_opts *dump)
{
- int i, j, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
+ int i, bytes_per_sample, bytes_per_pixel, shift_width, result... | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
struct drm_display_mode *mode)
{
struct radeon_mode_info *mode_info = &rdev->mode_info;
ATOM_ANALOG_TV_INFO *tv_info;
ATOM_ANALOG_TV_INFO_V1_2 *tv_info_v1_2;
ATOM_DTD_FORMAT *dtd_timings;
int data_index = GetIndexIntoMasterTable(DATA, Analo... |
CVE-2022-2257 | char_u *
str2special(
char_u **sp,
int from) // TRUE for lhs of mapping
{
int c;
static char_u buf[7];
char_u *str = *sp;
int modifiers = 0;
int special = FALSE;
if (has_mbyte)
{
char_u *p;
// Try to un-escape a multi-byte character. Return the un-escaped
// string if i... | --- vulnerable
+++ patched
@@ -54,8 +54,8 @@
*sp = str + 1;
}
else
- // single-byte character or illegal byte
- *sp = str + 1;
+ // single-byte character, NUL or illegal byte
+ *sp = str + (*str == NUL ? 0 : 1);
// Make special keys and C0 control characters in <> form, also <M-Space>.
// Us... | CVE-2023-33660 | uint8_t *
copyn_str(const uint8_t *src, uint32_t *pos, int *str_len, int limit)
{
*str_len = 0;
uint8_t *dest = NULL;
if (!src || !pos) {
*str_len = 0;
return NULL;
}
NNI_GET16(src + (*pos), *str_len);
*pos = (*pos) + 2;
if (*str_len > (limit-2)) {
//buffer overflow
*str_len = -1;
}
if (*str_le... | --- vulnerable
+++ patched
@@ -4,7 +4,7 @@
*str_len = 0;
uint8_t *dest = NULL;
- if (!src || !pos) {
+ if (!src || !pos || limit < 2) {
*str_len = 0;
return NULL;
} | CVE-2016-9189 | PyObject*
PyImaging_MapBuffer(PyObject* self, PyObject* args)
{
Py_ssize_t y, size;
Imaging im;
PyObject* target;
Py_buffer view;
char* mode;
char* codec;
PyObject* bbox;
Py_ssize_t offset;
int xsize, ysize;
int stride;
int ystep;
if (!PyArg_ParseTuple(args, "O(ii)sOn(s... | --- vulnerable
+++ patched
@@ -32,7 +32,17 @@
stride = xsize * 4;
}
+ if (ysize > INT_MAX / stride) {
+ PyErr_SetString(PyExc_MemoryError, "Integer overflow in ysize");
+ return NULL;
+ }
+
size = (Py_ssize_t) ysize * stride;
+
+ if (offset > SIZE_MAX - size) {
+ P... | char_u *
str2special(
char_u **sp,
int from) // TRUE for lhs of mapping
{
int c;
static char_u buf[7];
char_u *str = *sp;
int modifiers = 0;
int special = FALSE;
if (has_mbyte)
{
char_u *p;
// Try to un-escape a multi-byte character. Return the un-escaped
// string if i... |
CVE-2016-7418 | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... | --- vulnerable
+++ patched
@@ -37,10 +37,10 @@
int i;
if (atts) for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && atts[i][0]) {
+ if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {
char tmp_buf[2];
- snprintf(tmp_buf, sizeof(tmp_buf), "%c", (char)strt... | CVE-2024-37407 | static int
slurp_central_directory(struct archive_read *a, struct archive_entry* entry,
struct zip *zip)
{
ssize_t i;
unsigned found;
int64_t correction;
ssize_t bytes_avail;
const char *p;
/*
* Find the start of the central directory. The end-of-CD
* record has our starting point, but there are lots of... | --- vulnerable
+++ patched
@@ -197,7 +197,7 @@
* as the actual resource fork doesn't end with '/'.
*/
size_t tmp_length = filename_length;
- if (name[tmp_length - 1] == '/') {
+ if (tmp_length > 0 && name[tmp_length - 1] == '/') {
tmp_length--;
r = rsrc_basename(name, tmp_length);
... | CVE-2022-1420 | /*
* Evaluate "->method()".
* "*arg" points to "method".
* Returns FAIL or OK. "*arg" is advanced to after the ')'.
*/
static int
eval_lambda(
char_u **arg,
typval_T *rettv,
evalarg_T *evalarg,
int verbose) // give error messages
{
int evaluate = evalarg != NULL
&& (evalarg->eval... | --- vulnerable
+++ patched
@@ -28,19 +28,23 @@
++*arg;
ret = eval1(arg, rettv, evalarg);
*arg = skipwhite_and_linebreak(*arg, evalarg);
- if (**arg == ')')
- {
- ++*arg;
- }
- else
+ if (**arg != ')')
{
emsg(_(e_missing_closing_paren));
- ret = FAIL;
+ return FAIL;
}
+ if (rettv->v_type != V... | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... |
CVE-2013-1773 | extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs) | --- vulnerable
+++ patched
@@ -1 +1,2 @@
-extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs)
+extern int utf8s_to_utf16s(const u8 *s, int len,
+ enum utf16_endian endian, wchar_t *pwcs, int maxlen) | CVE-2016-2385 | int encode_msg(struct sip_msg *msg,char *payload,int len)
{
int i,j,k,u,request;
unsigned short int h;
struct hdr_field* hf;
struct msg_start* ms;
struct sip_uri miuri;
char *myerror=NULL;
ptrdiff_t diff;
if(len < MAX_ENCODED_MSG + MAX_MESSAGE_LEN)
return -1;
if(parse_headers(msg,HDR_E... | --- vulnerable
+++ patched
@@ -10,6 +10,7 @@
if(len < MAX_ENCODED_MSG + MAX_MESSAGE_LEN)
return -1;
+
if(parse_headers(msg,HDR_EOH_F,0)<0){
myerror="in parse_headers";
goto error;
@@ -118,6 +119,11 @@
/*j+=k;*/
/*pkg_free(payload2);*/
/*now we copy the actual message after the... | CVE-2022-0570 | static int
gen_values(codegen_scope *s, node *t, int val, int limit)
{
int n = 0;
int first = 1;
int slimit = GEN_VAL_STACK_MAX;
if (limit == 0) limit = GEN_LIT_ARY_MAX;
if (cursp() >= slimit) slimit = INT16_MAX;
if (!val) {
while (t) {
codegen(s, t->car, NOVAL);
n++;
t = t->cdr;
... | --- vulnerable
+++ patched
@@ -20,7 +20,7 @@
while (t) {
int is_splat = nint(t->car->car) == NODE_SPLAT;
- if (is_splat || n > limit || cursp() >= slimit) { /* flush stack */
+ if (is_splat || cursp() >= slimit) { /* flush stack */
pop_n(n);
if (first) {
if (n == 0) {
@@ -59,5 +59... | extern int utf8s_to_utf16s(const u8 *s, int len,
enum utf16_endian endian, wchar_t *pwcs, int maxlen) |
CVE-2017-13015 | void
eap_print(netdissect_options *ndo,
register const u_char *cp,
u_int length)
{
const struct eap_frame_t *eap;
const u_char *tptr;
u_int tlen, type, subtype;
int count=0, len;
tptr = cp;
tlen = length;
eap = (const struct eap_frame_t *)cp;
ND_TCHECK(*eap);
/*... | --- vulnerable
+++ patched
@@ -34,7 +34,9 @@
switch (eap->type) {
case EAP_FRAME_TYPE_PACKET:
+ ND_TCHECK_8BITS(tptr);
type = *(tptr);
+ ND_TCHECK_16BITS(tptr+2);
len = EXTRACT_16BITS(tptr+2);
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
tok2str(eap_cod... | CVE-2022-1714 | static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int ret;
struct msp430_cmd cmd;
memset (&cmd, 0, sizeof (cmd));
//op->id = ???;
op->size = -1;
op->nopcode = 1;
op->type = R_ANAL_OP_TYPE_UNK;
op->family = R_ANAL_OP_FAMILY_CPU;
ret = op->size = msp430_deco... | --- vulnerable
+++ patched
@@ -1,15 +1,11 @@
static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
- int ret;
- struct msp430_cmd cmd;
-
- memset (&cmd, 0, sizeof (cmd));
- //op->id = ???;
+ struct msp430_cmd cmd = {0};
op->size = -1;
op->nopcode = 1;
op->type = R... | CVE-2024-37310 | static int v2g_incoming_v2gtp(struct v2g_connection* conn) {
int rv;
/* read and process header */
rv = connection_read(conn, conn->buffer, V2GTP_HEADER_LENGTH);
if (rv < 0) {
dlog(DLOG_LEVEL_ERROR, "connection_read(header) failed: %s",
(rv == -1) ? strerror(errno) : "connection te... | --- vulnerable
+++ patched
@@ -22,8 +22,14 @@
return -1;
}
+ if (conn->payload_len >= UINT32_MAX - V2GTP_HEADER_LENGTH) {
+ dlog(DLOG_LEVEL_ERROR, "Prevent integer overflow - payload too long: have %d, would need %u",
+ DEFAULT_BUFFER_SIZE, conn->payload_len);
+ return -1;
+... | void
eap_print(netdissect_options *ndo,
register const u_char *cp,
u_int length)
{
const struct eap_frame_t *eap;
const u_char *tptr;
u_int tlen, type, subtype;
int count=0, len;
tptr = cp;
tlen = length;
eap = (const struct eap_frame_t *)cp;
ND_TCHECK(*eap);
/*... |
CVE-2017-14608 | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... | --- vulnerable
+++ patched
@@ -13,8 +13,15 @@
len = MIN (256, width-col);
ret = kodak_65000_decode (buf, len);
for (i=0; i < len; i++)
- if ((RAW(row,col+i) = curve[ret ? buf[i] :
- (pred[i & 1] += buf[i])]) >> 12) derror();
+ {
+ int idx = ret ? buf[i] : (pred[i & 1] += buf[i]);
+ if(idx >=0... | CVE-2022-31003 | static void parse_descs(sdp_parser_t *p,
char *record,
char *message,
sdp_media_t **medias)
{
char *rest;
const char *strip;
sdp_media_t *m = NULL;
sdp_connection_t **connections = NULL;
sdp_bandwidth_t **bandwidths = NULL;
sdp_attribute_t **attributes = NULL;
if (!STRICT(p))
strip = SPACE T... | --- vulnerable
+++ patched
@@ -19,6 +19,10 @@
record && p->pr_ok;
record = next(&message, CRLF, strip)) {
char field = record[0];
+
+ if (strlen(record) < 2) {
+ return;
+ }
rest = record + 2; rest += strspn(rest, strip);
| CVE-2022-0359 | static int
init_ccline(int firstc, int indent)
{
ccline.overstrike = FALSE; // always start in insert mode
/*
* set some variables for redrawcmd()
*/
ccline.cmdfirstc = (firstc == '@' ? 0 : firstc);
ccline.cmdindent = (firstc > 0 ? indent : 0);
// alloc initial ccline.cmdbuff
al... | --- vulnerable
+++ patched
@@ -10,7 +10,7 @@
ccline.cmdindent = (firstc > 0 ? indent : 0);
// alloc initial ccline.cmdbuff
- alloc_cmdbuff(exmode_active ? 250 : indent + 1);
+ alloc_cmdbuff(indent + 50);
if (ccline.cmdbuff == NULL)
return FAIL;
ccline.cmdlen = ccline.cmdpos = 0; | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2017-6435 | static plist_t parse_string_node(const char **bnode, uint64_t size)
{
plist_data_t data = plist_new_plist_data();
data->type = PLIST_STRING;
data->strval = (char *) malloc(sizeof(char) * (size + 1));
memcpy(data->strval, *bnode, size);
data->strval[size] = '\0';
data->length = strlen(data->strv... | --- vulnerable
+++ patched
@@ -4,6 +4,11 @@
data->type = PLIST_STRING;
data->strval = (char *) malloc(sizeof(char) * (size + 1));
+ if (!data->strval) {
+ plist_free_data(data);
+ PLIST_BIN_ERR("%s: Could not allocate %" PRIu64 " bytes\n", __func__, sizeof(char) * (size + 1));
+ retu... | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2022-31002 | static
char *url_canonize3(char *d, char const * const s, size_t n,
unsigned m32, unsigned m64, unsigned m96)
{
size_t i = 0;
if (d == s)
for (;s[i] && i < n; d++, i++)
if (s[i] == '%')
break;
for (;s[i] && i < n; d++, i++) {
unsigned char c = s[i], h1, h2;
if (c != '%') {
*d = c... | --- vulnerable
+++ patched
@@ -17,7 +17,12 @@
continue;
}
- h1 = s[i + 1], h2 = s[i + 2];
+ h1 = s[i + 1];
+ if (!h1) {
+ *d = '\0';
+ return NULL;
+ }
+ h2 = s[i + 2];
if (!IS_HEX(h1) || !IS_HEX(h2)) {
*d = '\0'; | CVE-2023-40022 | static int
consume_count(type)
const char **type;
{
int count = 0;
if (!isdigit((unsigned char)**type))
return -1;
while (isdigit((unsigned char)**type)) {
count *= 10;
/* Check for overflow.
We assume that count is represented using two's-complement;
no power of two is divisible by ten, so if ... | --- vulnerable
+++ patched
@@ -2,7 +2,10 @@
consume_count(type)
const char **type;
{
- int count = 0;
+ // Note by RizinOrg:
+ // to prevent the overflow check to be optimized out
+ // by the compiler, this variable needs to be volatile.
+ volatile int count = 0;
if (!isdigit((unsigned char)**type))
return... | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2016-10327 | bool EnhWMFReader::ReadEnhWMF()
{
sal_uInt32 nStretchBltMode = 0;
sal_uInt32 nNextPos(0),
nW(0), nH(0), nColor(0), nIndex(0),
nDat32(0), nNom1(0), nDen1(0), nNom2(0), nDen2(0);
sal_Int32 nX32(0), nY32(0), nx32(0), ny32(0);
bool bStatus = ReadHeader();
bool ... | --- vulnerable
+++ patched
@@ -631,13 +631,22 @@
else
{
const sal_uInt32 nSourceSize = cbBmiSrc + cbBitsSrc + 14;
- if ( nSourceSize <= ( nEndPos - nStartPos ) )
+ bool bSafeRead = nSourceSize <= (nEndPos - ... | CVE-2022-3077 | static int ismt_access(struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data *data)
{
int ret;
unsigned long time_left;
dma_addr_t dma_addr = 0; /* address of the data buffer */
u8 dma_size = 0;
enum dma_data_direction dma_direction ... | --- vulnerable
+++ patched
@@ -135,6 +135,9 @@
case I2C_SMBUS_BLOCK_PROC_CALL:
dev_dbg(dev, "I2C_SMBUS_BLOCK_PROC_CALL\n");
+ if (data->block[0] > I2C_SMBUS_BLOCK_MAX)
+ return -EINVAL;
+
dma_size = I2C_SMBUS_BLOCK_MAX;
desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, 1);
desc->wr_len_cmd = data->block[0] ... | CVE-2022-2581 | static char_u *
cstrchr(char_u *s, int c)
{
char_u *p;
int cc;
if (!rex.reg_ic || (!enc_utf8 && mb_char2len(c) > 1))
return vim_strchr(s, c);
// tolower() and toupper() can be slow, comparing twice should be a lot
// faster (esp. when using MS Visual C++!).
// For UTF-8 need to use folded ca... | --- vulnerable
+++ patched
@@ -26,7 +26,11 @@
{
if (enc_utf8 && c > 0x80)
{
- if (utf_fold(utf_ptr2char(p)) == cc)
+ int uc = utf_ptr2char(p);
+
+ // Do not match an illegal byte. E.g. 0xff matches 0xc3 0xbf,
+ // not 0xff.
+ if ((uc < 0x80 || uc != *p) && utf_fold(uc) == cc)
return p;
... | bool EnhWMFReader::ReadEnhWMF()
{
sal_uInt32 nStretchBltMode = 0;
sal_uInt32 nNextPos(0),
nW(0), nH(0), nColor(0), nIndex(0),
nDat32(0), nNom1(0), nDen1(0), nNom2(0), nDen2(0);
sal_Int32 nX32(0), nY32(0), nx32(0), ny32(0);
bool bStatus = ReadHeader();
bool ... |
CVE-2017-1000249 | private int
/*ARGSUSED*/
do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz >=... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
- type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) {
+ type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
uint8_t desc[20];
const char ... | CVE-2023-49208 | static json_t * register_new_attestation(struct config_module * config, json_t * j_params, json_t * j_scheme_data, json_t * j_credential) {
json_t * j_return, * j_client_data = NULL, * j_error, * j_result, * j_pubkey = NULL, * j_cert = NULL, * j_query, * j_element = NULL;
unsigned char * client_data = NULL, * chall... | --- vulnerable
+++ patched
@@ -277,13 +277,13 @@
for (i=0; i<cbor_map_size(cbor_cose); i++) {
cbor_key = cbor_map_handle(cbor_cose)[i].key;
cbor_value = cbor_map_handle(cbor_cose)[i].value;
- if (cbor_isa_negint(cbor_key) && cbor_get_int(cbor_key) == 1 && cbor_isa_bytestring(cbor... | CVE-2016-6823 | static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
BMPInfo
bmp_info;
const char
*option;
const StringInfo
*profile;
MagickBooleanType
have_color_info,
status;
MagickOffsetType
scene;
MemoryInfo
*pixel_info;
regis... | --- vulnerable
+++ patched
@@ -172,10 +172,13 @@
bmp_info.file_size+=extra_size;
bmp_info.offset_bits+=extra_size;
}
+ if ((image->columns != (signed int) image->columns) ||
+ (image->rows != (signed int) image->rows))
+ ThrowWriterException(ImageError,"WidthOrHeightExceeds... | private int
/*ARGSUSED*/
do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz >=... |
CVE-2013-4244 | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
*(*fill)++ = suffix[code];
firstchar = oldcode =... | --- vulnerable
+++ patched
@@ -13,6 +13,10 @@
}
if (oldcode == -1) {
+ if (code >= clear) {
+ fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
+ return 0;
+ }
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1; | CVE-2022-28069 | static int vax_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
op->size = 1;
if (len < 1) {
return -1;
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
switch (buf[0]) {
case 0x04:
op->type = R_ANAL_OP_TYPE_RET;
break;
case 0x2e:
op->type = R_ANAL_OP_TYPE_MOV;
op-... | --- vulnerable
+++ patched
@@ -137,7 +137,7 @@
case 0xfb: // calls
op->type = R_ANAL_OP_TYPE_CALL;
op->size = 7;
- {
+ if (len > 6) {
int oa = 3;
ut32 delta = buf[oa];
delta |= (ut32)(buf[oa + 1]) << 8; | CVE-2025-54080 | void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList& nativePreviews, bool write) {
// open input file
if (io.open() != 0) {
throw Error(ErrorCode::kerDataSourceOpenFailed, io.path(), strError());
}
IoCloser closer(io);
// read from input file via memory map
const byte* data... | --- vulnerable
+++ patched
@@ -17,6 +17,8 @@
uint32_t posTiff = 0;
uint32_t sizeTiff = 0;
+ ErrorCode errcode = write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData;
+
// check for DOS EPS
const bool dosEps =
(size >= dosEpsSignature.size() && memcmp(data, dosEpsSignature.d... | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
if (code >= clear) {
fprintf(s... |
CVE-2022-24764 | static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len)
{
char *p = buf;
char *end = buf+len;
unsigned i;
int printed;
/* check length for the "m=" line. */
if (len < (pj_size_t)m->desc.media.slen+m->desc.transport.slen+12+24) {
return -1;
}
*p++ = 'm'; /*... | --- vulnerable
+++ patched
@@ -25,12 +25,21 @@
pj_memcpy(p, m->desc.transport.ptr, m->desc.transport.slen);
p += m->desc.transport.slen;
for (i=0; i<m->desc.fmt_count; ++i) {
- *p++ = ' ';
- pj_memcpy(p, m->desc.fmt[i].ptr, m->desc.fmt[i].slen);
- p += m->desc.fmt[i].slen;
+ if (end-p > m->desc.fmt[i].sl... | CVE-2023-46852 | static void proxy_process_command(conn *c, char *command, size_t cmdlen, bool multiget) {
assert(c != NULL);
LIBEVENT_THREAD *thr = c->thread;
struct proxy_hook *hooks = thr->proxy_hooks;
lua_State *L = thr->L;
proxy_ctx_t *ctx = thr->proxy_ctx;
mcp_parser_t pr = {0};
// Avoid doing resp_st... | --- vulnerable
+++ patched
@@ -70,12 +70,18 @@
if (!multiget && pr.cmd_type == CMD_TYPE_GET && pr.has_space) {
uint32_t keyoff = pr.tokens[pr.keytoken];
while (pr.klen != 0) {
- char temp[KEY_MAX_LENGTH + 30];
+ char temp[KEY_MAX_LENGTH + MAX_CMD_PREFIX + 30];
c... | CVE-2017-8924 | static void edge_bulk_in_callback(struct urb *urb)
{
struct edgeport_port *edge_port = urb->context;
struct device *dev = &edge_port->port->dev;
unsigned char *data = urb->transfer_buffer;
int retval = 0;
int port_number;
int status = urb->status;
switch (status) {
case 0:
/* success */
break;
case -ECONN... | --- vulnerable
+++ patched
@@ -31,7 +31,7 @@
port_number = edge_port->port->port_number;
- if (edge_port->lsr_event) {
+ if (urb->actual_length > 0 && edge_port->lsr_event) {
edge_port->lsr_event = 0;
dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n",
__func__, port_number, edge_po... | static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len)
{
char *p = buf;
char *end = buf+len;
unsigned i;
int printed;
/* check length for the "m=" line. */
if (len < (pj_size_t)m->desc.media.slen+m->desc.transport.slen+12+24) {
return -1;
}
*p++ = 'm'; /*... |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-1619 | static int
cmdline_erase_chars(
int c,
int indent
#ifdef FEAT_SEARCH_EXTRA
, incsearch_state_T *isp
#endif
)
{
int i;
int j;
if (c == K_KDEL)
c = K_DEL;
/*
* Delete current character is the same as backspace on next
* character, except at end of line.
*/
if (c == K_DEL && ccl... | --- vulnerable
+++ patched
@@ -46,10 +46,13 @@
{
while (p > ccline.cmdbuff && vim_isspace(p[-1]))
--p;
- i = vim_iswordc(p[-1]);
- while (p > ccline.cmdbuff && !vim_isspace(p[-1])
- && vim_iswordc(p[-1]) == i)
- --p;
+ if (p > ccline.cmdbuff)
+ {
+ i = vim_iswordc(p[-1]);
+ while (p >... | CVE-2017-7395 | void SMsgReader::readClientCutText()
{
is->skip(3);
int len = is->readU32();
if (len > maxCutText) {
is->skip(len);
vlog.error("Cut text too long (%d bytes) - ignoring", len);
return;
}
CharArray ca(len+1);
ca.buf[len] = 0;
is->readBytes(ca.buf, len);
handler->clientCutText(ca.buf, len);
} | --- vulnerable
+++ patched
@@ -2,6 +2,9 @@
{
is->skip(3);
int len = is->readU32();
+ if (len < 0) {
+ throw Exception("Cut text too long.");
+ }
if (len > maxCutText) {
is->skip(len);
vlog.error("Cut text too long (%d bytes) - ignoring", len); | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-41883 | bool IsHostMemoryArg(const EagerOperation& op, const NodeDef* node_def,
const Device* op_device, const KernelDef* kernel_def,
const int port_id) {
if (op.is_function()) return false;
if (node_def == nullptr) return false;
if (kernel_def == nullptr || op_device == nullptr)... | --- vulnerable
+++ patched
@@ -7,6 +7,10 @@
const auto& host_memory_args = kernel_def->host_memory_arg();
const OpDef& op_def = OpRegistry::Global()->LookUp(op.Name())->op_def;
const int arg_id = OpPortIdToArgId(*node_def, op_def.input_arg(), port_id);
+ // Fail if argument ID not found.
+ if (arg_id < 0) {
... | CVE-2022-3028 | static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs)
{
struct pfkey_sock *pfk = pfkey_sk(sk);
struct sk_buff *supp_skb;
if (hdr->sadb_msg_satype > SADB_SATYPE_MAX)
return -EINVAL;
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) {
if (pfk->register... | --- vulnerable
+++ patched
@@ -12,9 +12,12 @@
pfk->registered |= (1<<hdr->sadb_msg_satype);
}
+ mutex_lock(&pfkey_mutex);
xfrm_probe_algs();
supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
+ mutex_unlock(&pfkey_mutex);
+
if (!supp_skb) {
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)... | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2023-4778 | char *gf_bt_get_next(GF_BTParser *parser, Bool point_break)
{
u32 has_quote;
Bool go = 1;
s32 i;
gf_bt_check_line(parser);
i=0;
has_quote = 0;
while (go) {
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
if (parser-... | --- vulnerable
+++ patched
@@ -7,12 +7,12 @@
i=0;
has_quote = 0;
while (go) {
+ if (parser->line_pos+i>=parser->line_size) break;
+
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
-
- if (parser->line_pos+i==parse... | CVE-2013-2058 | static int host_start(struct ci13xxx *ci)
{
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
int ret;
if (usb_disabled())
return -ENODEV;
hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
if (!hcd)
return -ENOMEM;
dev_set_drvdata(ci->dev, ci);
hcd->rsrc_start = ci->hw_bank.phys;
hcd->rsrc... | --- vulnerable
+++ patched
@@ -30,5 +30,8 @@
else
ci->hcd = hcd;
+ if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING)
+ hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
+
return ret;
} | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... |
CVE-2016-10049 | static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define SkipLinesOp 0x01
#define SetColorOp 0x02
#define SkipPixelsOp 0x03
#define ByteDataOp 0x05
#define RunDataOp 0x06
#define EOFOp 0x07
char
magick[12];
Image
*image;
int
opcode,
operand,
status;
... | --- vulnerable
+++ patched
@@ -190,10 +190,11 @@
number_planes_filled))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
pixel_info=AcquireVirtualMemory(image->columns,image->rows*
- number_planes_filled*sizeof(*pixels));
+ MagickMax(number_planes_filled,4)*sizeof(*pixe... | CVE-2023-4781 | void
ex_substitute(exarg_T *eap)
{
linenr_T lnum;
long i = 0;
regmmatch_T regmatch;
static subflags_T subflags = {FALSE, FALSE, FALSE, TRUE, FALSE,
FALSE, FALSE, 0};
#ifdef FEAT_EVAL
subflags_T subflags_save;
#endif
int save_do_all; // remember user specified 'g' flag
int sav... | --- vulnerable
+++ patched
@@ -794,6 +794,9 @@
{
nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1;
skip_match = TRUE;
+ // safety check
+ if (nmatch < 0)
+ goto skip;
}
// Need room for: | CVE-2016-10196 | int
evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *outlen)
{
int port;
char buf[128];
const char *cp, *addr_part, *port_part;
int is_ipv6;
/* recognized formats are:
* [ipv6]:port
* ipv6
* [ipv6]
* ipv4:port
* ipv4
*/
cp = strchr(ip_as_string, ':');
if (*ip_as_string... | --- vulnerable
+++ patched
@@ -15,12 +15,12 @@
cp = strchr(ip_as_string, ':');
if (*ip_as_string == '[') {
- int len;
+ size_t len;
if (!(cp = strchr(ip_as_string, ']'))) {
return -1;
}
- len = (int) ( cp-(ip_as_string + 1) );
- if (len > (int)sizeof(buf)-1) {
+ len = ( cp-(ip_as_string + 1) );
+ ... | static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define SkipLinesOp 0x01
#define SetColorOp 0x02
#define SkipPixelsOp 0x03
#define ByteDataOp 0x05
#define RunDataOp 0x06
#define EOFOp 0x07
char
magick[12];
Image
*image;
int
opcode,
operand,
status;
... |
CVE-2017-13023 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -37,6 +37,7 @@
goto trunc;
}
/* units of 4 secs */
+ ND_TCHECK_16BITS(&bp[i+2]);
ND_PRINT((ndo, "(refresh: %u)",
EXTRACT_16BITS(&bp[i+2]) << 2));
break; | CVE-2022-31001 | sip_method_t sip_method_d(char **ss, char const **return_name)
{
char *s = *ss, c = *s;
char const *name;
int code = sip_method_unknown;
size_t n = 0;
#define MATCH(s, m) (strncmp(s, m, n = sizeof(m) - 1) == 0)
switch (c) {
case 'A': if (MATCH(s, "ACK")) code = sip_method_ack; break;
case 'B': if (MATCH... | --- vulnerable
+++ patched
@@ -45,6 +45,10 @@
#undef MATCH
+ if (strlen(s) < n) {
+ return sip_method_invalid;
+ }
+
if (IS_NON_WS(s[n]))
/* Unknown method */
code = sip_method_unknown; | CVE-2013-6370 | struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
const char *str, int len)
{
struct json_object *obj = NULL;
char c = '\1';
#ifdef HAVE_SETLOCALE
char *oldlocale=NULL, *tmplocale;
tmplocale = setlocale(LC_NUMERIC, NULL);
if (tmplocale) oldlocale = strdup(tmplocale);
setlocale(LC_N... | --- vulnerable
+++ patched
@@ -13,6 +13,16 @@
tok->char_offset = 0;
tok->err = json_tokener_success;
+
+ /* this interface is presently not 64-bit clean due to the int len argument
+ and the internal printbuf interface that takes 32-bit int len arguments
+ so the function limits the maximum string size... | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... |
CVE-2017-1000458 | int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)
{
const u_char* data_start = data;
if ( len <= 0 )
return 0;
for ( ; len > 0; --len, ++data )
{
if ( offset >= buf_len )
InitBuffer(buf_len * 2);
int c = data[0];
#define EMIT_LINE \
{ \
buf[offset] = '\0'; \
int seq_len = data +... | --- vulnerable
+++ patched
@@ -44,6 +44,16 @@
case '\n':
if ( last_char == '\r' )
{
+ // Weird corner-case:
+ // this can happen if we see a \r at the end of a packet where crlf is
+ // set to CR_as_EOL | LF_as_EOL, with the packet causing crlf to be set to
+ // 0 and the next packet beginning w... | CVE-2017-9226 | static int
next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
int* vs_israw, int v_israw,
enum CCVALTYPE intype, enum CCVALTYPE* type,
enum CCSTATE* state, ScanEnv* env)
{
int r;
switch (*state) {
case CCS_VALUE:
if (*type == CCV_SB) {
BITSET_SET_BIT(cc->bs, (int... | --- vulnerable
+++ patched
@@ -9,6 +9,9 @@
switch (*state) {
case CCS_VALUE:
if (*type == CCV_SB) {
+ if (*vs > 0xff)
+ return ONIGERR_INVALID_CODE_POINT_VALUE;
+
BITSET_SET_BIT(cc->bs, (int )(*vs));
}
else if (*type == CCV_CODE_POINT) { | CVE-2022-23558 | int TfLiteIntArrayGetSizeInBytes(int size) {
static TfLiteIntArray dummy;
int computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size;
#if defined(_MSC_VER)
// Context for why this is needed is in http://b/189926408#comment21
computed_size -= sizeof(dummy.data[0]);
#endif
return computed_size;
} | --- vulnerable
+++ patched
@@ -1,7 +1,7 @@
-int TfLiteIntArrayGetSizeInBytes(int size) {
+size_t TfLiteIntArrayGetSizeInBytes(int size) {
static TfLiteIntArray dummy;
- int computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size;
+ size_t computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size;
#if de... | int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)
{
const u_char* data_start = data;
if ( len <= 0 )
return 0;
for ( ; len > 0; --len, ++data )
{
if ( offset >= buf_len )
InitBuffer(buf_len * 2);
int c = data[0];
#define EMIT_LINE \
{ \
buf[offset] = '\0'; \
int seq_len = data +... |
CVE-2010-5332 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
{
struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
int i, err = 0;
int free = -1;
mutex_lock(&table->mutex);
for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
if (free < 0 && (table->refs[i] == 0)) {
fr... | --- vulnerable
+++ patched
@@ -19,6 +19,11 @@
++table->refs[i];
goto out;
}
+ }
+
+ if (free < 0) {
+ err = -ENOMEM;
+ goto out;
}
if (table->total == table->max) { | CVE-2024-56827 | static OPJ_BOOL opj_j2k_add_tlmarker(OPJ_UINT32 tileno,
opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos,
OPJ_UINT32 len)
{
assert(cstr_index != 00);
assert(cstr_index->tile_index != 00);
/* expand the list? */
... | --- vulnerable
+++ patched
@@ -37,7 +37,8 @@
if (type == J2K_MS_SOT) {
OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
- if (cstr_index->tile_index[tileno].tp_index) {
+ if (cstr_index->tile_index[tileno].tp_index &&
+ l_current_tile_part < cst... | CVE-2025-3160 | // ------------------------------------------------------------------------------------------------
// Add node identifiers to a hashing set
void SceneCombiner::AddNodeHashes(aiNode *node, std::set<unsigned int> &hashes) {
// Add node name to hashing set if it is non-empty - empty nodes are allowed
// and they ... | --- vulnerable
+++ patched
@@ -1,6 +1,11 @@
// ------------------------------------------------------------------------------------------------
// Add node identifiers to a hashing set
void SceneCombiner::AddNodeHashes(aiNode *node, std::set<unsigned int> &hashes) {
+ if (node == nullptr) {
+ ASSIMP_LOG_VE... | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
{
struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
int i, err = 0;
int free = -1;
mutex_lock(&table->mutex);
for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
if (free < 0 && (table->refs[i] == 0)) {
fr... |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-34033 | static int /* O - Current column */
write_node(FILE *out, /* I - Output file */
tree_t *t, /* I - Document tree node */
int col) /* I - Current column */
{
int i; /* Looping var */
uchar *ptr, /* Pointer to output string */
*entity, /* Entity string */
*src, /* Source image ... | --- vulnerable
+++ patched
@@ -25,7 +25,7 @@
for (ptr = t->data; *ptr; ptr ++)
fputs((char *)iso8859(*ptr), out);
- if (t->data[strlen((char *)t->data) - 1] == '\n')
+ if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
col = 0;
else
col += strlen(... | CVE-2016-7527 | static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MaxTextExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
... | --- vulnerable
+++ patched
@@ -49,7 +49,7 @@
if(exception->severity != UndefinedException) goto FINISH_UNL;
if(magic_info->name == (char *) NULL) goto FINISH_UNL;
- (void) CopyMagickMemory(clone_info->magick,magic_info->name,MaxTextExtent);
+ (void) strncpy(clone_info->magick,magic_info->name,MaxTextExtent);
... | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2022-1619 | static int
cmdline_erase_chars(
int c,
int indent
#ifdef FEAT_SEARCH_EXTRA
, incsearch_state_T *isp
#endif
)
{
int i;
int j;
if (c == K_KDEL)
c = K_DEL;
/*
* Delete current character is the same as backspace on next
* character, except at end of line.
*/
if (c == K_DEL && ccl... | --- vulnerable
+++ patched
@@ -46,10 +46,13 @@
{
while (p > ccline.cmdbuff && vim_isspace(p[-1]))
--p;
- i = vim_iswordc(p[-1]);
- while (p > ccline.cmdbuff && !vim_isspace(p[-1])
- && vim_iswordc(p[-1]) == i)
- --p;
+ if (p > ccline.cmdbuff)
+ {
+ i = vim_iswordc(p[-1]);
+ while (p >... | CVE-2025-7519 | static void
_start (void *data, const char *el, const char **attr)
{
guint state;
guint num_attr;
ParserData *pd = data;
for (num_attr = 0; attr[num_attr] != NULL; num_attr++)
;
state = STATE_NONE;
switch (pd->state)
{
case STATE_NONE:
if (strcmp (el, "policyconfig") == 0)
{
... | --- vulnerable
+++ patched
@@ -4,6 +4,12 @@
guint state;
guint num_attr;
ParserData *pd = data;
+
+ if (pd->stack_depth < 0 || pd->stack_depth >= PARSER_MAX_DEPTH)
+ {
+ g_warning ("XML parsing reached max depth?");
+ goto error;
+ }
for (num_attr = 0; attr[num_attr] != NULL; num_attr++)
... | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... |
CVE-2017-12991 | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... | --- vulnerable
+++ patched
@@ -58,6 +58,7 @@
ND_TCHECK(tptr[0]);
ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_open_values,
"?", tptr[0])));
+ ND_TCHECK(tptr[1]);
for (i = 0; i < tptr[1] * as_size; i += as_size) {
ND_TCHECK2(... | CVE-2022-34035 | static int /* O - Current column */
write_node(FILE *out, /* I - Output file */
tree_t *t, /* I - Document tree node */
int col) /* I - Current column */
{
int i; /* Looping var */
uchar *ptr, /* Pointer to output string */
*entity, /* Entity string */
*src, /* Source image ... | --- vulnerable
+++ patched
@@ -25,7 +25,7 @@
for (ptr = t->data; *ptr; ptr ++)
fputs((char *)iso8859(*ptr), out);
- if (t->data[strlen((char *)t->data) - 1] == '\n')
+ if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
col = 0;
else
col += strlen(... | CVE-2022-1899 | static int string_scan_range(RList *list, RBinFile *bf, int min,
const ut64 from, const ut64 to, int type, int raw, RBinSection *section) {
RBin *bin = bf->rbin;
ut8 tmp[R_STRING_SCAN_BUFFER_SIZE];
ut64 str_start, needle = from;
int count = 0, i, rc, runes;
int str_type = R_STRING_TYPE_DETECT;
// if lis... | --- vulnerable
+++ patched
@@ -69,19 +69,19 @@
free (charset);
RConsIsBreaked is_breaked = (bin && bin->consb.is_breaked)? bin->consb.is_breaked: NULL;
// may oobread
- while (needle < to) {
+ while (needle < to && needle < UT64_MAX - 4) {
if (is_breaked && is_breaked ()) {
break;
}
// smol optimizat... | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... |
CVE-2017-13053 | static int
decode_rt_routing_info(netdissect_options *ndo,
const u_char *pptr, char *buf, u_int buflen)
{
uint8_t route_target[8];
u_int plen;
ND_TCHECK(pptr[0]);
plen = pptr[0]; /* get prefix length */
if (0 == plen) {
snprintf(buf, buflen, "default route target");
return 1;
}
if... | --- vulnerable
+++ patched
@@ -4,11 +4,18 @@
{
uint8_t route_target[8];
u_int plen;
+ char asbuf[sizeof(astostr)]; /* bgp_vpn_rd_print() overwrites astostr */
+ /* NLRI "prefix length" from RFC 2858 Section 4. */
ND_TCHECK(pptr[0]);
plen = pptr[0]; /* get prefix length */
+ /* NLRI "prefix" (ibid), valid... | CVE-2017-13689 | static const u_char *
ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
const struct isakmp_gen *ext, u_int item_len,
const u_char *ep _U_, uint32_t phase, uint32_t doi _U_,
uint32_t proto _U_, int depth _U_)
{
#define USE_IPSECDOI_IN_PHASE1 1
const struct ikev1_pl_id *p;
struct ikev1_p... | --- vulnerable
+++ patched
@@ -110,8 +110,8 @@
case IPSECDOI_ID_IPV6_ADDR_SUBNET:
{
const u_char *mask;
- if (len < 20)
- ND_PRINT((ndo," len=%d [bad: < 20]", len));
+ if (len < 32)
+ ND_PRINT((ndo," len=%d [bad: < 32]", len));
else {
mask = (const u_char *)(data + sizeof(struct in6_add... | CVE-2022-36042 | static RzDyldRebaseInfos *get_rebase_infos(RzDyldCache *cache) {
RzDyldRebaseInfos *result = RZ_NEW0(RzDyldRebaseInfos);
if (!result) {
return NULL;
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
ut32 total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
for (i = 0; i < cach... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
- ut32 total_slide_infos = 0;
+ size_t total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
@@ -14,7 +14,12 @@
if (!rz_buf_read_le32_at(cache->buf, 0x13c + hdr_offset, &n_slide_inf... | static int
decode_rt_routing_info(netdissect_options *ndo,
const u_char *pptr, char *buf, u_int buflen)
{
uint8_t route_target[8];
u_int plen;
char asbuf[sizeof(astostr)]; /* bgp_vpn_rd_print() overwrites astostr */
/* NLRI "prefix length" from RFC 2858 Section 4. */
ND_TCHECK(pptr[0]);
pl... |
CVE-2016-7151 | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
unsigned int mid = ARR_... | --- vulnerable
+++ patched
@@ -3,9 +3,10 @@
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
+ static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
- ... | CVE-2022-0407 | static int
yank_copy_line(struct block_def *bd, long y_idx, int exclude_trailing_space)
{
char_u *pnew;
if (exclude_trailing_space)
bd->endspaces = 0;
if ((pnew = alloc(bd->startspaces + bd->endspaces + bd->textlen + 1))
== NULL)
return FAIL;
y_current->y_array[y_idx] = pnew;
vim_me... | --- vulnerable
+++ patched
@@ -19,7 +19,7 @@
{
int s = bd->textlen + bd->endspaces;
- while (VIM_ISWHITE(*(bd->textstart + s - 1)) && s > 0)
+ while (s > 0 && VIM_ISWHITE(*(bd->textstart + s - 1)))
{
s = s - (*mb_head_off)(bd->textstart, bd->textstart + s - 1) - 1;
pnew--; | CVE-2016-7515 | static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define SkipLinesOp 0x01
#define SetColorOp 0x02
#define SkipPixelsOp 0x03
#define ByteDataOp 0x05
#define RunDataOp 0x06
#define EOFOp 0x07
char
magick[12];
Image
*image;
int
opcode,
operand,
status;
... | --- vulnerable
+++ patched
@@ -47,6 +47,7 @@
map_length,
number_colormaps,
number_planes,
+ number_planes_filled,
one,
offset,
pixel_info_length;
@@ -182,9 +183,12 @@
if (image->alpha_trait != UndefinedPixelTrait)
number_planes++;
number_pixels=(MagickSizeType) image->c... | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_r... |
CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2017-14608 | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... | --- vulnerable
+++ patched
@@ -13,8 +13,15 @@
len = MIN (256, width-col);
ret = kodak_65000_decode (buf, len);
for (i=0; i < len; i++)
- if ((RAW(row,col+i) = curve[ret ? buf[i] :
- (pred[i & 1] += buf[i])]) >> 12) derror();
+ {
+ int idx = ret ? buf[i] : (pred[i & 1] += buf[i]);
+ if(idx >=0... | CVE-2016-7134 | #if LIBCURL_VERSION_NUM > 0x070f03 /* 7.15.4 */
/* {{{ proto void curl_escape(resource ch, string str)
URL encodes the given string */
PHP_FUNCTION(curl_escape)
{
char *str = NULL, *res = NULL;
size_t str_len = 0;
zval *zid;
php_curl *ch;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z... | --- vulnerable
+++ patched
@@ -4,7 +4,7 @@
PHP_FUNCTION(curl_escape)
{
char *str = NULL, *res = NULL;
- size_t str_len = 0;
+ size_t str_len = 0;
zval *zid;
php_curl *ch;
@@ -16,6 +16,10 @@
RETURN_FALSE;
}
+ if (ZEND_SIZE_T_INT_OVFL(str_len)) {
+ RETURN_FALSE;
+ }
+
if ((res... | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... |
CVE-2013-4244 | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
*(*fill)++ = suffix[code];
firstchar = oldcode =... | --- vulnerable
+++ patched
@@ -13,6 +13,10 @@
}
if (oldcode == -1) {
+ if (code >= clear) {
+ fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
+ return 0;
+ }
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1; | CVE-2022-23592 | void Node::RunForwardTypeInference() {
VLOG(4) << "Forward type inference: " << props_->node_def.DebugString();
if (props_->fwd_type_fn == nullptr) {
return;
}
std::vector<Node*> input_nodes(props_->input_types.size(), nullptr);
std::vector<int> input_idx(props_->input_types.size(), 0);
for (const aut... | --- vulnerable
+++ patched
@@ -38,10 +38,16 @@
const auto& node_t = node->def().experimental_type();
if (node_t.type_id() != TFT_UNSET) {
int ix = input_idx[i];
- DCHECK(ix < node_t.args_size())
- << "input " << i << " should have an output " << ix
- << " but instead ... | CVE-2024-6563 | static int32_t check_load_area(uintptr_t dst, uintptr_t len)
{
uint32_t legacy = dst + len <= UINT32_MAX - 1 ? 1 : 0;
uintptr_t dram_start, dram_end;
uintptr_t prot_start, prot_end;
int32_t result = IO_SUCCESS;
dram_start = legacy ? DRAM1_NS_BASE : DRAM_40BIT_BASE;
dram_end = legacy ? DRAM1_NS_BASE + DRAM1_NS_S... | --- vulnerable
+++ patched
@@ -24,21 +24,21 @@
if (dst >= prot_start && dst < prot_end) {
ERROR("BL2: dst address is on the protected area.\n");
result = IO_FAIL;
+ goto done;
}
if ((dst < prot_start && dst > prot_start - len) || prot_start < len) {
ERROR("BL2: loaded data is on the protected area.\n"... | int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1) {
if (code >= clear) {
fprintf(s... |
CVE-2017-12902 | static const char *
parse_field(netdissect_options *ndo, const char **pptr, int *len)
{
const char *s;
if (*len <= 0 || !pptr || !*pptr)
return NULL;
if (*pptr > (const char *) ndo->ndo_snapend)
return NULL;
s = *pptr;
while (*pptr <= (const char *) ndo->ndo_snapend && *len >= 0 && **pptr) {
(*... | --- vulnerable
+++ patched
@@ -1,21 +1,31 @@
static const char *
-parse_field(netdissect_options *ndo, const char **pptr, int *len)
+parse_field(netdissect_options *ndo, const char **pptr, int *len, int *truncated)
{
const char *s;
- if (*len <= 0 || !pptr || !*pptr)
- return NULL;
- if (*pptr > (const c... | CVE-2022-23537 | /*
* Parse incoming packet into STUN message.
*/
PJ_DEF(pj_status_t) pj_stun_msg_decode(pj_pool_t *pool,
const pj_uint8_t *pdu,
pj_size_t pdu_len,
unsigned options,
... | --- vulnerable
+++ patched
@@ -31,6 +31,14 @@
status = pj_stun_msg_check(pdu, pdu_len, options);
if (status != PJ_SUCCESS)
return status;
+ } else {
+ /* For safety, verify packet length at least */
+ pj_uint32_t msg_len = GETVAL16H(pdu, 2) + 20;
+ if (msg_len > pd... | CVE-2016-7529 | static MagickBooleanType load_tile(Image *image,Image *tile_image,
XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length,
ExceptionInfo *exception)
{
ssize_t
y;
register ssize_t
x;
register Quantum
*q;
ssize_t
count;
unsigned char
*graydata;
XCFPixelInfo
*xcfdat... | --- vulnerable
+++ patched
@@ -21,7 +21,8 @@
*xcfdata,
*xcfodata;
- xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(data_length,sizeof(*xcfdata));
+ xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(MagickMax(data_length,
+ tile_image->columns*tile_image->rows),sizeof(*xcfdata));
if (xcfdata == (XCFPixelI... | static const char *
parse_field(netdissect_options *ndo, const char **pptr, int *len, int *truncated)
{
const char *s;
/* Start of string */
s = *pptr;
/* Scan for the NUL terminator */
for (;;) {
if (*len == 0) {
/* Ran out of packet data without finding it */
return NULL;
}
if (!ND_T... |
CVE-2017-6802 | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
ALLOCCHECK_CHAR(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);
out = comp_Prebuf.size;
- while (out < (comp_Prebuf.size + uncompressedSize)) {
+ while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {
// each flag byte fl... | CVE-2022-28069 | static int vax_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
op->size = 1;
if (len < 1) {
return -1;
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
switch (buf[0]) {
case 0x04:
op->type = R_ANAL_OP_TYPE_RET;
break;
case 0x2e:
op->type = R_ANAL_OP_TYPE_MOV;
op-... | --- vulnerable
+++ patched
@@ -137,7 +137,7 @@
case 0xfb: // calls
op->type = R_ANAL_OP_TYPE_CALL;
op->size = 7;
- {
+ if (len > 6) {
int oa = 3;
ut32 delta = buf[oa];
delta |= (ut32)(buf[oa + 1]) << 8; | CVE-2022-1927 | int
parse_cmd_address(exarg_T *eap, char **errormsg, int silent)
{
int address_count = 1;
linenr_T lnum;
// Repeat for all ',' or ';' separated addresses.
for (;;)
{
eap->line1 = eap->line2;
eap->line2 = default_address(eap);
eap->cmd = skipwhite(eap->cmd);
lnum = get_address(eap, &eap->cmd, e... | --- vulnerable
+++ patched
@@ -3,6 +3,8 @@
{
int address_count = 1;
linenr_T lnum;
+ int need_check_cursor = FALSE;
+ int ret = FAIL;
// Repeat for all ',' or ';' separated addresses.
for (;;)
@@ -13,7 +15,7 @@
lnum = get_address(eap, &eap->cmd, eap->addr_type, eap->skip, silent,
... | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... |
CVE-2022-4603 | void
dumpppp(f)
FILE *f;
{
int c, n, k;
int nb, nl, dn, proto, rv;
char *dir, *q;
unsigned char *p, *r, *endp;
unsigned char *d;
unsigned short fcs;
struct pkt *pkt;
spkt.cnt = rpkt.cnt = 0;
spkt.esc = rpkt.esc = 0;
while ((c = getc(f)) != EOF) {
switch (c) {
case 1:
case... | --- vulnerable
+++ patched
@@ -40,6 +40,10 @@
q = dir;
if (pkt->esc) {
printf("%s aborted packet:\n ", dir);
+ q = " ";
+ }
+ if (pkt->cnt >= sizeof(pkt->buf)) {
+ printf("%s over-long packet truncated:\n ", dir);
q = " ";
}
nb = pkt->cnt;
@@ -145,7 +149,8 @... | CVE-2023-0818 | char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32)... | --- vulnerable
+++ patched
@@ -15,18 +15,24 @@
if (!unicode_type && (szLine[i] & 0x80)) {
/*non UTF8 (likely some win-CP)*/
if ((szLine[i+1] & 0xc0) != 0x80) {
+ if (j >= GF_ARRAY_LENGTH(szLineConv))
+ break;
szLineConv[j] = 0xc0 | ( (szLine[i] >> 6) & 0x3 );
j++;
szLine[i] &= 0... | CVE-2016-5735 | static pngquant_error rwpng_read_image24_libpng(FILE *infile, png24_image *mainprog_ptr, int verbose)
{
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
png_size_t rowbytes;
int color_type, bit_depth;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,
r... | --- vulnerable
+++ patched
@@ -46,12 +46,6 @@
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, &mainprog_ptr->height,
&bit_depth, &color_type, NULL, NULL, NULL);
-
- // For overflow safety reject images that won't fit in 32-bit
- if (mainprog_ptr->width > INT_MAX/mainprog_ptr->height... | void
dumpppp(f)
FILE *f;
{
int c, n, k;
int nb, nl, dn, proto, rv;
char *dir, *q;
unsigned char *p, *r, *endp;
unsigned char *d;
unsigned short fcs;
struct pkt *pkt;
spkt.cnt = rpkt.cnt = 0;
spkt.esc = rpkt.esc = 0;
while ((c = getc(f)) != EOF) {
switch (c) {
case 1:
case... |
CVE-2022-1207 | static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int opsize = -1;
op->type = -1;
opsize = 2;
switch (buf[0]) {
case 0x3f:
case 0x4f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 4;
break;
case 0x6f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 6;
break;
case 0x7... | --- vulnerable
+++ patched
@@ -2,6 +2,9 @@
int opsize = -1;
op->type = -1;
opsize = 2;
+ if (len < 1) {
+ return -1;
+ }
switch (buf[0]) {
case 0x3f:
case 0x4f:
@@ -16,9 +19,9 @@
op->type = R_ANAL_OP_TYPE_LEA;
if (len > 5) {
op->ptr = buf[2];
- op->ptr |= buf[3]<<8;
- op->ptr |= buf[4]<<16;
-... | CVE-2022-31001 | sip_method_t sip_method_d(char **ss, char const **return_name)
{
char *s = *ss, c = *s;
char const *name;
int code = sip_method_unknown;
size_t n = 0;
#define MATCH(s, m) (strncmp(s, m, n = sizeof(m) - 1) == 0)
switch (c) {
case 'A': if (MATCH(s, "ACK")) code = sip_method_ack; break;
case 'B': if (MATCH... | --- vulnerable
+++ patched
@@ -45,6 +45,10 @@
#undef MATCH
+ if (strlen(s) < n) {
+ return sip_method_invalid;
+ }
+
if (IS_NON_WS(s[n]))
/* Unknown method */
code = sip_method_unknown; | CVE-2016-4478 | void xmlrpc_char_encode(char *outbuffer, const char *s1)
{
long unsigned int i;
unsigned char c;
char buf2[15];
mowgli_string_t *s = mowgli_string_create();
*buf2 = '\0';
*outbuffer = '\0';
if ((!(s1) || (*(s1) == '\0')))
{
return;
}
for (i = 0; s1[i] != '\0'; i++)
{
c = s1[i];
if (c > 127)
{
sn... | --- vulnerable
+++ patched
@@ -41,6 +41,7 @@
s->append_char(s, c);
}
}
+ s->append_char(s, 0);
- memcpy(outbuffer, s->str, XMLRPC_BUFSIZE);
+ strncpy(outbuffer, s->str, XMLRPC_BUFSIZE);
} | static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int opsize = -1;
op->type = -1;
opsize = 2;
if (len < 1) {
return -1;
}
switch (buf[0]) {
case 0x3f:
case 0x4f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 4;
break;
case 0x6f:
op->type = R_ANAL_OP_TYPE_MOV;
... |
CVE-2023-0817 | GF_Err mhas_dmx_process(GF_Filter *filter)
{
GF_MHASDmxCtx *ctx = gf_filter_get_udta(filter);
GF_FilterPacket *in_pck;
u8 *output;
u8 *start;
Bool final_flush=GF_FALSE;
u32 pck_size, remain, prev_pck_size;
u64 cts = GF_FILTER_NO_TS;
u32 au_start = 0;
u32 consumed = 0;
u32 nb_trunc_samples = 0;
Bool trunc_fro... | --- vulnerable
+++ patched
@@ -170,7 +170,7 @@
u32 idx = gf_bs_read_int(ctx->bs, 5);
if (idx==0x1f)
sr = gf_bs_read_int(ctx->bs, 24);
- else if (sr < nb_usac_sr) {
+ else if (idx < nb_usac_sr) {
sr = USACSampleRates[idx];
}
ctx->nb_unknown_pck = 0; | CVE-2023-0841 | GF_Err mp3_dmx_process(GF_Filter *filter)
{
GF_MP3DmxCtx *ctx = gf_filter_get_udta(filter);
GF_FilterPacket *pck, *dst_pck;
Bool is_eos=GF_FALSE;
u8 *data, *output;
u8 *start;
u32 pck_size, remain, prev_pck_size;
u64 cts = GF_FILTER_NO_TS;
//always reparse duration
if (!ctx->duration.num)
mp3_dmx_check_dur(... | --- vulnerable
+++ patched
@@ -173,8 +173,8 @@
}
if (!ctx->in_seek) {
- if (size > remain) {
- GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[MP3Dmx] truncated frame of size %u (remains %u)\n", size, remain));
+ if (bytes_skipped + size > remain) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[MP3Dmx] truncated ... | CVE-2025-48964 | int gather_statistics(struct ping_rts *rts, uint8_t *icmph, int icmplen,
int cc, uint16_t seq, int hops,
int csfailed, struct timeval *tv, char *from,
void (*pr_reply)(uint8_t *icmph, int cc), int multicast,
int wrong_source)
{
int dupflag = 0;
long triptime = 0;
uint8_t *ptr = icmph ... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
if (triptime > rts->tmax)
rts->tmax = triptime;
if (!rts->rtt)
- rts->rtt = triptime * 8;
+ rts->rtt = ((uint64_t)triptime) * 8;
else
rts->rtt += triptime - rts->rtt / 8;
if (rts->opt_adaptive) | GF_Err mhas_dmx_process(GF_Filter *filter)
{
GF_MHASDmxCtx *ctx = gf_filter_get_udta(filter);
GF_FilterPacket *in_pck;
u8 *output;
u8 *start;
Bool final_flush=GF_FALSE;
u32 pck_size, remain, prev_pck_size;
u64 cts = GF_FILTER_NO_TS;
u32 au_start = 0;
u32 consumed = 0;
u32 nb_trunc_samples = 0;
Bool trunc_fro... |
CVE-2016-7151 | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
unsigned int mid = ARR_... | --- vulnerable
+++ patched
@@ -3,9 +3,10 @@
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
+ static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
- ... | CVE-2016-7915 | static void hid_input_field(struct hid_device *hid, struct hid_field *field,
__u8 *data, int interrupt)
{
unsigned n;
unsigned count = field->report_count;
unsigned offset = field->report_offset;
unsigned size = field->report_size;
__s32 min = field->logical_minimum;
__s32 max = field->logical_maximum;
__... | --- vulnerable
+++ patched
@@ -23,6 +23,7 @@
/* Ignore report if ErrorRollOver */
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
value[n] >= min && value[n] <= max &&
+ value[n] - min < field->maxusage &&
field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
goto exit;
}
@@ -35,11 +36... | CVE-2013-7459 | static ALGobject *
ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
{
unsigned char *key, *IV;
ALGobject * new=NULL;
int keylen, IVlen=0, mode=MODE_ECB, segment_size=0;
PyObject *counter = NULL;
int counter_shortcut = 0;
#ifdef PCT_ARC2_MODULE
int effective_keylen = 1024; /* this is a weird defa... | --- vulnerable
+++ patched
@@ -48,6 +48,17 @@
{
PyErr_SetString(PyExc_ValueError,
"Key cannot be the null string");
+ return NULL;
+ }
+ if (IVlen != 0 && mode == MODE_ECB)
+ {
+ PyErr_Format(PyExc_ValueError, "ECB mode does not use IV");
+ return NULL;
+ }
+ if (IVlen != 0 && mode == MODE_CTR)
+ {
+ PyEr... | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_r... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2022-0631 | mrb_value
mrb_f_send(mrb_state *mrb, mrb_value self)
{
mrb_sym name;
mrb_value block, *regs;
mrb_method_t m;
struct RClass *c;
mrb_callinfo *ci = mrb->c->ci;
int n = ci->n;
if (ci->cci > CINFO_NONE) {
funcall:;
const mrb_value *argv;
mrb_int argc;
mrb_get_args(mrb, "n*&", &name, &argv, &arg... | --- vulnerable
+++ patched
@@ -19,9 +19,11 @@
regs = mrb->c->ci->stack+1;
if (n == 0) {
+ argnum_error:
mrb_argnum_error(mrb, 0, 1, -1);
}
else if (n == 15) {
+ if (RARRAY_LEN(regs[0]) == 0) goto argnum_error;
name = mrb_obj_to_sym(mrb, RARRAY_PTR(regs[0])[0]);
}
else { | CVE-2016-9538 | static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
uint32 width, uint16 spp,
struct dump_opts *dump)
{
int i, j, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
int32 bytes_read = 0;
uint1... | --- vulnerable
+++ patched
@@ -2,9 +2,12 @@
uint32 width, uint16 spp,
struct dump_opts *dump)
{
- int i, j, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
+ int i, bytes_per_sample, bytes_per_pixel, shift_width, result... | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2022-0522 | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... | --- vulnerable
+++ patched
@@ -23,7 +23,6 @@
shift -= 64;
regc = "h";
}
-
if (shift > 0 && shift < 64) {
r_strbuf_appendf (sb, "%d,SWAP,0x%"PFMT64x",&,<<,%s%s,0x%"PFMT64x",&,|,%s%s",
shift, mask, REG64 (n), regc, VEC64_MASK (shift, size), REG64 (n), regc); | CVE-2024-37407 | static int
slurp_central_directory(struct archive_read *a, struct archive_entry* entry,
struct zip *zip)
{
ssize_t i;
unsigned found;
int64_t correction;
ssize_t bytes_avail;
const char *p;
/*
* Find the start of the central directory. The end-of-CD
* record has our starting point, but there are lots of... | --- vulnerable
+++ patched
@@ -197,7 +197,7 @@
* as the actual resource fork doesn't end with '/'.
*/
size_t tmp_length = filename_length;
- if (name[tmp_length - 1] == '/') {
+ if (tmp_length > 0 && name[tmp_length - 1] == '/') {
tmp_length--;
r = rsrc_basename(name, tmp_length);
... | CVE-2024-35369 | static int parse_speex_extradata(AVCodecContext *avctx,
const uint8_t *extradata, int extradata_size)
{
SpeexContext *s = avctx->priv_data;
const uint8_t *buf = av_strnstr(extradata, "Speex ", extradata_size);
if (!buf)
return AVERROR_INVALIDDATA;
buf += 28;
s->version_id = bytestre... | --- vulnerable
+++ patched
@@ -25,9 +25,10 @@
return AVERROR_INVALIDDATA;
s->bitrate = bytestream_get_le32(&buf);
s->frame_size = bytestream_get_le32(&buf);
- if (s->frame_size < NB_FRAME_SIZE << (s->mode > 0))
+ if (s->frame_size < NB_FRAME_SIZE << (s->mode > 0) ||
+ s->frame_size > ... | static void vector64_dst_append(RStrBuf *sb, csh *handle, cs_insn *insn, int n, int i) {
cs_arm64_op op = INSOP64 (n);
if (op.vector_index != -1) {
i = op.vector_index;
}
#if CS_API_MAJOR == 4
const bool isvessas = (op.vess || op.vas);
#else
const bool isvessas = op.vas;
#endif
if (isvessas && i != -1) {
int... |
CVE-2016-7418 | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... | --- vulnerable
+++ patched
@@ -37,10 +37,10 @@
int i;
if (atts) for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && atts[i][0]) {
+ if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {
char tmp_buf[2];
- snprintf(tmp_buf, sizeof(tmp_buf), "%c", (char)strt... | CVE-2023-36271 | /** converts UTF-8 to UCS-2. Returns a copy.
TODO: unquote json_cquote as above.
*/
ATTRIBUTE_MALLOC
BITCODE_TU
bit_utf8_to_TU (char *restrict str, const unsigned cquoted)
{
BITCODE_TU wstr;
size_t i = 0;
size_t len = strlen (str);
unsigned char c;
if (len > 0xFFFE)
{
loglevel = 1;
LOG_W... | --- vulnerable
+++ patched
@@ -50,9 +50,11 @@
{
/* ignore invalid utf8 for now */
if (len >= 1)
- wstr[i++] = ((c & 0x1f) << 6) | (str[1] & 0x3f);
- len--;
- str++;
+ {
+ wstr[i++] = ((c & 0x1f) << 6) | (str[1] & 0x3f);
+ l... | CVE-2022-0570 | static int
gen_values(codegen_scope *s, node *t, int val, int limit)
{
int n = 0;
int first = 1;
int slimit = GEN_VAL_STACK_MAX;
if (limit == 0) limit = GEN_LIT_ARY_MAX;
if (cursp() >= slimit) slimit = INT16_MAX;
if (!val) {
while (t) {
codegen(s, t->car, NOVAL);
n++;
t = t->cdr;
... | --- vulnerable
+++ patched
@@ -20,7 +20,7 @@
while (t) {
int is_splat = nint(t->car->car) == NODE_SPLAT;
- if (is_splat || n > limit || cursp() >= slimit) { /* flush stack */
+ if (is_splat || cursp() >= slimit) { /* flush stack */
pop_n(n);
if (first) {
if (n == 0) {
@@ -59,5 +59... | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... |
CVE-2017-13035 | static char *
isis_print_id(const uint8_t *cp, int id_len)
{
int i;
static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
char *pos = id;
for (i = 1; i <= SYSTEM_ID_LEN; i++) {
snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++);
pos += strlen(pos);
if (i == 2 || i == 4)
*pos++ = '.';
}
... | --- vulnerable
+++ patched
@@ -4,8 +4,12 @@
int i;
static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
char *pos = id;
+ int sysid_len;
- for (i = 1; i <= SYSTEM_ID_LEN; i++) {
+ sysid_len = SYSTEM_ID_LEN;
+ if (sysid_len > id_len)
+ sysid_len = id_len;
+ for (i = 1; i <= sysid_len; i... | CVE-2023-33659 | uint8_t *
copyn_str(const uint8_t *src, uint32_t *pos, int *str_len, int limit)
{
*str_len = 0;
uint8_t *dest = NULL;
if (!src || !pos) {
*str_len = 0;
return NULL;
}
NNI_GET16(src + (*pos), *str_len);
*pos = (*pos) + 2;
if (*str_len > (limit-2)) {
//buffer overflow
*str_len = -1;
}
if (*str_le... | --- vulnerable
+++ patched
@@ -4,7 +4,7 @@
*str_len = 0;
uint8_t *dest = NULL;
- if (!src || !pos) {
+ if (!src || !pos || limit < 2) {
*str_len = 0;
return NULL;
} | CVE-2022-36015 | template <typename T>
Status RangeSize(const Tensor* start_t, const Tensor* limit_t,
const Tensor* delta_t, InferenceContext* const c) {
T start = start_t->scalar<T>()();
T limit = limit_t->scalar<T>()();
T delta = delta_t->scalar<T>()();
if (start > limit && delta > T(0)) {
return errors::... | --- vulnerable
+++ patched
@@ -16,17 +16,18 @@
return errors::InvalidArgument("Requires delta != 0");
}
- auto size = (std::is_integral<T>::value
- ? ((Eigen::numext::abs(limit - start) +
- Eigen::numext::abs(delta) - T(1)) /
- Eigen::numext::abs(d... | static char *
isis_print_id(const uint8_t *cp, int id_len)
{
int i;
static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
char *pos = id;
int sysid_len;
sysid_len = SYSTEM_ID_LEN;
if (sysid_len > id_len)
sysid_len = id_len;
for (i = 1; i <= sysid_len; i++) {
snprintf(pos, sizeof(i... |
CVE-2017-14608 | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... | --- vulnerable
+++ patched
@@ -13,8 +13,15 @@
len = MIN (256, width-col);
ret = kodak_65000_decode (buf, len);
for (i=0; i < len; i++)
- if ((RAW(row,col+i) = curve[ret ? buf[i] :
- (pred[i & 1] += buf[i])]) >> 12) derror();
+ {
+ int idx = ret ? buf[i] : (pred[i & 1] += buf[i]);
+ if(idx >=0... | CVE-2023-4778 | char *gf_bt_get_next(GF_BTParser *parser, Bool point_break)
{
u32 has_quote;
Bool go = 1;
s32 i;
gf_bt_check_line(parser);
i=0;
has_quote = 0;
while (go) {
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
if (parser-... | --- vulnerable
+++ patched
@@ -7,12 +7,12 @@
i=0;
has_quote = 0;
while (go) {
+ if (parser->line_pos+i>=parser->line_size) break;
+
if (parser->line_buffer[parser->line_pos + i] == '\"') {
if (!has_quote) has_quote = 1;
else has_quote = 0;
parser->line_pos += 1;
-
- if (parser->line_pos+i==parse... | CVE-2024-36618 | static int check_stream_max_drift(AVFormatContext *s)
{
int64_t min_pos, pos;
int i;
int *idx = av_calloc(s->nb_streams, sizeof(*idx));
if (!idx)
return AVERROR(ENOMEM);
for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) {
int64_t max_dts = INT64_MIN / 2;
int6... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
int *idx = av_calloc(s->nb_streams, sizeof(*idx));
if (!idx)
return AVERROR(ENOMEM);
- for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) {
+ for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1ULL) {
int64_t max_dts... | void CLASS kodak_65000_load_raw()
{
short buf[256];
int row, col, len, pred[2], ret, i;
for (row=0; row < height; row++)
{
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
for (col=0; col < width; col+=256) {
pred[0] = pred[1] = 0;
len = MIN (256, width-col);
ret = kodak_65000_decode... |
CVE-2022-1714 | static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int ret;
struct msp430_cmd cmd;
memset (&cmd, 0, sizeof (cmd));
//op->id = ???;
op->size = -1;
op->nopcode = 1;
op->type = R_ANAL_OP_TYPE_UNK;
op->family = R_ANAL_OP_FAMILY_CPU;
ret = op->size = msp430_deco... | --- vulnerable
+++ patched
@@ -1,15 +1,11 @@
static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
- int ret;
- struct msp430_cmd cmd;
-
- memset (&cmd, 0, sizeof (cmd));
- //op->id = ???;
+ struct msp430_cmd cmd = {0};
op->size = -1;
op->nopcode = 1;
op->type = R... | CVE-2022-1733 | static char_u *
skip_string(char_u *p)
{
int i;
// We loop, because strings may be concatenated: "date""time".
for ( ; ; ++p)
{
if (p[0] == '\'') // 'c' or '\n' or '\000'
{
if (p[1] == NUL) // ' at end of line
break;
i = 2;
if (p[1] == '\\' && p[2] != NUL) // '\n' or... | --- vulnerable
+++ patched
@@ -17,7 +17,7 @@
while (vim_isdigit(p[i - 1])) // '\000'
++i;
}
- if (p[i] == '\'') // check for trailing '
+ if (p[i - 1] != NUL && p[i] == '\'') // check for trailing '
{
p += i;
continue; | CVE-2022-34835 | static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
uint chip;
uint addr, length;
int alen;
int j, nbytes, linebytes;
int ret;
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *dev;
#endif
/* We use the last specified parameters, unless new ones are
* entered.
*/
chip ... | --- vulnerable
+++ patched
@@ -3,8 +3,8 @@
{
uint chip;
uint addr, length;
- int alen;
- int j, nbytes, linebytes;
+ uint alen;
+ uint j, nbytes, linebytes;
int ret;
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *dev; | static int msp430_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
struct msp430_cmd cmd = {0};
op->size = -1;
op->nopcode = 1;
op->type = R_ANAL_OP_TYPE_UNK;
op->family = R_ANAL_OP_FAMILY_CPU;
int ret = op->size = msp430_decode_command (buf, len, &cmd);
if (mask & R_ANAL_OP_... |
CVE-2016-3178 | void processRequest(struct reqelem * req)
{
ssize_t n;
unsigned int l, m;
unsigned char buf[2048];
const unsigned char * p;
enum request_type type;
struct device * d = devlist;
unsigned char rbuf[RESPONSE_BUFFER_SIZE];
unsigned char * rp;
unsigned char nrep = 0;
time_t t;
struct service * newserv = NULL;
st... | --- vulnerable
+++ patched
@@ -28,7 +28,7 @@
type = buf[0];
p = buf + 1;
DECODELENGTH_CHECKLIMIT(l, p, buf + n);
- if(p+l > buf+n) {
+ if(l > (unsigned)(buf+n-p)) {
syslog(LOG_WARNING, "bad request (length encoding l=%u n=%u)",
l, (unsigned)n);
goto error;
@@ -150,7 +150,7 @@
goto error;
}
... | CVE-2025-30404 | * MemoryAllocator allocator(100, memory_pool)
* // Pass allocator object in the Executor
*
* Underneath the hood, ExecuTorch will call
* allocator.allocate() to keep iterating cur_ pointer
*/
class MemoryAllocator {
public:
/**
* Default alignment of memory returned by this class. Ensures that point... | --- vulnerable
+++ patched
@@ -51,7 +51,7 @@
// If the end of this allocation exceeds the end of this allocator, print
// error messages and return nullptr
- if (end > end_) {
+ if (end > end_ || end < start) {
ET_LOG(
Error,
"Memory allocation failed: %zuB requested (adju... | CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | void processRequest(struct reqelem * req)
{
ssize_t n;
unsigned int l, m;
unsigned char buf[2048];
const unsigned char * p;
enum request_type type;
struct device * d = devlist;
unsigned char rbuf[RESPONSE_BUFFER_SIZE];
unsigned char * rp;
unsigned char nrep = 0;
time_t t;
struct service * newserv = NULL;
st... |
CVE-2017-6802 | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... | --- vulnerable
+++ patched
@@ -52,7 +52,7 @@
ALLOCCHECK_CHAR(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);
out = comp_Prebuf.size;
- while (out < (comp_Prebuf.size + uncompressedSize)) {
+ while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {
// each flag byte fl... | CVE-2022-34033 | static int /* O - Current column */
write_node(FILE *out, /* I - Output file */
tree_t *t, /* I - Document tree node */
int col) /* I - Current column */
{
int i; /* Looping var */
uchar *ptr, /* Pointer to output string */
*entity, /* Entity string */
*src, /* Source image ... | --- vulnerable
+++ patched
@@ -25,7 +25,7 @@
for (ptr = t->data; *ptr; ptr ++)
fputs((char *)iso8859(*ptr), out);
- if (t->data[strlen((char *)t->data) - 1] == '\n')
+ if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
col = 0;
else
col += strlen(... | CVE-2022-0173 | R_API bool r_io_bank_map_add_top(RIO *io, const ut32 bankid, const ut32 mapid) {
RIOBank *bank = r_io_bank_get (io, bankid);
RIOMap *map = r_io_map_get (io, mapid);
r_return_val_if_fail (io && bank && map, false);
RIOMapRef *mapref = _mapref_from_map (map);
if (!mapref) {
return false;
}
RIOSubMap *sm = r_io_s... | --- vulnerable
+++ patched
@@ -72,7 +72,10 @@
//delete all submaps that are completly included in sm
RRBNode *next = r_rbnode_next (entry);
// this can be optimized, there is no need to do search here
- r_crbtree_delete (bank->submaps, entry->data, _find_sm_by_from_vaddr_cb, NULL);
+ bool a = r_crbtree_delet... | BYTE *DecompressRTF(variableLength *p, int *size) {
BYTE *dst; // destination for uncompressed bytes
BYTE *src;
unsigned int in;
unsigned int out;
variableLength comp_Prebuf;
ULONG compressedSize, uncompressedSize, magic;
comp_Prebuf.size = strlen(RTF_PREBUF);
comp_Prebuf.data = calloc(comp_Prebuf.size... |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2017-13024 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -53,6 +53,8 @@
ND_PRINT((ndo, "(ni: trunc)"));
goto trunc;
}
+ ND_TCHECK_16BITS(&bp[i+2]);
+ ND_TCHECK_16BITS(&bp[i+4]);
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
EXTRACT_16BITS(&bp[i+2]),
EXTRACT_16BITS(&bp[i+4]))); | CVE-2017-6419 | void lzxd_free(struct lzxd_stream *lzx) {
struct mspack_system *sys;
if (lzx) {
sys = lzx->sys;
sys->free(lzx->inbuf);
sys->free(lzx->window);
sys->free(lzx);
}
} | --- vulnerable
+++ patched
@@ -2,8 +2,10 @@
struct mspack_system *sys;
if (lzx) {
sys = lzx->sys;
- sys->free(lzx->inbuf);
- sys->free(lzx->window);
+ if(lzx->inbuf)
+ sys->free(lzx->inbuf);
+ if(lzx->window)
+ sys->free(lzx->window);
sys->free(lzx);
}
} | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2017-6418 | char *
messageFindArgument(const message *m, const char *variable)
{
int i;
size_t len;
assert(m != NULL);
assert(variable != NULL);
len = strlen(variable);
for(i = 0; i < m->numberOfArguments; i++) {
const char *ptr;
ptr = messageGetArgument(m, i);
if((ptr == NULL) || (*ptr == '\0'))
continue;
#ifde... | --- vulnerable
+++ patched
@@ -27,7 +27,7 @@
cli_dbgmsg("messageFindArgument: no '=' sign found in MIME header '%s' (%s)\n", variable, messageGetArgument(m, i));
return NULL;
}
- if((*++ptr == '"') && (strchr(&ptr[1], '"') != NULL)) {
+ if((strlen(ptr) > 2) && (*++ptr == '"') && (strchr(&ptr[1], '"') ... | CVE-2023-33660 | uint8_t *
copyn_str(const uint8_t *src, uint32_t *pos, int *str_len, int limit)
{
*str_len = 0;
uint8_t *dest = NULL;
if (!src || !pos) {
*str_len = 0;
return NULL;
}
NNI_GET16(src + (*pos), *str_len);
*pos = (*pos) + 2;
if (*str_len > (limit-2)) {
//buffer overflow
*str_len = -1;
}
if (*str_le... | --- vulnerable
+++ patched
@@ -4,7 +4,7 @@
*str_len = 0;
uint8_t *dest = NULL;
- if (!src || !pos) {
+ if (!src || !pos || limit < 2) {
*str_len = 0;
return NULL;
} | CVE-2016-7525 | static inline size_t GetPSDRowSize(Image *image)
{
if (image->depth == 1)
return((image->columns+7)/8);
else
return(image->columns*GetPSDPacketSize(image));
} | --- vulnerable
+++ patched
@@ -1,7 +1,7 @@
static inline size_t GetPSDRowSize(Image *image)
{
if (image->depth == 1)
- return((image->columns+7)/8);
+ return(((image->columns+7)/8)*GetPSDPacketSize(image));
else
return(image->columns*GetPSDPacketSize(image));
} | char *
messageFindArgument(const message *m, const char *variable)
{
int i;
size_t len;
assert(m != NULL);
assert(variable != NULL);
len = strlen(variable);
for(i = 0; i < m->numberOfArguments; i++) {
const char *ptr;
ptr = messageGetArgument(m, i);
if((ptr == NULL) || (*ptr == '\0'))
continue;
#ifde... |
CVE-2023-2838 | GF_EXPORT
GF_Err gf_filter_get_stats(GF_Filter *f, GF_FilterStats *stats)
{
u32 i;
Bool set_name=GF_FALSE;
if (!stats || !f) return GF_BAD_PARAM;
memset(stats, 0, sizeof(GF_FilterStats));
stats->filter = f;
stats->filter_alias = f->multi_sink_target;
if (f->multi_sink_target) return GF_OK;
stats->percent = f-... | --- vulnerable
+++ patched
@@ -74,6 +74,9 @@
if ((f->num_input_pids!=1) && f->num_output_pids)
continue;
+ if (!pidi->pid)
+ continue;
+
if (!stats->codecid)
stats->codecid = pidi->pid->codecid;
if (!stats->stream_type) | CVE-2023-47471 | void slice_segment_header::dump_slice_segment_header(const decoder_context* ctx, int fd) const
{
FILE* fh;
if (fd==1) fh=stdout;
else if (fd==2) fh=stderr;
else { return; }
#define LOG0(t) log2fh(fh, t)
#define LOG1(t,d) log2fh(fh, t,d)
#define LOG2(t,d1,d2) log2fh(fh, t,d1,d2)
#define LOG3(t,d1,d2,d3) log2fh(... | --- vulnerable
+++ patched
@@ -11,14 +11,23 @@
#define LOG3(t,d1,d2,d3) log2fh(fh, t,d1,d2,d3)
#define LOG4(t,d1,d2,d3,d4) log2fh(fh, t,d1,d2,d3,d4)
+ LOG0("----------------- SLICE -----------------\n");
+
const pic_parameter_set* pps = ctx->get_pps(slice_pic_parameter_set_id);
+ if (!pps) {
+ LOG0("invalid... | CVE-2017-16535 | int usb_get_bos_descriptor(struct usb_device *dev)
{
struct device *ddev = &dev->dev;
struct usb_bos_descriptor *bos;
struct usb_dev_cap_header *cap;
unsigned char *buffer;
int length, total_len, num, i;
int ret;
bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
if (!bos)
return -ENOMEM;
/* Get... | --- vulnerable
+++ patched
@@ -52,10 +52,12 @@
for (i = 0; i < num; i++) {
buffer += length;
cap = (struct usb_dev_cap_header *)buffer;
+
+ if (total_len < sizeof(*cap) || total_len < cap->bLength) {
+ dev->bos->desc->bNumDeviceCaps = i;
+ break;
+ }
length = cap->bLength;
-
- if (total_len < length)
... | GF_EXPORT
GF_Err gf_filter_get_stats(GF_Filter *f, GF_FilterStats *stats)
{
u32 i;
Bool set_name=GF_FALSE;
if (!stats || !f) return GF_BAD_PARAM;
memset(stats, 0, sizeof(GF_FilterStats));
stats->filter = f;
stats->filter_alias = f->multi_sink_target;
if (f->multi_sink_target) return GF_OK;
stats->percent = f-... |
CVE-2016-7151 | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
unsigned int mid = ARR_... | --- vulnerable
+++ patched
@@ -3,9 +3,10 @@
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
+ static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
- ... | CVE-2022-28069 | static int vax_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
op->size = 1;
if (len < 1) {
return -1;
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
switch (buf[0]) {
case 0x04:
op->type = R_ANAL_OP_TYPE_RET;
break;
case 0x2e:
op->type = R_ANAL_OP_TYPE_MOV;
op-... | --- vulnerable
+++ patched
@@ -137,7 +137,7 @@
case 0xfb: // calls
op->type = R_ANAL_OP_TYPE_CALL;
op->size = 7;
- {
+ if (len > 6) {
int oa = 3;
ut32 delta = buf[oa];
delta |= (ut32)(buf[oa + 1]) << 8; | CVE-2012-0044 | int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
struct drm_clip_rect __user *clips_ptr;
struct drm_clip_rect *clips = NULL;
struct drm_mode_fb_dirty_cmd *r = data;
struct drm_mode_object *obj;
struct drm_framebuffer *fb;
unsigned flags;
int num_clips;
int ret =... | --- vulnerable
+++ patched
@@ -39,6 +39,10 @@
}
if (num_clips && clips_ptr) {
+ if (num_clips < 0 || num_clips > DRM_MODE_FB_DIRTY_MAX_CLIPS) {
+ ret = -EINVAL;
+ goto out_err1;
+ }
clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL);
if (!clips) {
ret = -ENOMEM; | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_r... |
CVE-2017-12898 | static void
interp_reply(netdissect_options *ndo,
const struct sunrpc_msg *rp, uint32_t proc, uint32_t vers, int length)
{
register const uint32_t *dp;
register int v3;
int er;
v3 = (vers == NFS_VER3);
if (!v3 && proc < NFS_NPROCS)
proc = nfsv3_procid[proc];
ND_PRINT((ndo, " %s", tok2str(nfsproc... | --- vulnerable
+++ patched
@@ -69,8 +69,10 @@
ND_PRINT((ndo, " attr:"));
if (!(dp = parse_post_op_attr(ndo, dp, ndo->ndo_vflag)))
break;
- if (!er)
+ if (!er) {
+ ND_TCHECK(dp[0]);
ND_PRINT((ndo, " c %04x", EXTRACT_32BITS(&dp[0])));
+ }
return;
case NFSPROC_READLINK: | CVE-2017-13015 | void
eap_print(netdissect_options *ndo,
register const u_char *cp,
u_int length)
{
const struct eap_frame_t *eap;
const u_char *tptr;
u_int tlen, type, subtype;
int count=0, len;
tptr = cp;
tlen = length;
eap = (const struct eap_frame_t *)cp;
ND_TCHECK(*eap);
/*... | --- vulnerable
+++ patched
@@ -34,7 +34,9 @@
switch (eap->type) {
case EAP_FRAME_TYPE_PACKET:
+ ND_TCHECK_8BITS(tptr);
type = *(tptr);
+ ND_TCHECK_16BITS(tptr+2);
len = EXTRACT_16BITS(tptr+2);
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
tok2str(eap_cod... | CVE-2022-23567 | void Compute(OpKernelContext *ctx) override {
const Tensor *indices_t, *values_t, *shape_t, *dense_t;
OP_REQUIRES_OK(ctx, ctx->input("sp_indices", &indices_t));
OP_REQUIRES_OK(ctx, ctx->input("sp_values", &values_t));
OP_REQUIRES_OK(ctx, ctx->input("sp_shape", &shape_t));
OP_REQUIRES_OK(ctx, ctx->in... | --- vulnerable
+++ patched
@@ -39,7 +39,9 @@
const auto indices_mat = indices_t->matrix<int64_t>();
const auto shape_vec = shape_t->vec<int64_t>();
- const auto lhs_dims = BCast::FromShape(TensorShape(shape_vec));
+ TensorShape lhs_shape;
+ OP_REQUIRES_OK(ctx, TensorShape::BuildTensorShape(shape_ve... | static void
interp_reply(netdissect_options *ndo,
const struct sunrpc_msg *rp, uint32_t proc, uint32_t vers, int length)
{
register const uint32_t *dp;
register int v3;
int er;
v3 = (vers == NFS_VER3);
if (!v3 && proc < NFS_NPROCS)
proc = nfsv3_procid[proc];
ND_PRINT((ndo, " %s", tok2str(nfsproc... |
CVE-2017-13022 | static void
ip_printroute(netdissect_options *ndo,
register const u_char *cp, u_int length)
{
register u_int ptr;
register u_int len;
if (length < 3) {
ND_PRINT((ndo, " [bad length %u]", length));
return;
}
if ((length + 1) & 3)
ND_PRINT((ndo, " [bad length %u]", length));
ptr = cp[2] - 1;
i... | --- vulnerable
+++ patched
@@ -1,4 +1,4 @@
-static void
+static int
ip_printroute(netdissect_options *ndo,
register const u_char *cp, u_int length)
{
@@ -7,17 +7,23 @@
if (length < 3) {
ND_PRINT((ndo, " [bad length %u]", length));
- return;
+ return (0);
}
if ((length + 1) & 3)
ND_PRINT... | CVE-2022-1207 | static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) {
int opsize = -1;
op->type = -1;
opsize = 2;
switch (buf[0]) {
case 0x3f:
case 0x4f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 4;
break;
case 0x6f:
op->type = R_ANAL_OP_TYPE_MOV;
opsize = 6;
break;
case 0x7... | --- vulnerable
+++ patched
@@ -2,6 +2,9 @@
int opsize = -1;
op->type = -1;
opsize = 2;
+ if (len < 1) {
+ return -1;
+ }
switch (buf[0]) {
case 0x3f:
case 0x4f:
@@ -16,9 +19,9 @@
op->type = R_ANAL_OP_TYPE_LEA;
if (len > 5) {
op->ptr = buf[2];
- op->ptr |= buf[3]<<8;
- op->ptr |= buf[4]<<16;
-... | CVE-2022-36042 | static RzDyldRebaseInfos *get_rebase_infos(RzDyldCache *cache) {
RzDyldRebaseInfos *result = RZ_NEW0(RzDyldRebaseInfos);
if (!result) {
return NULL;
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
ut32 total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
for (i = 0; i < cach... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
}
if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) {
- ut32 total_slide_infos = 0;
+ size_t total_slide_infos = 0;
ut32 n_slide_infos[MAX_N_HDR];
ut32 i;
@@ -14,7 +14,12 @@
if (!rz_buf_read_le32_at(cache->buf, 0x13c + hdr_offset, &n_slide_inf... | static int
ip_printroute(netdissect_options *ndo,
register const u_char *cp, u_int length)
{
register u_int ptr;
register u_int len;
if (length < 3) {
ND_PRINT((ndo, " [bad length %u]", length));
return (0);
}
if ((length + 1) & 3)
ND_PRINT((ndo, " [bad length %u]", length));
ND_TCHECK(cp[2])... |
CVE-2016-7151 | // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
unsigned int mid = ARR_... | --- vulnerable
+++ patched
@@ -3,9 +3,10 @@
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
+ static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_regs_intel) - 1;
- ... | CVE-2022-2816 | /*
* Check if "name" can be "unlet".
*/
int
check_vim9_unlet(char_u *name)
{
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
// "unlet s:var" is allowed in legacy script.
if (*name == 's' && !script_is_vim9())
return OK;
semsg(_(e_cannot_unlet_str), name);
return FAIL;
}
... | --- vulnerable
+++ patched
@@ -4,6 +4,12 @@
int
check_vim9_unlet(char_u *name)
{
+ if (*name == NUL)
+ {
+ semsg(_(e_argument_required_for_str), "unlet");
+ return FAIL;
+ }
+
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
// "unlet s:var" is allowed in legacy script. | CVE-2023-48221 | int bundle_update(struct iflow *flow,
enum icall_conv_type conv_type,
bool include_audio,
const char *remote_sdp,
struct list *membl,
bundle_flow_update_h *flow_updateh)
{
struct sdp_media *sdpa = NULL;
struct sdp_media *sdpv = NULL;
char *grpstr;
int err = 0;
struct le *le;
struct sdp_session... | --- vulnerable
+++ patched
@@ -21,7 +21,7 @@
bundle.mid = 0;
bundle.mb = mbuf_alloc(128);
- mbuf_printf(bundle.mb, sdp_session_rattr(sess, "group"));
+ mbuf_printf(bundle.mb, "%s", sdp_session_rattr(sess, "group"));
list_flush((struct list *)sdp_session_medial(sess, true));
| // return register of given instruction id
// return 0 if not found
// this is to handle instructions embedding accumulate registers into AsmStrs[]
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
{
static bool intel_regs_sorted = false;
unsigned int first = 0;
unsigned int last = ARR_SIZE(insn_r... |
CVE-2022-47519 | static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch)
{
struct wilc_attr_entry *e;
struct wilc_attr_ch_list *ch_list;
struct wilc_attr_oper_ch *op_ch;
u32 index = 0;
u8 ch_list_idx = 0;
u8 op_ch_idx = 0;
if (sta_ch == WILC_INVALID_CHANNEL)
return;
while (index + sizeof(*e) <= len) {
e... | --- vulnerable
+++ patched
@@ -11,14 +11,24 @@
return;
while (index + sizeof(*e) <= len) {
+ u16 attr_size;
+
e = (struct wilc_attr_entry *)&buf[index];
+ attr_size = le16_to_cpu(e->attr_len);
+
+ if (index + sizeof(*e) + attr_size > len)
+ return;
+
if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST... | CVE-2022-47521 | static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch)
{
struct wilc_attr_entry *e;
struct wilc_attr_ch_list *ch_list;
struct wilc_attr_oper_ch *op_ch;
u32 index = 0;
u8 ch_list_idx = 0;
u8 op_ch_idx = 0;
if (sta_ch == WILC_INVALID_CHANNEL)
return;
while (index + sizeof(*e) <= len) {
u... | --- vulnerable
+++ patched
@@ -19,7 +19,8 @@
if (index + sizeof(*e) + attr_size > len)
return;
- if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST)
+ if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST &&
+ attr_size >= (sizeof(struct wilc_attr_ch_list) - sizeof(*e)))
ch_list_idx = index;
else ... | CVE-2022-4141 | void
do_window(
int nchar,
long Prenum,
int xchar) // extra char from ":wincmd gx" or NUL
{
long Prenum1;
win_T *wp;
char_u *ptr;
linenr_T lnum = -1;
#ifdef FEAT_FIND_ID
int type = FIND_DEFINE;
int len;
#endif
char_u cbuf[40];
if (ERROR_IF_ANY_POPUP_WINDOW)
retur... | --- vulnerable
+++ patched
@@ -395,6 +395,8 @@
case Ctrl_F:
wingotofile:
CHECK_CMDWIN;
+ if (check_text_or_curbuf_locked(NULL))
+ break;
ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL) | static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch)
{
struct wilc_attr_entry *e;
struct wilc_attr_ch_list *ch_list;
struct wilc_attr_oper_ch *op_ch;
u32 index = 0;
u8 ch_list_idx = 0;
u8 op_ch_idx = 0;
if (sta_ch == WILC_INVALID_CHANNEL)
return;
while (index + sizeof(*e) <= len) {
u... |
CVE-2016-7418 | /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... | --- vulnerable
+++ patched
@@ -37,10 +37,10 @@
int i;
if (atts) for (i = 0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && atts[i][0]) {
+ if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {
char tmp_buf[2];
- snprintf(tmp_buf, sizeof(tmp_buf), "%c", (char)strt... | CVE-2022-1629 | /*
* Search quote char from string line[col].
* Quote character escaped by one of the characters in "escape" is not counted
* as a quote.
* Returns column number of "quotechar" or -1 when not found.
*/
static int
find_next_quote(
char_u *line,
int col,
int quotechar,
char_u *escape) // escape... | --- vulnerable
+++ patched
@@ -19,7 +19,11 @@
if (c == NUL)
return -1;
else if (escape != NULL && vim_strchr(escape, c))
+ {
++col;
+ if (line[col] == NUL)
+ return -1;
+ }
else if (c == quotechar)
break;
if (has_mbyte) | CVE-2010-4650 | long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
unsigned int flags)
{
struct fuse_file *ff = file->private_data;
struct fuse_conn *fc = ff->fc;
struct fuse_ioctl_in inarg = {
.fh = ff->fh,
.cmd = cmd,
.arg = arg,
.flags = flags
};
struct fuse_ioctl_out outarg;
struct fuse_r... | --- vulnerable
+++ patched
@@ -144,6 +144,14 @@
in_iov = page_address(iov_page);
out_iov = in_iov + in_iovs;
+ err = fuse_verify_ioctl_iov(in_iov, in_iovs);
+ if (err)
+ goto out;
+
+ err = fuse_verify_ioctl_iov(out_iov, out_iovs);
+ if (err)
+ goto out;
+
goto retry;
}
| /* {{{ php_wddx_push_element
*/
static void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
if (!strcmp(name, EL_PACKET)) {
int i;
if (atts) for (i=0; atts[i]; i++) {
if (!strcmp(atts[i], EL_VERSION)) {
/* ... |
CVE-2017-13023 | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... | --- vulnerable
+++ patched
@@ -37,6 +37,7 @@
goto trunc;
}
/* units of 4 secs */
+ ND_TCHECK_16BITS(&bp[i+2]);
ND_PRINT((ndo, "(refresh: %u)",
EXTRACT_16BITS(&bp[i+2]) << 2));
break; | CVE-2022-41883 | bool IsHostMemoryArg(const EagerOperation& op, const NodeDef* node_def,
const Device* op_device, const KernelDef* kernel_def,
const int port_id) {
if (op.is_function()) return false;
if (node_def == nullptr) return false;
if (kernel_def == nullptr || op_device == nullptr)... | --- vulnerable
+++ patched
@@ -7,6 +7,10 @@
const auto& host_memory_args = kernel_def->host_memory_arg();
const OpDef& op_def = OpRegistry::Global()->LookUp(op.Name())->op_def;
const int arg_id = OpPortIdToArgId(*node_def, op_def.input_arg(), port_id);
+ // Fail if argument ID not found.
+ if (arg_id < 0) {
... | CVE-2017-6435 | static plist_t parse_string_node(const char **bnode, uint64_t size)
{
plist_data_t data = plist_new_plist_data();
data->type = PLIST_STRING;
data->strval = (char *) malloc(sizeof(char) * (size + 1));
memcpy(data->strval, *bnode, size);
data->strval[size] = '\0';
data->length = strlen(data->strv... | --- vulnerable
+++ patched
@@ -4,6 +4,11 @@
data->type = PLIST_STRING;
data->strval = (char *) malloc(sizeof(char) * (size + 1));
+ if (!data->strval) {
+ plist_free_data(data);
+ PLIST_BIN_ERR("%s: Could not allocate %" PRIu64 " bytes\n", __func__, sizeof(char) * (size + 1));
+ retu... | static int
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2... |
CVE-2022-1629 | /*
* Search quote char from string line[col].
* Quote character escaped by one of the characters in "escape" is not counted
* as a quote.
* Returns column number of "quotechar" or -1 when not found.
*/
static int
find_next_quote(
char_u *line,
int col,
int quotechar,
char_u *escape) // escape... | --- vulnerable
+++ patched
@@ -19,7 +19,11 @@
if (c == NUL)
return -1;
else if (escape != NULL && vim_strchr(escape, c))
+ {
++col;
+ if (line[col] == NUL)
+ return -1;
+ }
else if (c == quotechar)
break;
if (has_mbyte) | CVE-2022-31002 | static
char *url_canonize3(char *d, char const * const s, size_t n,
unsigned m32, unsigned m64, unsigned m96)
{
size_t i = 0;
if (d == s)
for (;s[i] && i < n; d++, i++)
if (s[i] == '%')
break;
for (;s[i] && i < n; d++, i++) {
unsigned char c = s[i], h1, h2;
if (c != '%') {
*d = c... | --- vulnerable
+++ patched
@@ -17,7 +17,12 @@
continue;
}
- h1 = s[i + 1], h2 = s[i + 2];
+ h1 = s[i + 1];
+ if (!h1) {
+ *d = '\0';
+ return NULL;
+ }
+ h2 = s[i + 2];
if (!IS_HEX(h1) || !IS_HEX(h2)) {
*d = '\0'; | CVE-2022-4141 | void
do_window(
int nchar,
long Prenum,
int xchar) // extra char from ":wincmd gx" or NUL
{
long Prenum1;
win_T *wp;
char_u *ptr;
linenr_T lnum = -1;
#ifdef FEAT_FIND_ID
int type = FIND_DEFINE;
int len;
#endif
char_u cbuf[40];
if (ERROR_IF_ANY_POPUP_WINDOW)
retur... | --- vulnerable
+++ patched
@@ -395,6 +395,8 @@
case Ctrl_F:
wingotofile:
CHECK_CMDWIN;
+ if (check_text_or_curbuf_locked(NULL))
+ break;
ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL) | /*
* Search quote char from string line[col].
* Quote character escaped by one of the characters in "escape" is not counted
* as a quote.
* Returns column number of "quotechar" or -1 when not found.
*/
static int
find_next_quote(
char_u *line,
int col,
int quotechar,
char_u *escape) // escape... |
CVE-2017-13016 | static void
esis_print(netdissect_options *ndo,
const uint8_t *pptr, u_int length)
{
const uint8_t *optr;
u_int li,esis_pdu_type,source_address_length, source_address_number;
const struct esis_header_t *esis_header;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, "ES-IS"));
if (length <= 2) {
ND_PRINT((ndo, n... | --- vulnerable
+++ patched
@@ -129,10 +129,18 @@
pptr += netal;
li -= netal;
- if (netal == 0)
- ND_PRINT((ndo, "\n\t %s", etheraddr_string(ndo, snpa)));
+ if (snpal == 6)
+ ND_PRINT((ndo, "\n\t SNPA (length: %u): %s",
+ snpal,
+ etheraddr_string(ndo, snpa)));
else
- ... | CVE-2023-0051 | static void
msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u *buf = NULL;
char_u *p = s;
#ifdef MSWIN
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); // handle CR and NL correctly
#endif
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
if (!(sil... | --- vulnerable
+++ patched
@@ -60,7 +60,8 @@
{
char_u *tofree = NULL;
- if (maxlen > 0 && STRLEN(p) > (size_t)maxlen)
+ if (maxlen > 0 && vim_strlen_maxlen((char *)p, (size_t)maxlen)
+ >= (size_t)maxlen)
{
tofree = vim_strnsave(p, (size_t)maxlen);
p = tofree; | CVE-2022-1437 | static RList *symbols(RBinFile *bf) {
RList *res = r_list_newf ((RListFree)r_bin_symbol_free);
r_return_val_if_fail (res && bf->o && bf->o->bin_obj, res);
RCoreSymCacheElement *element = bf->o->bin_obj;
size_t i;
HtUU *hash = ht_uu_new0 ();
if (!hash) {
return res;
}
bool found = false;
for (i = 0; i < eleme... | --- vulnerable
+++ patched
@@ -1,26 +1,28 @@
static RList *symbols(RBinFile *bf) {
- RList *res = r_list_newf ((RListFree)r_bin_symbol_free);
- r_return_val_if_fail (res && bf->o && bf->o->bin_obj, res);
+ r_return_val_if_fail (bf && bf->o && bf->o->bin_obj, NULL);
RCoreSymCacheElement *element = bf->o->bin_obj;
s... | static void
esis_print(netdissect_options *ndo,
const uint8_t *pptr, u_int length)
{
const uint8_t *optr;
u_int li,esis_pdu_type,source_address_length, source_address_number;
const struct esis_header_t *esis_header;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, "ES-IS"));
if (length <= 2) {
ND_PRINT((ndo, n... |
CVE-2016-10327 | bool EnhWMFReader::ReadEnhWMF()
{
sal_uInt32 nStretchBltMode = 0;
sal_uInt32 nNextPos(0),
nW(0), nH(0), nColor(0), nIndex(0),
nDat32(0), nNom1(0), nDen1(0), nNom2(0), nDen2(0);
sal_Int32 nX32(0), nY32(0), nx32(0), ny32(0);
bool bStatus = ReadHeader();
bool ... | --- vulnerable
+++ patched
@@ -631,13 +631,22 @@
else
{
const sal_uInt32 nSourceSize = cbBmiSrc + cbBitsSrc + 14;
- if ( nSourceSize <= ( nEndPos - nStartPos ) )
+ bool bSafeRead = nSourceSize <= (nEndPos - ... | CVE-2024-25115 | static int CFScanDump_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_AutoMemory(ctx);
if (argc != 3) {
return RedisModule_WrongArity(ctx);
}
long long pos;
if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK) {
return RedisModule_R... | --- vulnerable
+++ patched
@@ -6,7 +6,7 @@
}
long long pos;
- if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK) {
+ if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK || pos < 0) {
return RedisModule_ReplyWithError(ctx, "Invalid position");
}
| CVE-2017-7542 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
{
u16 offset = sizeof(struct ipv6hdr);
unsigned int packet_len = skb_tail_pointer(skb) -
skb_network_header(skb);
int found_rhdr = 0;
*nexthdr = &ipv6_hdr(skb)->nexthdr;
while (offset <= packet_len) {
struct ipv6_opt_hdr *exthdr;
switch (**nexthdr)... | --- vulnerable
+++ patched
@@ -1,6 +1,6 @@
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
{
- u16 offset = sizeof(struct ipv6hdr);
+ unsigned int offset = sizeof(struct ipv6hdr);
unsigned int packet_len = skb_tail_pointer(skb) -
skb_network_header(skb);
int found_rhdr = 0;
@@ -8,6 +8,7 @@
while... | bool EnhWMFReader::ReadEnhWMF()
{
sal_uInt32 nStretchBltMode = 0;
sal_uInt32 nNextPos(0),
nW(0), nH(0), nColor(0), nIndex(0),
nDat32(0), nNom1(0), nDen1(0), nNom2(0), nDen2(0);
sal_Int32 nX32(0), nY32(0), nx32(0), ny32(0);
bool bStatus = ReadHeader();
bool ... |
CVE-2016-9540 | DECLAREwriteFunc(writeBufferToContigTiles)
{
uint32 imagew = TIFFScanlineSize(out);
uint32 tilew = TIFFTileRowSize(out);
int iskew = imagew - tilew;
tsize_t tilesize = TIFFTileSize(out);
tdata_t obuf;
uint8* bufp = (uint8*) buf;
uint32 tl, tw;
uint32 row;
(void) spp;
obuf = _TIFFmalloc(TIFFTileSize(out));
... | --- vulnerable
+++ patched
@@ -22,7 +22,7 @@
uint32 colb = 0;
uint32 col;
- for (col = 0; col < imagewidth; col += tw) {
+ for (col = 0; col < imagewidth && colb < imagew; col += tw) {
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors. | CVE-2017-5581 | void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix)
{
int stride;
U8 *buf;
int w, h, b;
w = r.width();
h = r.height();
b = format.bpp/8;
if (h == 0)
return;
buf = getBufferRW(r, &stride);
if (b == 1) {
while (h--) {
memset(buf, *(const U8*)pix, w);
buf += strid... | --- vulnerable
+++ patched
@@ -3,15 +3,26 @@
int stride;
U8 *buf;
int w, h, b;
+ Rect drect;
- w = r.width();
- h = r.height();
+ drect = r;
+ if (!drect.enclosed_by(getRect())) {
+ vlog.error("Destination rect %dx%d at %d,%d exceeds framebuffer %dx%d",
+ drect.width(), drect.height(), ... | CVE-2022-0204 | static void prep_write_cb(struct bt_att_chan *chan, uint8_t opcode,
const void *pdu, uint16_t length,
void *user_data)
{
struct bt_gatt_server *server = user_data;
uint16_t handle = 0;
uint16_t offset;
struct gatt_db_attribute *attr;
struct prep_write_complete_data *pwcd;
uint8_t ecode, status;
if (le... | --- vulnerable
+++ patched
@@ -31,6 +31,10 @@
util_debug(server->debug_callback, server->debug_data,
"Prep Write Req - handle: 0x%04x", handle);
+ ecode = check_length(length, offset);
+ if (ecode)
+ goto error;
+
ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
if (ecode)
goto error; | DECLAREwriteFunc(writeBufferToContigTiles)
{
uint32 imagew = TIFFScanlineSize(out);
uint32 tilew = TIFFTileRowSize(out);
int iskew = imagew - tilew;
tsize_t tilesize = TIFFTileSize(out);
tdata_t obuf;
uint8* bufp = (uint8*) buf;
uint32 tl, tw;
uint32 row;
(void) spp;
obuf = _TIFFmalloc(TIFFTileSize(out));
... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2023-39350 | static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* message, wStream* s,
UINT16* pExpectedBlockType)
{
BOOL rc;
size_t close_cnt = 0;
BYTE quant;
RFX_TILE* tile;
UINT32* quants;
UINT16 subtype, numTiles;
UINT32 blockLen;
UINT32 blockType;
UINT32 ti... | --- vulnerable
+++ patched
@@ -188,6 +188,31 @@
Stream_Read_UINT8(sub, tile->quantIdxY); /* quantIdxY (1 byte) */
Stream_Read_UINT8(sub, tile->quantIdxCb); /* quantIdxCb (1 byte) */
Stream_Read_UINT8(sub, tile->quantIdxCr); /* quantIdxCr (1 byte) */
+ if (tile->quantIdxY >= context->numQuant)
+ {
+ ... | CVE-2017-8066 | static int gs_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct gs_usb *dev;
int rc = -ENOMEM;
unsigned int icount, i;
struct gs_host_config hconf = {
.byte_order = 0x0000beef,
};
struct gs_device_config dconf;
/* send host config */
rc = usb_control_msg(interface_to_usbdev(in... | --- vulnerable
+++ patched
@@ -4,10 +4,14 @@
struct gs_usb *dev;
int rc = -ENOMEM;
unsigned int icount, i;
- struct gs_host_config hconf = {
- .byte_order = 0x0000beef,
- };
- struct gs_device_config dconf;
+ struct gs_host_config *hconf;
+ struct gs_device_config *dconf;
+
+ hconf = kmalloc(sizeof(*hconf), GFP_... | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2017-9206 | static void iwjpeg_scan_exif_ifd(struct iwjpegrcontext *rctx,
struct iw_exif_state *e, iw_uint32 ifd)
{
unsigned int tag_count;
unsigned int i;
unsigned int tag_pos;
unsigned int tag_id;
unsigned int v;
double v_dbl;
if(ifd<8 || ifd>e->d_len-18) return;
tag_count = iw_get_ui16_e(&e->d[ifd],e->endian);
if(ta... | --- vulnerable
+++ patched
@@ -8,15 +8,15 @@
unsigned int v;
double v_dbl;
- if(ifd<8 || ifd>e->d_len-18) return;
+ if(ifd<8 || e->d_len<18 || ifd>e->d_len-18) return;
- tag_count = iw_get_ui16_e(&e->d[ifd],e->endian);
+ tag_count = get_exif_ui16(e, ifd);
if(tag_count>1000) return; // Sanity check.
for(i=... | CVE-2023-0645 | // Finds the position of an Exif tag, or 0 if it is not found
inline size_t FindExifTagPosition(const std::vector<uint8_t>& exif,
uint16_t tagname) {
bool bigendian;
if (!IsExif(exif, &bigendian)) return 0;
const uint8_t* t = exif.data() + 4;
uint32_t offset = (bigendian ? Load... | --- vulnerable
+++ patched
@@ -7,6 +7,7 @@
uint32_t offset = (bigendian ? LoadBE32(t) : LoadLE32(t));
if (exif.size() < 12 + offset + 2 || offset < 8) return 0;
t += offset - 4;
+ if(t + 2 >= exif.data() + exif.size()) return 0; // gdb_affter_SIGSEGV: 44 uint16_t nb_tags = (bigendian ? LoadBE16(t) : LoadLE16(... | CVE-2017-7395 | void SMsgReader::readClientCutText()
{
is->skip(3);
int len = is->readU32();
if (len > maxCutText) {
is->skip(len);
vlog.error("Cut text too long (%d bytes) - ignoring", len);
return;
}
CharArray ca(len+1);
ca.buf[len] = 0;
is->readBytes(ca.buf, len);
handler->clientCutText(ca.buf, len);
} | --- vulnerable
+++ patched
@@ -2,6 +2,9 @@
{
is->skip(3);
int len = is->readU32();
+ if (len < 0) {
+ throw Exception("Cut text too long.");
+ }
if (len > maxCutText) {
is->skip(len);
vlog.error("Cut text too long (%d bytes) - ignoring", len); | static void iwjpeg_scan_exif_ifd(struct iwjpegrcontext *rctx,
struct iw_exif_state *e, iw_uint32 ifd)
{
unsigned int tag_count;
unsigned int i;
unsigned int tag_pos;
unsigned int tag_id;
unsigned int v;
double v_dbl;
if(ifd<8 || e->d_len<18 || ifd>e->d_len-18) return;
tag_count = get_exif_ui16(e, ifd);
if(t... |
CVE-2016-10197 | static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
struct search_domain *dom;
for (dom = state->head; dom; dom = dom->next) {
if (!n--) {
... | --- vulnerable
+++ patched
@@ -1,8 +1,11 @@
static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
- const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+ char need_to_append_dot;
struct search_doma... | CVE-2022-2819 | /*
* Callback passed to ex_unletlock().
*/
static int
compile_lock_unlock(
lval_T *lvp,
char_u *name_end,
exarg_T *eap,
int deep,
void *coookie)
{
cctx_T *cctx = coookie;
int cc = *name_end;
char_u *p = lvp->ll_name;
int ret = OK;
size_t len;
char_u *buf;
... | --- vulnerable
+++ patched
@@ -16,9 +16,16 @@
size_t len;
char_u *buf;
isntype_T isn = ISN_EXEC;
+ char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
if (cctx->ctx_skip == SKIP_YES)
return OK;
+
+ if (*p == NUL)
+ {
+ semsg(_(e_argument_required_for_str), cmd);
+ return F... | CVE-2023-48014 | static Bool hevc_parse_vps_extension(HEVC_VPS *vps, GF_BitStream *bs)
{
u8 splitting_flag, vps_nuh_layer_id_present_flag, view_id_len;
u32 i, j, num_scalability_types, num_add_olss, num_add_layer_set, num_indepentdent_layers, nb_bits, default_output_layer_idc = 0;
u8 dimension_id_len[16], dim_bit_offset[16];
u8 /*a... | --- vulnerable
+++ patched
@@ -38,13 +38,19 @@
}
if (splitting_flag) {
- for (i = 0; i < num_scalability_types; i++) {
+ u32 num_bits=0;
+ for (i = 0; i < num_scalability_types-1; i++) {
dim_bit_offset[i] = 0;
+ num_bits+=dimension_id_len[i];
for (j = 0; j < i; j++)
dim_bit_offset[i] +=... | static char *
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
const size_t base_len = strlen(base_name);
char need_to_append_dot;
struct search_domain *dom;
if (!base_len) return NULL;
need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
for (dom = state->he... |
CVE-2013-2127 | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... | --- vulnerable
+++ patched
@@ -46,8 +46,10 @@
imgdata.image[i][3] = lut[imgdata.image[i][3]];
}
- C.data_maximum = lut[C.data_maximum];
- C.maximum = lut[C.maximum];
+ if(C.data_maximum <=TBLN)
+ C.data_maximum = lut[C.data_maximum];
+ if(C.maximum <= TBLN)
+ C.maximum = lut[C.maximum];
... | CVE-2024-37407 | static int
slurp_central_directory(struct archive_read *a, struct archive_entry* entry,
struct zip *zip)
{
ssize_t i;
unsigned found;
int64_t correction;
ssize_t bytes_avail;
const char *p;
/*
* Find the start of the central directory. The end-of-CD
* record has our starting point, but there are lots of... | --- vulnerable
+++ patched
@@ -197,7 +197,7 @@
* as the actual resource fork doesn't end with '/'.
*/
size_t tmp_length = filename_length;
- if (name[tmp_length - 1] == '/') {
+ if (tmp_length > 0 && name[tmp_length - 1] == '/') {
tmp_length--;
r = rsrc_basename(name, tmp_length);
... | CVE-2022-39842 | static ssize_t
pxa3xx_gcu_write(struct file *file, const char *buff,
size_t count, loff_t *offp)
{
int ret;
unsigned long flags;
struct pxa3xx_gcu_batch *buffer;
struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
int words = count / 4;
/* Does not need to be atomic. There's a lock in user space,
* bu... | --- vulnerable
+++ patched
@@ -7,7 +7,7 @@
struct pxa3xx_gcu_batch *buffer;
struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
- int words = count / 4;
+ size_t words = count / 4;
/* Does not need to be atomic. There's a lock in user space,
* but anyhow, this is just for statistics. */ | void LibRaw::exp_bef(float shift, float smooth)
{
// params limits
if(shift>8) shift = 8;
if(shift<0.25) shift = 0.25;
if(smooth < 0.0) smooth = 0.0;
if(smooth > 1.0) smooth = 1.0;
unsigned short *lut = (ushort*)malloc((TBLN+1)*sizeof(unsigned short));
if(shift <=1.0)
{
... |
CVE-2017-12994 | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... | --- vulnerable
+++ patched
@@ -834,35 +834,42 @@
uint8_t type;
uint16_t length;
- ND_TCHECK2(tptr[0], 3);
-
tlen = len;
while (tlen >= 3) {
+
+ ND_TCHECK2(tptr[0], 3);
type = *tptr;
length = EXTRACT_16BITS(tptr+1);
+ tptr += 3;
+ tlen -= 3;
ND_PRINT((ndo, "\n\t ... | CVE-2017-13042 | static int
dhcpv6_print(netdissect_options *ndo,
const u_char *cp, u_int length, int indent)
{
u_int i, t;
const u_char *tlv, *value;
uint16_t type, optlen;
i = 0;
while (i < length) {
tlv = cp + i;
type = EXTRACT_16BITS(tlv);
optlen = EXTRACT_16BITS(tlv + 2);
... | --- vulnerable
+++ patched
@@ -8,6 +8,8 @@
i = 0;
while (i < length) {
+ if (i + 4 > length)
+ return -1;
tlv = cp + i;
type = EXTRACT_16BITS(tlv);
optlen = EXTRACT_16BITS(tlv + 2);
@@ -19,6 +21,8 @@
ND_PRINT((ndo, "%s", tok2str(dh6opt_str, "Unknown", ... | CVE-2016-6823 | static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
BMPInfo
bmp_info;
const char
*option;
const StringInfo
*profile;
MagickBooleanType
have_color_info,
status;
MagickOffsetType
scene;
MemoryInfo
*pixel_info;
regis... | --- vulnerable
+++ patched
@@ -172,10 +172,13 @@
bmp_info.file_size+=extra_size;
bmp_info.offset_bits+=extra_size;
}
+ if ((image->columns != (signed int) image->columns) ||
+ (image->rows != (signed int) image->rows))
+ ThrowWriterException(ImageError,"WidthOrHeightExceeds... | static int
bgp_attr_print(netdissect_options *ndo,
u_int atype, const u_char *pptr, u_int len)
{
int i;
uint16_t af;
uint8_t safi, snpa, nhlen;
union { /* copy buffer for bandwidth values */
float f;
uint32_t i;
} bw;
int advance;
u_int tlen;
const u_char *tp... |
CVE-2016-1709 | int32_t ByteArray::Get(int32_t index) {
return InternalGet(index) & 0xff;
} | --- vulnerable
+++ patched
@@ -1,3 +1,5 @@
int32_t ByteArray::Get(int32_t index) {
+ if (index < 0 || index >= Length())
+ return -1;
return InternalGet(index) & 0xff;
} | CVE-2022-2124 | /*
* Find quote under the cursor, cursor at end.
* Returns TRUE if found, else FALSE.
*/
int
current_quote(
oparg_T *oap,
long count,
int include, // TRUE == include quote char
int quotechar) // Quote character
{
char_u *line = ml_get_curline();
int col_end;
int col_start = curwin... | --- vulnerable
+++ patched
@@ -83,11 +83,17 @@
// Find out if we have a quote in the selection.
while (i <= col_end)
+ {
+ // check for going over the end of the line, which can happen if
+ // the line was changed after the Visual area was selected.
+ if (line[i] == NUL)
+ break;
if (line[i++] ... | CVE-2024-35366 | static int parse_options(struct sbg_parser *p)
{
struct sbg_string ostr, oarg;
char mode = 0;
int r;
char *tptr;
double v;
if (p->cursor == p->end || *p->cursor != '-')
return 0;
while (lex_char(p, '-') && lex_wsword(p, &ostr)) {
for (; ostr.s < ostr.e; ostr.s++) {
... | --- vulnerable
+++ patched
@@ -37,7 +37,7 @@
case 'L':
FORWARD_ERROR(parse_optarg(p, opt, &oarg));
r = str_to_time(oarg.s, &p->scs.opt_duration);
- if (oarg.e != oarg.s + r) {
+ if (oarg.e != oarg.s + r || p->scs.opt_durati... | int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
} |
CVE-2017-1000249 | private int
/*ARGSUSED*/
do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz >=... | --- vulnerable
+++ patched
@@ -5,7 +5,7 @@
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
- type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) {
+ type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
uint8_t desc[20];
const char ... | CVE-2024-40427 | void
MavlinkReceiver::handle_message_serial_control(mavlink_message_t *msg)
{
mavlink_serial_control_t serial_control_mavlink;
mavlink_msg_serial_control_decode(msg, &serial_control_mavlink);
// Check if the message is targeted at us.
if ((serial_control_mavlink.target_system != 0 &&
mavlink_system.sysid != ... | --- vulnerable
+++ patched
@@ -22,7 +22,7 @@
if (shell) {
// we ignore the timeout, EXCLUSIVE & BLOCKING flags of the SERIAL_CONTROL message
- if (serial_control_mavlink.count > 0) {
+ if (serial_control_mavlink.count > 0 && serial_control_mavlink.count <= sizeof(serial_control_mavlink.data)) {
shell->setT... | CVE-2016-8636 | int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)
{
switch (mem->type) {
case RXE_MEM_TYPE_DMA:
return 0;
case RXE_MEM_TYPE_MR:
case RXE_MEM_TYPE_FMR:
return ((iova < mem->iova) ||
((iova + length) > (mem->iova + mem->length))) ?
-EFAULT : 0;
default:
return -EFAULT;
}
} | --- vulnerable
+++ patched
@@ -6,9 +6,11 @@
case RXE_MEM_TYPE_MR:
case RXE_MEM_TYPE_FMR:
- return ((iova < mem->iova) ||
- ((iova + length) > (mem->iova + mem->length))) ?
- -EFAULT : 0;
+ if (iova < mem->iova ||
+ length > mem->length ||
+ iova > mem->iova + mem->length - length)
+ return -EFAU... | private int
/*ARGSUSED*/
do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
size_t noff, size_t doff, int *flags)
{
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_BUILD_ID && (descsz >=... |
CVE-2023-0818 | char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32)... | --- vulnerable
+++ patched
@@ -15,18 +15,24 @@
if (!unicode_type && (szLine[i] & 0x80)) {
/*non UTF8 (likely some win-CP)*/
if ((szLine[i+1] & 0xc0) != 0x80) {
+ if (j >= GF_ARRAY_LENGTH(szLineConv))
+ break;
szLineConv[j] = 0xc0 | ( (szLine[i] >> 6) & 0x3 );
j++;
szLine[i] &= 0... | CVE-2023-4735 | static int
do_addsub(
int op_type,
pos_T *pos,
int length,
linenr_T Prenum1)
{
int col;
char_u *buf1;
char_u buf2[NUMBUFLEN];
int pre; // 'X'/'x': hex; '0': octal; 'B'/'b': bin
static int hexupper = FALSE; // 0xABC
uvarnumber_T n;
uvarnumber_T oldn;
char_u *ptr;
... | --- vulnerable
+++ patched
@@ -369,7 +369,7 @@
for (bit = bits; bit > 0; bit--)
if ((n >> (bit - 1)) & 0x1) break;
- for (i = 0; bit > 0; bit--)
+ for (i = 0; bit > 0 && i < (NUMBUFLEN - 1); bit--)
buf2[i++] = ((n >> (bit - 1)) & 0x1) ? '1' : '0';
buf2[i] = '\0'; | CVE-2023-7158 | #if MICROPY_PY_BUILTINS_SLICE_INDICES
STATIC mp_obj_t slice_indices(mp_obj_t self_in, mp_obj_t length_obj) {
mp_int_t length = mp_obj_int_get_checked(length_obj);
mp_bound_slice_t bound_indices;
mp_obj_slice_indices(self_in, length, &bound_indices);
mp_obj_t results[3] = {
MP_OBJ_NEW_SMALL_INT(... | --- vulnerable
+++ patched
@@ -1,6 +1,6 @@
#if MICROPY_PY_BUILTINS_SLICE_INDICES
STATIC mp_obj_t slice_indices(mp_obj_t self_in, mp_obj_t length_obj) {
- mp_int_t length = mp_obj_int_get_checked(length_obj);
+ mp_int_t length = mp_obj_get_int(length_obj);
mp_bound_slice_t bound_indices;
mp_obj_slice_i... | char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type)
{
u32 i, j, len;
char *sOK;
char szLineConv[2048];
unsigned short *sptr;
memset(szLine, 0, sizeof(char)*lineSize);
sOK = gf_fgets(szLine, lineSize, txt_in);
if (!sOK) return NULL;
if (unicode_type<=1) {
j=0;
len = (u32)... |
CVE-2022-1381 | int
parse_command_modifiers(
exarg_T *eap,
char **errormsg,
cmdmod_T *cmod,
int skip_only)
{
char_u *cmd_start = NULL;
char_u *p;
int starts_with_colon = FALSE;
int vim9script = in_vim9script();
int has_visual_range = FALSE;
CLEAR_POINTER(cmod);
cmod->cmod_f... | --- vulnerable
+++ patched
@@ -5,7 +5,9 @@
cmdmod_T *cmod,
int skip_only)
{
+ char_u *orig_cmd = eap->cmd;
char_u *cmd_start = NULL;
+ int did_plus_cmd = FALSE;
char_u *p;
int starts_with_colon = FALSE;
int vim9script = in_vim9script();
@@ -41,6 +43,7 @@
&& curwi... | CVE-2024-25115 | static int CFScanDump_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_AutoMemory(ctx);
if (argc != 3) {
return RedisModule_WrongArity(ctx);
}
long long pos;
if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK) {
return RedisModule_R... | --- vulnerable
+++ patched
@@ -6,7 +6,7 @@
}
long long pos;
- if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK) {
+ if (RedisModule_StringToLongLong(argv[2], &pos) != REDISMODULE_OK || pos < 0) {
return RedisModule_ReplyWithError(ctx, "Invalid position");
}
| CVE-2016-4301 | static int
parse_device(dev_t *pdev, struct archive *a, char *val)
{
#define MAX_PACK_ARGS 3
unsigned long numbers[MAX_PACK_ARGS];
char *p, *dev;
int argc;
pack_t *pack;
dev_t result;
const char *error = NULL;
memset(pdev, 0, sizeof(*pdev));
if ((dev = strchr(val, ',')) != NULL) {
/*
* Device's major/mino... | --- vulnerable
+++ patched
@@ -28,12 +28,12 @@
"Missing number");
return ARCHIVE_WARN;
}
- numbers[argc++] = (unsigned long)mtree_atol(&p);
- if (argc > MAX_PACK_ARGS) {
+ if (argc >= MAX_PACK_ARGS) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"Too many arguments");
retur... | int
parse_command_modifiers(
exarg_T *eap,
char **errormsg,
cmdmod_T *cmod,
int skip_only)
{
char_u *orig_cmd = eap->cmd;
char_u *cmd_start = NULL;
int did_plus_cmd = FALSE;
char_u *p;
int starts_with_colon = FALSE;
int vim9script = in_vim9script();
int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.