idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
12,700 | static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
bool mask)
{
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
vhost_net_virtqueue_mask(tap_get_vhost_net(nc->peer),
... | DoS Exec Code Overflow | 0 | static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
bool mask)
{
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
vhost_net_virtqueue_mask(tap_get_vhost_net(nc->peer),
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,701 | static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
return vhost_net_virtqueue_pending(tap_get_vhost_net(nc->peer), idx);
}
| DoS Exec Code Overflow | 0 | static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
return vhost_net_virtqueue_pending(tap_get_vhost_net(nc->peer), idx);
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,702 | static uint64_t virtio_net_guest_offloads_by_features(uint32_t features)
{
static const uint64_t guest_offloads_mask =
(1ULL << VIRTIO_NET_F_GUEST_CSUM) |
(1ULL << VIRTIO_NET_F_GUEST_TSO4) |
(1ULL << VIRTIO_NET_F_GUEST_TSO6) |
(1ULL << VIRTIO_NET_F_GUEST_ECN) |
(1ULL << VIRT... | DoS Exec Code Overflow | 0 | static uint64_t virtio_net_guest_offloads_by_features(uint32_t features)
{
static const uint64_t guest_offloads_mask =
(1ULL << VIRTIO_NET_F_GUEST_CSUM) |
(1ULL << VIRTIO_NET_F_GUEST_TSO4) |
(1ULL << VIRTIO_NET_F_GUEST_TSO6) |
(1ULL << VIRTIO_NET_F_GUEST_ECN) |
(1ULL << VIRT... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,703 | static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
struct virtio_net_ctrl_hdr ctrl;
virtio_net_ctrl_ack status = VIRTIO_NET_ERR;
VirtQueueElement elem;
size_t s;
struct iovec *iov;
unsigned int iov_cnt;
while (virtqueue_pop(vq, &elem... | DoS Exec Code Overflow | 0 | static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
struct virtio_net_ctrl_hdr ctrl;
virtio_net_ctrl_ack status = VIRTIO_NET_ERR;
VirtQueueElement elem;
size_t s;
struct iovec *iov;
unsigned int iov_cnt;
while (virtqueue_pop(vq, &elem... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,704 | static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
struct virtio_net_ctrl_mac mac_data;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
if (cmd == VIRTIO_NET_CTRL_MAC_ADDR_SET) {
if (iov_size(iov, iov_cn... | DoS Exec Code Overflow | 0 | static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
struct virtio_net_ctrl_mac mac_data;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
if (cmd == VIRTIO_NET_CTRL_MAC_ADDR_SET) {
if (iov_size(iov, iov_cn... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,705 | static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
int queue_index = vq2q(virtio_get_queue_index(vq));
qemu_flush_queued_packets(qemu_get_subqueue(n->nic, queue_index));
}
| DoS Exec Code Overflow | 0 | static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
int queue_index = vq2q(virtio_get_queue_index(vq));
qemu_flush_queued_packets(qemu_get_subqueue(n->nic, queue_index));
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,706 | static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
uint8_t on;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
s = iov_to_buf(iov, iov_cnt, 0, &on, sizeof(on));
if (s != sizeof(on)) {
return ... | DoS Exec Code Overflow | 0 | static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
uint8_t on;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
s = iov_to_buf(iov, iov_cnt, 0, &on, sizeof(on));
if (s != sizeof(on)) {
return ... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,707 | static void virtio_net_handle_tx_timer(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
VirtIONetQueue *q = &n->vqs[vq2q(virtio_get_queue_index(vq))];
/* This happens when device was stopped but VCPU wasn't. */
if (!vdev->vm_running) {
q->tx_waiting = 1;
return;
... | DoS Exec Code Overflow | 0 | static void virtio_net_handle_tx_timer(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIONet *n = VIRTIO_NET(vdev);
VirtIONetQueue *q = &n->vqs[vq2q(virtio_get_queue_index(vq))];
/* This happens when device was stopped but VCPU wasn't. */
if (!vdev->vm_running) {
q->tx_waiting = 1;
return;
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,708 | static int virtio_net_handle_vlan_table(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
uint16_t vid;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
s = iov_to_buf(iov, iov_cnt, 0, &vid, sizeof(vid));
vid = lduw_p(&vid);
if (... | DoS Exec Code Overflow | 0 | static int virtio_net_handle_vlan_table(VirtIONet *n, uint8_t cmd,
struct iovec *iov, unsigned int iov_cnt)
{
uint16_t vid;
size_t s;
NetClientState *nc = qemu_get_queue(n->nic);
s = iov_to_buf(iov, iov_cnt, 0, &vid, sizeof(vid));
vid = lduw_p(&vid);
if (... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,709 | static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)
{
VirtIONet *n = q->n;
if (virtio_queue_empty(q->rx_vq) ||
(n->mergeable_rx_bufs &&
!virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) {
virtio_queue_set_notification(q->rx_vq, 1);
/* To avoid a race condition where ... | DoS Exec Code Overflow | 0 | static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)
{
VirtIONet *n = q->n;
if (virtio_queue_empty(q->rx_vq) ||
(n->mergeable_rx_bufs &&
!virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) {
virtio_queue_set_notification(q->rx_vq, 1);
/* To avoid a race condition where ... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,710 | static void virtio_net_instance_init(Object *obj)
{
VirtIONet *n = VIRTIO_NET(obj);
/*
* The default config_size is sizeof(struct virtio_net_config).
* Can be overriden with virtio_net_set_config_size.
*/
n->config_size = sizeof(struct virtio_net_config);
}
| DoS Exec Code Overflow | 0 | static void virtio_net_instance_init(Object *obj)
{
VirtIONet *n = VIRTIO_NET(obj);
/*
* The default config_size is sizeof(struct virtio_net_config).
* Can be overriden with virtio_net_set_config_size.
*/
n->config_size = sizeof(struct virtio_net_config);
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,711 | static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
RxFilterInfo *info;
strList *str_list, *entry;
int i;
info = g_malloc0(sizeof(*info));
info->name = g_strdup(nc->name);
info->promiscuous =... | DoS Exec Code Overflow | 0 | static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
RxFilterInfo *info;
strList *str_list, *entry;
int i;
info = g_malloc0(sizeof(*info));
info->name = g_strdup(nc->name);
info->promiscuous =... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,712 | static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
struct virtio_net_hdr_mrg_rxbuf mhdr;
... | DoS Exec Code Overflow | 0 | static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
struct virtio_net_hdr_mrg_rxbuf mhdr;
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,713 | static void virtio_net_reset(VirtIODevice *vdev)
{
VirtIONet *n = VIRTIO_NET(vdev);
/* Reset back to compatibility mode */
n->promisc = 1;
n->allmulti = 0;
n->alluni = 0;
n->nomulti = 0;
n->nouni = 0;
n->nobcast = 0;
/* multiqueue is disabled by default */
n->curr_queues = 1;
... | DoS Exec Code Overflow | 0 | static void virtio_net_reset(VirtIODevice *vdev)
{
VirtIONet *n = VIRTIO_NET(vdev);
/* Reset back to compatibility mode */
n->promisc = 1;
n->allmulti = 0;
n->alluni = 0;
n->nomulti = 0;
n->nouni = 0;
n->nobcast = 0;
/* multiqueue is disabled by default */
n->curr_queues = 1;
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,714 | static void virtio_net_save(QEMUFile *f, void *opaque)
{
int i;
VirtIONet *n = opaque;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
/* At this point, backend must be stopped, otherwise
* it might keep writing to memory. */
assert(!n->vhost_started);
virtio_save(vdev, f);
qemu_put_buffer(f, ... | DoS Exec Code Overflow | 0 | static void virtio_net_save(QEMUFile *f, void *opaque)
{
int i;
VirtIONet *n = opaque;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
/* At this point, backend must be stopped, otherwise
* it might keep writing to memory. */
assert(!n->vhost_started);
virtio_save(vdev, f);
qemu_put_buffer(f, ... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,715 | static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
{
VirtIONet *n = VIRTIO_NET(vdev);
struct virtio_net_config netcfg = {};
memcpy(&netcfg, config, n->config_size);
if (!(vdev->guest_features >> VIRTIO_NET_F_CTRL_MAC_ADDR & 1) &&
memcmp(netcfg.mac, n->mac, ETH_ALEN)) ... | DoS Exec Code Overflow | 0 | static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
{
VirtIONet *n = VIRTIO_NET(vdev);
struct virtio_net_config netcfg = {};
memcpy(&netcfg, config, n->config_size);
if (!(vdev->guest_features >> VIRTIO_NET_F_CTRL_MAC_ADDR & 1) &&
memcmp(netcfg.mac, n->mac, ETH_ALEN)) ... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,716 | void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features)
{
int i, config_size = 0;
host_features |= (1 << VIRTIO_NET_F_MAC);
for (i = 0; feature_sizes[i].flags != 0; i++) {
if (host_features & feature_sizes[i].flags) {
config_size = MAX(feature_sizes[i].end, config_size);
... | DoS Exec Code Overflow | 0 | void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features)
{
int i, config_size = 0;
host_features |= (1 << VIRTIO_NET_F_MAC);
for (i = 0; feature_sizes[i].flags != 0; i++) {
if (host_features & feature_sizes[i].flags) {
config_size = MAX(feature_sizes[i].end, config_size);
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,717 | static void virtio_net_set_link_status(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
uint16_t old_status = n->status;
if (nc->link_down)
n->status &= ~VIRTIO_NET_S_LINK_UP;
else
n->status |= VIRTIO_NET_S_LINK_UP;
if (n->sta... | DoS Exec Code Overflow | 0 | static void virtio_net_set_link_status(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
uint16_t old_status = n->status;
if (nc->link_down)
n->status &= ~VIRTIO_NET_S_LINK_UP;
else
n->status |= VIRTIO_NET_S_LINK_UP;
if (n->sta... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,718 | static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs)
{
int i;
NetClientState *nc;
n->mergeable_rx_bufs = mergeable_rx_bufs;
n->guest_hdr_len = n->mergeable_rx_bufs ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
for (i = 0; i < n->max_queu... | DoS Exec Code Overflow | 0 | static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs)
{
int i;
NetClientState *nc;
n->mergeable_rx_bufs = mergeable_rx_bufs;
n->guest_hdr_len = n->mergeable_rx_bufs ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
for (i = 0; i < n->max_queu... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,719 | static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
int i, max = multiqueue ? n->max_queues : 1;
n->multiqueue = multiqueue;
for (i = 2; i <= n->max_queues * 2 + 1; i++) {
virtio_del_queue(vdev, i);
}
for (i = 1; i < max; i++) {... | DoS Exec Code Overflow | 0 | static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
int i, max = multiqueue ? n->max_queues : 1;
n->multiqueue = multiqueue;
for (i = 2; i <= n->max_queues * 2 + 1; i++) {
virtio_del_queue(vdev, i);
}
for (i = 1; i < max; i++) {... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,720 | static void virtio_net_set_queues(VirtIONet *n)
{
int i;
int r;
for (i = 0; i < n->max_queues; i++) {
if (i < n->curr_queues) {
r = peer_attach(n, i);
assert(!r);
} else {
r = peer_detach(n, i);
assert(!r);
}
}
}
| DoS Exec Code Overflow | 0 | static void virtio_net_set_queues(VirtIONet *n)
{
int i;
int r;
for (i = 0; i < n->max_queues; i++) {
if (i < n->curr_queues) {
r = peer_attach(n, i);
assert(!r);
} else {
r = peer_detach(n, i);
assert(!r);
}
}
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,721 | static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status)
{
VirtIONet *n = VIRTIO_NET(vdev);
VirtIONetQueue *q;
int i;
uint8_t queue_status;
virtio_net_vhost_status(n, status);
for (i = 0; i < n->max_queues; i++) {
q = &n->vqs[i];
if ((!n->multiqueue && i !=... | DoS Exec Code Overflow | 0 | static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status)
{
VirtIONet *n = VIRTIO_NET(vdev);
VirtIONetQueue *q;
int i;
uint8_t queue_status;
virtio_net_vhost_status(n, status);
for (i = 0; i < n->max_queues; i++) {
q = &n->vqs[i];
if ((!n->multiqueue && i !=... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,722 | static bool virtio_net_started(VirtIONet *n, uint8_t status)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
return (status & VIRTIO_CONFIG_S_DRIVER_OK) &&
(n->status & VIRTIO_NET_S_LINK_UP) && vdev->vm_running;
}
| DoS Exec Code Overflow | 0 | static bool virtio_net_started(VirtIONet *n, uint8_t status)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
return (status & VIRTIO_CONFIG_S_DRIVER_OK) &&
(n->status & VIRTIO_NET_S_LINK_UP) && vdev->vm_running;
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,723 | static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
virtqueue_push(q->tx_vq, &q->async_tx.elem, 0);
virtio_notify(vdev, q->tx_vq);
q->async_tx.elem.... | DoS Exec Code Overflow | 0 | static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
virtqueue_push(q->tx_vq, &q->async_tx.elem, 0);
virtio_notify(vdev, q->tx_vq);
q->async_tx.elem.... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,724 | static void virtio_net_tx_timer(void *opaque)
{
VirtIONetQueue *q = opaque;
VirtIONet *n = q->n;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
assert(vdev->vm_running);
q->tx_waiting = 0;
/* Just in case the driver is not ready on more */
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
... | DoS Exec Code Overflow | 0 | static void virtio_net_tx_timer(void *opaque)
{
VirtIONetQueue *q = opaque;
VirtIONet *n = q->n;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
assert(vdev->vm_running);
q->tx_waiting = 0;
/* Just in case the driver is not ready on more */
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,725 | static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
NetClientState *nc = qemu_get_queue(n->nic);
int queues = n->multiqueue ? n->max_queues : 1;
if (!nc->peer) {
return;
}
if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
... | DoS Exec Code Overflow | 0 | static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
NetClientState *nc = qemu_get_queue(n->nic);
int queues = n->multiqueue ? n->max_queues : 1;
if (!nc->peer) {
return;
}
if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,726 | static void virtio_register_types(void)
{
type_register_static(&virtio_net_info);
}
| DoS Exec Code Overflow | 0 | static void virtio_register_types(void)
{
type_register_static(&virtio_net_info);
}
| @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,727 | static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
uint8_t *buf, size_t size)
{
if ((hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && /* missing csum */
(size > 27 && size < 1500) && /* normal sized MTU */
(buf[12] == 0x08 && buf[13] == 0x00) && /... | DoS Exec Code Overflow | 0 | static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
uint8_t *buf, size_t size)
{
if ((hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && /* missing csum */
(size > 27 && size < 1500) && /* normal sized MTU */
(buf[12] == 0x08 && buf[13] == 0x00) && /... | @@ -1407,6 +1407,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
}
n->curr_queues = qemu_get_be16(f);
+ if (n->curr_queues > n->max_queues) {
+ error_report("virtio-net: curr_queues %x > max_queues %x",
+ n->curr_queues, n->max_qu... | CWE-119 | null | null |
12,728 | _csi_arg_get(Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int sum = 0;
while ((*b) && (*b < '0' || *b > '9')) b++;
if (!*b)
{
*ptr = NULL;
return 0;
}
while ((*b >= '0') && (*b <= '9'))
{
sum *= 10;
sum += *b - '0';
b++;
}
*ptr = b;
retu... | Exec Code | 0 | _csi_arg_get(Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int sum = 0;
while ((*b) && (*b < '0' || *b > '9')) b++;
if (!*b)
{
*ptr = NULL;
return 0;
}
while ((*b >= '0') && (*b <= '9'))
{
sum *= 10;
sum += *b - '0';
b++;
}
*ptr = b;
retu... | @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,729 | _eina_unicode_to_hex(Eina_Unicode u)
{
if (u >= '0' && u <= '9')
return u - '0';
if (u >= 'a' && u <= 'f')
return 10 + u - 'a';
if (u >= 'A' && u <= 'F')
return 10 + u - 'A';
return -1;
}
| Exec Code | 0 | _eina_unicode_to_hex(Eina_Unicode u)
{
if (u >= '0' && u <= '9')
return u - '0';
if (u >= 'a' && u <= 'f')
return 10 + u - 'a';
if (u >= 'A' && u <= 'F')
return 10 + u - 'A';
return -1;
}
| @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,730 | _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
{
switch (*cc)
{
case 0x07: // BEL '\a' (bell)
ty->termstate.had_cr = 0;
if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
return;
case 0x08: // BS '\b' (backspace)
DBG("->BS");
ty->term... | Exec Code | 0 | _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
{
switch (*cc)
{
case 0x07: // BEL '\a' (bell)
ty->termstate.had_cr = 0;
if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
return;
case 0x08: // BS '\b' (backspace)
DBG("->BS");
ty->term... | @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,731 | _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
{
int arg, i;
const Eina_Unicode *cc, *be;
Eina_Unicode buf[4096], *b;
cc = (Eina_Unicode *)c;
b = buf;
be = buf + sizeof(buf) / sizeof(buf[0]);
while ((cc < ce) && (*cc <= '?') && (b < be))
{
_handle_cursor_control... | Exec Code | 0 | _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
{
int arg, i;
const Eina_Unicode *cc, *be;
Eina_Unicode buf[4096], *b;
cc = (Eina_Unicode *)c;
b = buf;
be = buf + sizeof(buf) / sizeof(buf[0]);
while ((cc < ce) && (*cc <= '?') && (b < be))
{
_handle_cursor_control... | @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,732 | _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
{
int arg, len;
char bf[32];
if (*b == '>')
{
ERR("TODO: disable key resources used by xterm");
return;
}
if (*b == '?')
{
b++;
arg = _csi_arg_get(&b);
switch (arg)
{
case 6:
... | Exec Code | 0 | _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
{
int arg, len;
char bf[32];
if (*b == '>')
{
ERR("TODO: disable key resources used by xterm");
return;
}
if (*b == '?')
{
b++;
arg = _csi_arg_get(&b);
switch (arg)
{
case 6:
... | @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,733 | _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
{
int mode = 0, priv = 0, arg;
if (cc == 'h') mode = 1;
if (*b == '?')
{
priv = 1;
b++;
}
if (priv) /* DEC Private Mode Reset (DECRST) */
{
while (b)
{
arg = _csi_arg_get(... | Exec Code | 0 | _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
{
int mode = 0, priv = 0, arg;
if (cc == 'h') mode = 1;
if (*b == '?')
{
priv = 1;
b++;
}
if (priv) /* DEC Private Mode Reset (DECRST) */
{
while (b)
{
arg = _csi_arg_get(... | @@ -1303,12 +1303,8 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
goto err;
if (*p == '?')
{
- TERMPTY_WRITE_STR("\033]0;");
- if (ty->prop.title)
- {
- TERMPTY_WRITE_STR(ty->prop.title);
- }... | CWE-77 | null | null |
12,734 | static void msix_clr_pending(PCIDevice *dev, int vector)
{
*msix_pending_byte(dev, vector) &= ~msix_pending_mask(vector);
}
| DoS | 0 | static void msix_clr_pending(PCIDevice *dev, int vector)
{
*msix_pending_byte(dev, vector) &= ~msix_pending_mask(vector);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,735 | static void msix_fire_vector_notifier(PCIDevice *dev,
unsigned int vector, bool is_masked)
{
MSIMessage msg;
int ret;
if (!dev->msix_vector_use_notifier) {
return;
}
if (is_masked) {
dev->msix_vector_release_notifier(dev, vector);
} else {
... | DoS | 0 | static void msix_fire_vector_notifier(PCIDevice *dev,
unsigned int vector, bool is_masked)
{
MSIMessage msg;
int ret;
if (!dev->msix_vector_use_notifier) {
return;
}
if (is_masked) {
dev->msix_vector_release_notifier(dev, vector);
} else {
... | @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,736 | MSIMessage msix_get_message(PCIDevice *dev, unsigned vector)
{
uint8_t *table_entry = dev->msix_table + vector * PCI_MSIX_ENTRY_SIZE;
MSIMessage msg;
msg.address = pci_get_quad(table_entry + PCI_MSIX_ENTRY_LOWER_ADDR);
msg.data = pci_get_long(table_entry + PCI_MSIX_ENTRY_DATA);
return msg;
}
| DoS | 0 | MSIMessage msix_get_message(PCIDevice *dev, unsigned vector)
{
uint8_t *table_entry = dev->msix_table + vector * PCI_MSIX_ENTRY_SIZE;
MSIMessage msg;
msg.address = pci_get_quad(table_entry + PCI_MSIX_ENTRY_LOWER_ADDR);
msg.data = pci_get_long(table_entry + PCI_MSIX_ENTRY_DATA);
return msg;
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,737 | static void msix_handle_mask_update(PCIDevice *dev, int vector, bool was_masked)
{
bool is_masked = msix_is_masked(dev, vector);
if (is_masked == was_masked) {
return;
}
msix_fire_vector_notifier(dev, vector, is_masked);
if (!is_masked && msix_is_pending(dev, vector)) {
msix_clr_p... | DoS | 0 | static void msix_handle_mask_update(PCIDevice *dev, int vector, bool was_masked)
{
bool is_masked = msix_is_masked(dev, vector);
if (is_masked == was_masked) {
return;
}
msix_fire_vector_notifier(dev, vector, is_masked);
if (!is_masked && msix_is_pending(dev, vector)) {
msix_clr_p... | @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,738 | bool msix_is_masked(PCIDevice *dev, unsigned int vector)
{
return msix_vector_masked(dev, vector, dev->msix_function_masked);
}
| DoS | 0 | bool msix_is_masked(PCIDevice *dev, unsigned int vector)
{
return msix_vector_masked(dev, vector, dev->msix_function_masked);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,739 | static int msix_is_pending(PCIDevice *dev, int vector)
{
return *msix_pending_byte(dev, vector) & msix_pending_mask(vector);
}
| DoS | 0 | static int msix_is_pending(PCIDevice *dev, int vector)
{
return *msix_pending_byte(dev, vector) & msix_pending_mask(vector);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,740 | static uint8_t *msix_pending_byte(PCIDevice *dev, int vector)
{
return dev->msix_pba + vector / 8;
}
| DoS | 0 | static uint8_t *msix_pending_byte(PCIDevice *dev, int vector)
{
return dev->msix_pba + vector / 8;
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,741 | static uint8_t msix_pending_mask(int vector)
{
return 1 << (vector % 8);
}
| DoS | 0 | static uint8_t msix_pending_mask(int vector)
{
return 1 << (vector % 8);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,742 | void msix_set_message(PCIDevice *dev, int vector, struct MSIMessage msg)
{
uint8_t *table_entry = dev->msix_table + vector * PCI_MSIX_ENTRY_SIZE;
pci_set_quad(table_entry + PCI_MSIX_ENTRY_LOWER_ADDR, msg.address);
pci_set_long(table_entry + PCI_MSIX_ENTRY_DATA, msg.data);
table_entry[PCI_MSIX_ENTRY_VEC... | DoS | 0 | void msix_set_message(PCIDevice *dev, int vector, struct MSIMessage msg)
{
uint8_t *table_entry = dev->msix_table + vector * PCI_MSIX_ENTRY_SIZE;
pci_set_quad(table_entry + PCI_MSIX_ENTRY_LOWER_ADDR, msg.address);
pci_set_long(table_entry + PCI_MSIX_ENTRY_DATA, msg.data);
table_entry[PCI_MSIX_ENTRY_VEC... | @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,743 | void msix_set_pending(PCIDevice *dev, unsigned int vector)
{
*msix_pending_byte(dev, vector) |= msix_pending_mask(vector);
}
| DoS | 0 | void msix_set_pending(PCIDevice *dev, unsigned int vector)
{
*msix_pending_byte(dev, vector) |= msix_pending_mask(vector);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,744 | static uint64_t msix_table_mmio_read(void *opaque, hwaddr addr,
unsigned size)
{
PCIDevice *dev = opaque;
return pci_get_long(dev->msix_table + addr);
}
| DoS | 0 | static uint64_t msix_table_mmio_read(void *opaque, hwaddr addr,
unsigned size)
{
PCIDevice *dev = opaque;
return pci_get_long(dev->msix_table + addr);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,745 | static void msix_table_mmio_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
PCIDevice *dev = opaque;
int vector = addr / PCI_MSIX_ENTRY_SIZE;
bool was_masked;
was_masked = msix_is_masked(dev, vector);
pci_set_long(dev->msix_table + addr, val);
m... | DoS | 0 | static void msix_table_mmio_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
PCIDevice *dev = opaque;
int vector = addr / PCI_MSIX_ENTRY_SIZE;
bool was_masked;
was_masked = msix_is_masked(dev, vector);
pci_set_long(dev->msix_table + addr, val);
m... | @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,746 | static void msix_update_function_masked(PCIDevice *dev)
{
dev->msix_function_masked = !msix_enabled(dev) ||
(dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] & MSIX_MASKALL_MASK);
}
| DoS | 0 | static void msix_update_function_masked(PCIDevice *dev)
{
dev->msix_function_masked = !msix_enabled(dev) ||
(dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] & MSIX_MASKALL_MASK);
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,747 | static bool msix_vector_masked(PCIDevice *dev, unsigned int vector, bool fmask)
{
unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;
return fmask || dev->msix_table[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
| DoS | 0 | static bool msix_vector_masked(PCIDevice *dev, unsigned int vector, bool fmask)
{
unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;
return fmask || dev->msix_table[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
| @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,748 | void msix_write_config(PCIDevice *dev, uint32_t addr,
uint32_t val, int len)
{
unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
int vector;
bool was_masked;
if (!msix_present(dev) || !range_covers_byte(addr, len, enable_pos)) {
return;
}
was_masked = de... | DoS | 0 | void msix_write_config(PCIDevice *dev, uint32_t addr,
uint32_t val, int len)
{
unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
int vector;
bool was_masked;
if (!msix_present(dev) || !range_covers_byte(addr, len, enable_pos)) {
return;
}
was_masked = de... | @@ -200,8 +200,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
return pci_get_long(dev->msix_pba + addr);
}
+static void msix_pba_mmio_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+}
+
static const MemoryRegionOps msix_pba_mmio_ops = {
... | CWE-476 | null | null |
12,749 | bool ConvertFromMacLang ( const std::string & macValue, XMP_Uns16 macLang, std::string * utf8Value )
{
utf8Value->erase();
if ( ! IsMacLangKnown ( macLang ) ) return false;
#if XMP_MacBuild
XMP_Uns16 macScript = GetMacScript ( macLang );
ReconcileUtils::MacEncodingToUTF8 ( macScript, macLang, (XMP_Uns8*)macVal... | DoS | 0 | bool ConvertFromMacLang ( const std::string & macValue, XMP_Uns16 macLang, std::string * utf8Value )
{
utf8Value->erase();
if ( ! IsMacLangKnown ( macLang ) ) return false;
#if XMP_MacBuild
XMP_Uns16 macScript = GetMacScript ( macLang );
ReconcileUtils::MacEncodingToUTF8 ( macScript, macLang, (XMP_Uns8*)macVal... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,750 | bool ConvertToMacLang ( const std::string & utf8Value, XMP_Uns16 macLang, std::string * macValue )
{
macValue->erase();
if ( macLang == kNoMacLang ) macLang = 0; // *** Zero is English, ought to use the "active" OS lang.
if ( ! IsMacLangKnown ( macLang ) ) return false;
#if XMP_MacBuild
XMP_Uns16 macScript = Get... | DoS | 0 | bool ConvertToMacLang ( const std::string & utf8Value, XMP_Uns16 macLang, std::string * macValue )
{
macValue->erase();
if ( macLang == kNoMacLang ) macLang = 0; // *** Zero is English, ought to use the "active" OS lang.
if ( ! IsMacLangKnown ( macLang ) ) return false;
#if XMP_MacBuild
XMP_Uns16 macScript = Get... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,751 | void TradQT_Manager::ExportSimpleXMP ( XMP_Uns32 id, const SXMPMeta & xmp, XMP_StringPtr ns, XMP_StringPtr prop,
bool createWithZeroLang /* = false */ )
{
std::string xmpValue, macValue;
InfoMapPos infoPos = this->parsedBoxes.find ( id );
bool qtFound = (infoPos != this->parsedBoxes.end()) && (! infoPo... | DoS | 0 | void TradQT_Manager::ExportSimpleXMP ( XMP_Uns32 id, const SXMPMeta & xmp, XMP_StringPtr ns, XMP_StringPtr prop,
bool createWithZeroLang /* = false */ )
{
std::string xmpValue, macValue;
InfoMapPos infoPos = this->parsedBoxes.find ( id );
bool qtFound = (infoPos != this->parsedBoxes.end()) && (! infoPo... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,752 | static XMP_Uns32 GetIOSEncodingCF ( XMP_Uns16 macLang )
{
XMP_Uns32 encCF = kCFStringEncodingInvalidId;
if ( macLang <= 94 ) encCF = kMacToIOSEncodingCF_0_94[macLang];
if ( encCF == kCFStringEncodingInvalidId || !CFStringIsEncodingAvailable(encCF)) {
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macSc... | DoS | 0 | static XMP_Uns32 GetIOSEncodingCF ( XMP_Uns16 macLang )
{
XMP_Uns32 encCF = kCFStringEncodingInvalidId;
if ( macLang <= 94 ) encCF = kMacToIOSEncodingCF_0_94[macLang];
if ( encCF == kCFStringEncodingInvalidId || !CFStringIsEncodingAvailable(encCF)) {
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macSc... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,753 | static XMP_Uns16 GetMacScript ( XMP_Uns16 macLang )
{
XMP_Uns16 macScript = kNoMacScript;
if ( macLang <= 94 ) {
macScript = kMacLangToScript_0_94[macLang];
} else if ( (128 <= macLang) && (macLang <= 151) ) {
macScript = kMacLangToScript_128_151[macLang-128];
}
return macScript;
} // GetMacScript
| DoS | 0 | static XMP_Uns16 GetMacScript ( XMP_Uns16 macLang )
{
XMP_Uns16 macScript = kNoMacScript;
if ( macLang <= 94 ) {
macScript = kMacLangToScript_0_94[macLang];
} else if ( (128 <= macLang) && (macLang <= 151) ) {
macScript = kMacLangToScript_128_151[macLang-128];
}
return macScript;
} // GetMacScript
| @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,754 | static UINT GetWinCP ( XMP_Uns16 macLang )
{
UINT winCP = 0;
if ( macLang <= 94 ) winCP = kMacToWinCP_0_94[macLang];
if ( winCP == 0 ) {
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macScript != kNoMacScript ) winCP = kMacScriptToWinCP[macScript];
}
return winCP;
} // GetWinCP
| DoS | 0 | static UINT GetWinCP ( XMP_Uns16 macLang )
{
UINT winCP = 0;
if ( macLang <= 94 ) winCP = kMacToWinCP_0_94[macLang];
if ( winCP == 0 ) {
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macScript != kNoMacScript ) winCP = kMacScriptToWinCP[macScript];
}
return winCP;
} // GetWinCP
| @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,755 | bool TradQT_Manager::ImportLangAltXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr langArray ) const
{
try {
InfoMapCPos infoPos = this->parsedBoxes.find ( id );
if ( infoPos == this->parsedBoxes.end() ) return false;
if ( infoPos->second.values.empty() ) return false; // Quit now if there a... | DoS | 0 | bool TradQT_Manager::ImportLangAltXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr langArray ) const
{
try {
InfoMapCPos infoPos = this->parsedBoxes.find ( id );
if ( infoPos == this->parsedBoxes.end() ) return false;
if ( infoPos->second.values.empty() ) return false; // Quit now if there a... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,756 | bool TradQT_Manager::ImportSimpleXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr prop ) const
{
try {
InfoMapCPos infoPos = this->parsedBoxes.find ( id );
if ( infoPos == this->parsedBoxes.end() ) return false;
if ( infoPos->second.values.empty() ) return false;
std::string xmpValue, t... | DoS | 0 | bool TradQT_Manager::ImportSimpleXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr prop ) const
{
try {
InfoMapCPos infoPos = this->parsedBoxes.find ( id );
if ( infoPos == this->parsedBoxes.end() ) return false;
if ( infoPos->second.values.empty() ) return false;
std::string xmpValue, t... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,757 | static inline bool IsMacLangKnown ( XMP_Uns16 macLang )
{
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macScript == kNoMacScript ) return false;
#if XMP_UNIXBuild
if ( macScript != smRoman ) return false;
#elif XMP_WinBuild
if ( GetWinCP(macLang) == 0 ) return false;
#endif
return true;
} // IsMac... | DoS | 0 | static inline bool IsMacLangKnown ( XMP_Uns16 macLang )
{
XMP_Uns16 macScript = GetMacScript ( macLang );
if ( macScript == kNoMacScript ) return false;
#if XMP_UNIXBuild
if ( macScript != smRoman ) return false;
#elif XMP_WinBuild
if ( GetWinCP(macLang) == 0 ) return false;
#endif
return true;
} // IsMac... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,758 | static void MacRomanToUTF8 ( const std::string & macRoman, std::string * utf8 )
{
utf8->erase();
for ( XMP_Uns8* chPtr = (XMP_Uns8*)macRoman.c_str(); *chPtr != 0; ++chPtr ) { // ! Don't trust that char is unsigned.
if ( *chPtr < 0x80 ) {
(*utf8) += (char)*chPtr;
} else {
(*utf8) += kMacRomanUTF8[(*chPtr)-... | DoS | 0 | static void MacRomanToUTF8 ( const std::string & macRoman, std::string * utf8 )
{
utf8->erase();
for ( XMP_Uns8* chPtr = (XMP_Uns8*)macRoman.c_str(); *chPtr != 0; ++chPtr ) { // ! Don't trust that char is unsigned.
if ( *chPtr < 0x80 ) {
(*utf8) += (char)*chPtr;
} else {
(*utf8) += kMacRomanUTF8[(*chPtr)-... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,759 | static void UTF8ToMacRoman ( const std::string & utf8, std::string * macRoman )
{
macRoman->erase();
bool inNonMRSpan = false;
for ( const XMP_Uns8 * chPtr = (XMP_Uns8*)utf8.c_str(); *chPtr != 0; ++chPtr ) { // ! Don't trust that char is unsigned.
if ( *chPtr < 0x80 ) {
(*macRoman) += (char)*chPtr;
inNonMR... | DoS | 0 | static void UTF8ToMacRoman ( const std::string & utf8, std::string * macRoman )
{
macRoman->erase();
bool inNonMRSpan = false;
for ( const XMP_Uns8 * chPtr = (XMP_Uns8*)utf8.c_str(); *chPtr != 0; ++chPtr ) { // ! Don't trust that char is unsigned.
if ( *chPtr < 0x80 ) {
(*macRoman) += (char)*chPtr;
inNonMR... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,760 | void TradQT_Manager::UpdateChangedBoxes ( MOOV_Manager * moovMgr )
{
MOOV_Manager::BoxInfo udtaInfo;
MOOV_Manager::BoxRef udtaRef = moovMgr->GetBox ( "moov/udta", &udtaInfo );
XMP_Assert ( (udtaRef != 0) || (udtaInfo.childCount == 0) );
if ( udtaRef != 0 ) { // Might not have been a moov/udta box in the parse.
... | DoS | 0 | void TradQT_Manager::UpdateChangedBoxes ( MOOV_Manager * moovMgr )
{
MOOV_Manager::BoxInfo udtaInfo;
MOOV_Manager::BoxRef udtaRef = moovMgr->GetBox ( "moov/udta", &udtaInfo );
XMP_Assert ( (udtaRef != 0) || (udtaInfo.childCount == 0) );
if ( udtaRef != 0 ) { // Might not have been a moov/udta box in the parse.
... | @@ -920,7 +920,8 @@ bool TradQT_Manager::ParseCachedBoxes ( const MOOV_Manager & moovMgr )
miniLen = 4 + GetUns16BE ( boxPtr ); // ! Include header in local miniLen.
macLang = GetUns16BE ( boxPtr+2);
- if ( (miniLen <= 4) || (miniLen > (boxEnd - boxPtr)) ) continue; // Ignore bad or empty values.
+ if ( ... | CWE-835 | null | null |
12,761 | static void AdjustYearIfNeeded(short &year)
{
if (year<100)
{
if (year >40)
{
year=1900+year;
}
else
{
year=2000+year;
}
}
}
| DoS | 0 | static void AdjustYearIfNeeded(short &year)
{
if (year<100)
{
if (year >40)
{
year=1900+year;
}
else
{
year=2000+year;
}
}
}
| @@ -814,7 +814,8 @@ std::string PostScript_Support::ConvertToDate(const char* inString)
std::vector<PostScript_Support::DateTimeTokens>:: const_iterator itr=tokenzs.begin();
for(;itr!=tokenzs.end();itr++)
{
- if(itr->token[0]=='+' ||itr->token[0]=='-')
+ // token[0] is invalid on an empty string. -- Hub
+ if(!... | CWE-476 | null | null |
12,762 | ASF_LegacyManager::ASF_LegacyManager() : fields(fieldLast), broadcastSet(false), digestComputed(false),
imported(false), objectsExisting(0), objectsToExport(0), legacyDiff(0), padding(0)
{
}
| DoS | 0 | ASF_LegacyManager::ASF_LegacyManager() : fields(fieldLast), broadcastSet(false), digestComputed(false),
imported(false), objectsExisting(0), objectsToExport(0), legacyDiff(0), padding(0)
{
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,763 | ASF_Support::ASF_Support() : legacyManager(0),progressTracker(0), posFileSizeInfo(0) {}
| DoS | 0 | ASF_Support::ASF_Support() : legacyManager(0),progressTracker(0), posFileSizeInfo(0) {}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,764 | void ASF_LegacyManager::ComputeDigest()
{
MD5_CTX context;
MD5_Digest digest;
char buffer[40];
MD5Init ( &context );
digestStr.clear();
digestStr.reserve ( 160 );
for ( int type=0; type < fieldLast; ++type ) {
if (fields[type].size ( ) > 0 ) {
snprintf ( buffer, sizeof(buffer), "%d,", type );
digestSt... | DoS | 0 | void ASF_LegacyManager::ComputeDigest()
{
MD5_CTX context;
MD5_Digest digest;
char buffer[40];
MD5Init ( &context );
digestStr.clear();
digestStr.reserve ( 160 );
for ( int type=0; type < fieldLast; ++type ) {
if (fields[type].size ( ) > 0 ) {
snprintf ( buffer, sizeof(buffer), "%d,", type );
digestSt... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,765 | void ASF_LegacyManager::ConvertISODateToMSDate ( std::string& source, std::string* dest )
{
XMP_DateTime date;
SXMPUtils::ConvertToDate ( source, &date );
SXMPUtils::ConvertToUTCTime ( &date );
XMP_Int64 creationDate;
creationDate = date.nanoSecond / 100;
creationDate += (XMP_Int64 ( date.second) * (10*1000*1000... | DoS | 0 | void ASF_LegacyManager::ConvertISODateToMSDate ( std::string& source, std::string* dest )
{
XMP_DateTime date;
SXMPUtils::ConvertToDate ( source, &date );
SXMPUtils::ConvertToUTCTime ( &date );
XMP_Int64 creationDate;
creationDate = date.nanoSecond / 100;
creationDate += (XMP_Int64 ( date.second) * (10*1000*1000... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,766 | void ASF_LegacyManager::ConvertMSDateToISODate ( std::string& source, std::string* dest )
{
XMP_Int64 creationDate = GetUns64LE ( source.c_str() );
XMP_Int64 totalSecs = creationDate / (10*1000*1000);
XMP_Int32 nanoSec = ( ( XMP_Int32) (creationDate - (totalSecs * 10*1000*1000)) ) * 100;
XMP_Int32 days = (XMP_Int... | DoS | 0 | void ASF_LegacyManager::ConvertMSDateToISODate ( std::string& source, std::string* dest )
{
XMP_Int64 creationDate = GetUns64LE ( source.c_str() );
XMP_Int64 totalSecs = creationDate / (10*1000*1000);
XMP_Int32 nanoSec = ( ( XMP_Int32) (creationDate - (totalSecs * 10*1000*1000)) ) * 100;
XMP_Int32 days = (XMP_Int... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,767 | bool ASF_Support::CopyObject ( XMP_IO* sourceRef, XMP_IO* destRef, const ObjectData& object )
{
try {
sourceRef->Seek ( object.pos, kXMP_SeekFromStart );
XIO::Copy ( sourceRef, destRef, object.len );
} catch ( ... ) {
return false;
}
return true;
}
| DoS | 0 | bool ASF_Support::CopyObject ( XMP_IO* sourceRef, XMP_IO* destRef, const ObjectData& object )
{
try {
sourceRef->Seek ( object.pos, kXMP_SeekFromStart );
XIO::Copy ( sourceRef, destRef, object.len );
} catch ( ... ) {
return false;
}
return true;
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,768 | bool ASF_Support::CreatePaddingObject ( std::string* header, const XMP_Uns64 size )
{
if ( ( ! header) || (size < 24) ) return false;
ASF_ObjectBase newObjectBase;
newObjectBase.guid = ASF_Padding_Object;
newObjectBase.size = MakeUns64LE ( size );
header->append ( (const char*)&newObjectBase, kASF_ObjectBaseLen... | DoS | 0 | bool ASF_Support::CreatePaddingObject ( std::string* header, const XMP_Uns64 size )
{
if ( ( ! header) || (size < 24) ) return false;
ASF_ObjectBase newObjectBase;
newObjectBase.guid = ASF_Padding_Object;
newObjectBase.size = MakeUns64LE ( size );
header->append ( (const char*)&newObjectBase, kASF_ObjectBaseLen... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,769 | int ASF_LegacyManager::ExportLegacy ( const SXMPMeta& xmp )
{
int changed = 0;
objectsToExport = 0;
legacyDiff = 0;
std::string utf8;
std::string utf16;
XMP_OptionBits flags;
if ( ! broadcastSet ) {
if ( xmp.GetProperty ( kXMP_NS_XMP, "CreateDate", &utf8, &flags ) ) {
std::string date;
ConvertISODateTo... | DoS | 0 | int ASF_LegacyManager::ExportLegacy ( const SXMPMeta& xmp )
{
int changed = 0;
objectsToExport = 0;
legacyDiff = 0;
std::string utf8;
std::string utf16;
XMP_OptionBits flags;
if ( ! broadcastSet ) {
if ( xmp.GetProperty ( kXMP_NS_XMP, "CreateDate", &utf8, &flags ) ) {
std::string date;
ConvertISODateTo... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,770 | bool ASF_LegacyManager::GetBroadcast()
{
return broadcastSet;
}
| DoS | 0 | bool ASF_LegacyManager::GetBroadcast()
{
return broadcastSet;
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,771 | std::string ASF_LegacyManager::GetField ( fieldType field )
{
if ( field >= fieldLast ) return std::string();
return fields[field];
}
| DoS | 0 | std::string ASF_LegacyManager::GetField ( fieldType field )
{
if ( field >= fieldLast ) return std::string();
return fields[field];
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,772 | unsigned int ASF_LegacyManager::GetFieldMaxSize ( fieldType field )
{
unsigned int maxSize = 0;
switch ( field ) {
case fieldCreationDate :
maxSize = 8;
break;
case fieldTitle :
case fieldAuthor :
case fieldCopyright :
case fieldDescription :
maxSize = 0xFFFF;
break;
case fieldCopyrightURL... | DoS | 0 | unsigned int ASF_LegacyManager::GetFieldMaxSize ( fieldType field )
{
unsigned int maxSize = 0;
switch ( field ) {
case fieldCreationDate :
maxSize = 8;
break;
case fieldTitle :
case fieldAuthor :
case fieldCopyright :
case fieldDescription :
maxSize = 0xFFFF;
break;
case fieldCopyrightURL... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,773 | XMP_Int64 ASF_LegacyManager::GetPadding()
{
return padding;
}
| DoS | 0 | XMP_Int64 ASF_LegacyManager::GetPadding()
{
return padding;
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,774 | void ASF_LegacyManager::ImportLegacy ( SXMPMeta* xmp )
{
std::string utf8;
if ( ! broadcastSet ) {
ConvertMSDateToISODate ( fields[fieldCreationDate], &utf8 );
if ( ! utf8.empty() ) xmp->SetProperty ( kXMP_NS_XMP, "CreateDate", utf8.c_str(), kXMP_DeleteExisting );
}
FromUTF16 ( (UTF16Unit*)fields[fieldTitle].... | DoS | 0 | void ASF_LegacyManager::ImportLegacy ( SXMPMeta* xmp )
{
std::string utf8;
if ( ! broadcastSet ) {
ConvertMSDateToISODate ( fields[fieldCreationDate], &utf8 );
if ( ! utf8.empty() ) xmp->SetProperty ( kXMP_NS_XMP, "CreateDate", utf8.c_str(), kXMP_DeleteExisting );
}
FromUTF16 ( (UTF16Unit*)fields[fieldTitle].... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,775 | int IsEqualGUID ( const GUID& guid1, const GUID& guid2 )
{
return (memcmp ( &guid1, &guid2, sizeof(GUID) ) == 0);
}
| DoS | 0 | int IsEqualGUID ( const GUID& guid1, const GUID& guid2 )
{
return (memcmp ( &guid1, &guid2, sizeof(GUID) ) == 0);
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,776 | bool ASF_LegacyManager::IsLeapYear ( long year )
{
if ( year < 0 ) year = -year + 1; // Fold the negative years, assuming there is a year 0.
if ( (year % 4) != 0 ) return false; // Not a multiple of 4.
if ( (year % 100) != 0 ) return true; // A multiple of 4 but not a multiple of 100.
if ( (year % 400) == 0 ) r... | DoS | 0 | bool ASF_LegacyManager::IsLeapYear ( long year )
{
if ( year < 0 ) year = -year + 1; // Fold the negative years, assuming there is a year 0.
if ( (year % 4) != 0 ) return false; // Not a multiple of 4.
if ( (year % 100) != 0 ) return true; // A multiple of 4 but not a multiple of 100.
if ( (year % 400) == 0 ) r... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,777 | std::string ASF_LegacyManager::NormalizeStringDisplayASCII ( std::string& operand )
{
std::basic_string<char>::iterator current = operand.begin();
std::basic_string<char>::iterator end = operand.end();;
for ( ; (current != end); ++current ) {
char element = *current;
if ( ( (element < 0x21) && (element != 0x00)... | DoS | 0 | std::string ASF_LegacyManager::NormalizeStringDisplayASCII ( std::string& operand )
{
std::basic_string<char>::iterator current = operand.begin();
std::basic_string<char>::iterator end = operand.end();;
for ( ; (current != end); ++current ) {
char element = *current;
if ( ( (element < 0x21) && (element != 0x00)... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,778 | std::string ASF_LegacyManager::NormalizeStringTrailingNull ( std::string& operand )
{
if ( ( operand.size() > 0) && (operand[operand.size() - 1] != '\0') ) {
operand.append ( 1, '\0' );
}
return operand;
}
| DoS | 0 | std::string ASF_LegacyManager::NormalizeStringTrailingNull ( std::string& operand )
{
if ( ( operand.size() > 0) && (operand[operand.size() - 1] != '\0') ) {
operand.append ( 1, '\0' );
}
return operand;
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,779 | long ASF_Support::OpenASF ( XMP_IO* fileRef, ObjectState & inOutObjectState )
{
XMP_Uns64 pos = 0;
XMP_Uns64 len;
try {
pos = fileRef->Rewind();
} catch ( ... ) {}
if ( pos != 0 ) return 0;
while ( ReadObject ( fileRef, inOutObjectState, &len, pos) ) {}
return inOutObjectState.objects.size();
}
| DoS | 0 | long ASF_Support::OpenASF ( XMP_IO* fileRef, ObjectState & inOutObjectState )
{
XMP_Uns64 pos = 0;
XMP_Uns64 len;
try {
pos = fileRef->Rewind();
} catch ( ... ) {}
if ( pos != 0 ) return 0;
while ( ReadObject ( fileRef, inOutObjectState, &len, pos) ) {}
return inOutObjectState.objects.size();
}
| @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,780 | bool ASF_Support::ReadBuffer ( XMP_IO* fileRef, XMP_Uns64 & pos, XMP_Uns64 len, char * outBuffer )
{
try {
if ( (fileRef == 0) || (outBuffer == 0) ) return false;
fileRef->Seek ( pos, kXMP_SeekFromStart );
long bytesRead = fileRef->ReadAll ( outBuffer, XMP_Int32(len) );
if ( XMP_Uns32 ( bytesRead ) != len ... | DoS | 0 | bool ASF_Support::ReadBuffer ( XMP_IO* fileRef, XMP_Uns64 & pos, XMP_Uns64 len, char * outBuffer )
{
try {
if ( (fileRef == 0) || (outBuffer == 0) ) return false;
fileRef->Seek ( pos, kXMP_SeekFromStart );
long bytesRead = fileRef->ReadAll ( outBuffer, XMP_Int32(len) );
if ( XMP_Uns32 ( bytesRead ) != len ... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,781 | bool ASF_Support::ReadHeaderExtensionObject ( XMP_IO* fileRef, ObjectState& inOutObjectState, const XMP_Uns64& _pos, const ASF_ObjectBase& _objectBase )
{
if ( ! IsEqualGUID ( ASF_Header_Extension_Object, _objectBase.guid) || (! legacyManager ) ) return false;
try {
const XMP_Uns64 offset = 46;
XMP_Uns64 read =... | DoS | 0 | bool ASF_Support::ReadHeaderExtensionObject ( XMP_IO* fileRef, ObjectState& inOutObjectState, const XMP_Uns64& _pos, const ASF_ObjectBase& _objectBase )
{
if ( ! IsEqualGUID ( ASF_Header_Extension_Object, _objectBase.guid) || (! legacyManager ) ) return false;
try {
const XMP_Uns64 offset = 46;
XMP_Uns64 read =... | @@ -270,6 +270,8 @@ bool ASF_Support::ReadHeaderObject ( XMP_IO* fileRef, ObjectState& inOutObjectSt
this->ReadHeaderExtensionObject ( fileRef, inOutObjectState, pos, objectBase );
+ } else if (objectBase.size == 0) {
+ break;
}
pos += objectBase.size; | CWE-835 | null | null |
12,782 | Container::Container(WEBP_MetaHandler* handler) : Chunk(NULL, handler)
{
this->needsRewrite = false;
XMP_IO* file = handler->parent->ioRef;
file->Seek(12, kXMP_SeekFromStart);
XMP_Int64 size = handler->initialFileSize;
XMP_Uns32 peek = 0;
while (file->Offset() < size) {
peek = XIO::... | DoS | 0 | Container::Container(WEBP_MetaHandler* handler) : Chunk(NULL, handler)
{
this->needsRewrite = false;
XMP_IO* file = handler->parent->ioRef;
file->Seek(12, kXMP_SeekFromStart);
XMP_Int64 size = handler->initialFileSize;
XMP_Uns32 peek = 0;
while (file->Offset() < size) {
peek = XIO::... | @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,783 | VP8XChunk::VP8XChunk(Container* parent)
: Chunk(parent, kChunk_VP8X)
{
this->needsRewrite = true;
this->size = 10;
this->data.resize(this->size);
this->data.assign(this->size, 0);
XMP_Uns8* bitstream =
(XMP_Uns8*)parent->chunks[WEBP_CHUNK_IMAGE][0]->data.data();
XMP_Uns32 width = ((bit... | DoS | 0 | VP8XChunk::VP8XChunk(Container* parent)
: Chunk(parent, kChunk_VP8X)
{
this->needsRewrite = true;
this->size = 10;
this->data.resize(this->size);
this->data.assign(this->size, 0);
XMP_Uns8* bitstream =
(XMP_Uns8*)parent->chunks[WEBP_CHUNK_IMAGE][0]->data.data();
XMP_Uns32 width = ((bit... | @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,784 | void Container::addChunk(Chunk* chunk)
{
ChunkId idx;
try {
idx = chunkMap.at(chunk->tag);
}
catch (const std::out_of_range& e) {
idx = WEBP_CHUNK_UNKNOWN;
}
this->chunks[idx].push_back(chunk);
}
| DoS | 0 | void Container::addChunk(Chunk* chunk)
{
ChunkId idx;
try {
idx = chunkMap.at(chunk->tag);
}
catch (const std::out_of_range& e) {
idx = WEBP_CHUNK_UNKNOWN;
}
this->chunks[idx].push_back(chunk);
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,785 | Chunk* Container::getExifChunk()
{
if (this->chunks[WEBP::WEBP_CHUNK_EXIF].size() == 0) {
return NULL;
}
return this->chunks[WEBP::WEBP_CHUNK_EXIF][0];
}
| DoS | 0 | Chunk* Container::getExifChunk()
{
if (this->chunks[WEBP::WEBP_CHUNK_EXIF].size() == 0) {
return NULL;
}
return this->chunks[WEBP::WEBP_CHUNK_EXIF][0];
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,786 | XMP_Uns32 VP8XChunk::height()
{
return GetLE24(&this->data[7]) + 1;
}
| DoS | 0 | XMP_Uns32 VP8XChunk::height()
{
return GetLE24(&this->data[7]) + 1;
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,787 | XMP_Uns32 VP8XChunk::width()
{
return GetLE24(&this->data[4]) + 1;
}
| DoS | 0 | XMP_Uns32 VP8XChunk::width()
{
return GetLE24(&this->data[4]) + 1;
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,788 | void Container::write(WEBP_MetaHandler* handler)
{
XMP_IO* file = handler->parent->ioRef;
file->Rewind();
XIO::WriteUns32_LE(file, this->tag);
XIO::WriteUns32_LE(file, (XMP_Uns32) this->size);
XIO::WriteUns32_LE(file, kChunk_WEBP);
size_t i, j;
std::vector<Chunk*> chunkVect;
for (i = 0;... | DoS | 0 | void Container::write(WEBP_MetaHandler* handler)
{
XMP_IO* file = handler->parent->ioRef;
file->Rewind();
XIO::WriteUns32_LE(file, this->tag);
XIO::WriteUns32_LE(file, (XMP_Uns32) this->size);
XIO::WriteUns32_LE(file, kChunk_WEBP);
size_t i, j;
std::vector<Chunk*> chunkVect;
for (i = 0;... | @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,789 | bool VP8XChunk::xmp()
{
XMP_Uns32 flags = GetLE32(&this->data[0]);
return (bool)((flags >> XMP_FLAG_BIT) & 1);
}
| DoS | 0 | bool VP8XChunk::xmp()
{
XMP_Uns32 flags = GetLE32(&this->data[0]);
return (bool)((flags >> XMP_FLAG_BIT) & 1);
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,790 | void VP8XChunk::xmp(bool hasXMP)
{
XMP_Uns32 flags = GetLE32(&this->data[0]);
flags ^= (-hasXMP ^ flags) & (1 << XMP_FLAG_BIT);
PutLE32(&this->data[0], flags);
}
| DoS | 0 | void VP8XChunk::xmp(bool hasXMP)
{
XMP_Uns32 flags = GetLE32(&this->data[0]);
flags ^= (-hasXMP ^ flags) & (1 << XMP_FLAG_BIT);
PutLE32(&this->data[0], flags);
}
| @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,791 | Container::~Container()
{
Chunk* chunk;
size_t i;
std::vector<Chunk*> chunkVect;
for (i = 0; i < WEBP_CHUNK_NIL; i++) {
chunkVect = this->chunks[i];
while (!chunkVect.empty()) {
chunk = chunkVect.back();
delete chunk;
chunkVect.pop_back();
}
... | DoS | 0 | Container::~Container()
{
Chunk* chunk;
size_t i;
std::vector<Chunk*> chunkVect;
for (i = 0; i < WEBP_CHUNK_NIL; i++) {
chunkVect = this->chunks[i];
while (!chunkVect.empty()) {
chunk = chunkVect.back();
delete chunk;
chunkVect.pop_back();
}
... | @@ -141,7 +141,7 @@ XMP_Uns32 VP8XChunk::width()
}
void VP8XChunk::width(XMP_Uns32 val)
{
- PutLE24(&this->data[4], val - 1);
+ PutLE24(&this->data[4], val > 0 ? val - 1 : 0);
}
XMP_Uns32 VP8XChunk::height()
{
@@ -149,7 +149,7 @@ XMP_Uns32 VP8XChunk::height()
}
void VP8XChunk::height(XMP_Uns32 val)
{
- ... | CWE-20 | null | null |
12,792 | static bool DecodeRational ( const char * ratio, XMP_Uns32 * num, XMP_Uns32 * denom ) {
unsigned long locNum, locDenom;
char nextChar; // Used to make sure sscanf consumes all of the string.
int items = sscanf ( ratio, "%lu/%lu%c", &locNum, &locDenom, &nextChar ); // AUDIT: This is safe, check the calls.
if ( it... | DoS | 0 | static bool DecodeRational ( const char * ratio, XMP_Uns32 * num, XMP_Uns32 * denom ) {
unsigned long locNum, locDenom;
char nextChar; // Used to make sure sscanf consumes all of the string.
int items = sscanf ( ratio, "%lu/%lu%c", &locNum, &locDenom, &nextChar ); // AUDIT: This is safe, check the calls.
if ( it... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,793 | ExportArrayTIFF ( TIFF_Manager * tiff, XMP_Uns8 ifd, const TIFF_MappingToXMP & mapInfo, bool nativeEndian,
const SXMPMeta & xmp, const char * xmpNS, const char * xmpArray )
{
XMP_Assert ( (mapInfo.count != 1) && (mapInfo.type != kTIFF_ASCIIType) );
XMP_Assert ( mapInfo.name[0] != 0 ); // Must be a standard mapp... | DoS | 0 | ExportArrayTIFF ( TIFF_Manager * tiff, XMP_Uns8 ifd, const TIFF_MappingToXMP & mapInfo, bool nativeEndian,
const SXMPMeta & xmp, const char * xmpNS, const char * xmpArray )
{
XMP_Assert ( (mapInfo.count != 1) && (mapInfo.type != kTIFF_ASCIIType) );
XMP_Assert ( mapInfo.name[0] != 0 ); // Must be a standard mapp... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,794 | PhotoDataUtils::ExportExif ( SXMPMeta * xmp, TIFF_Manager * exif )
{
bool haveXMP;
std::string xmpValue;
XMP_Int32 int32;
XMP_Uns8 uns8;
#if SupportOldExifProperties
XMP_OptionBits flags;
haveXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "PhotographicSensitivity" );
if ( ! haveXMP ) {
haveXMP = ... | DoS | 0 | PhotoDataUtils::ExportExif ( SXMPMeta * xmp, TIFF_Manager * exif )
{
bool haveXMP;
std::string xmpValue;
XMP_Int32 int32;
XMP_Uns8 uns8;
#if SupportOldExifProperties
XMP_OptionBits flags;
haveXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "PhotographicSensitivity" );
if ( ! haveXMP ) {
haveXMP = ... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,795 | ExportSingleTIFF ( TIFF_Manager * tiff, XMP_Uns8 ifd, const TIFF_MappingToXMP & mapInfo,
bool nativeEndian, const std::string & xmpValue )
{
XMP_Assert ( (mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType) );
XMP_Assert ( mapInfo.name[0] != 0 ); // Must be a standard mapping.
bool ok;
char nextChar; ... | DoS | 0 | ExportSingleTIFF ( TIFF_Manager * tiff, XMP_Uns8 ifd, const TIFF_MappingToXMP & mapInfo,
bool nativeEndian, const std::string & xmpValue )
{
XMP_Assert ( (mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType) );
XMP_Assert ( mapInfo.name[0] != 0 ); // Must be a standard mapping.
bool ok;
char nextChar; ... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,796 | ExportTIFF_Date ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp, TIFF_Manager * tiff, XMP_Uns16 mainID )
{
XMP_Uns8 mainIFD = kTIFF_ExifIFD;
XMP_Uns16 fracID=0;
switch ( mainID ) {
case kTIFF_DateTime : mainIFD = kTIFF_PrimaryIFD; fracID = kTIFF_SubSecTime; break;
case kTIFF_DateTimeOriginal : ... | DoS | 0 | ExportTIFF_Date ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp, TIFF_Manager * tiff, XMP_Uns16 mainID )
{
XMP_Uns8 mainIFD = kTIFF_ExifIFD;
XMP_Uns16 fracID=0;
switch ( mainID ) {
case kTIFF_DateTime : mainIFD = kTIFF_PrimaryIFD; fracID = kTIFF_SubSecTime; break;
case kTIFF_DateTimeOriginal : ... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,797 | ExportTIFF_EncodedString ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp,
TIFF_Manager * tiff, XMP_Uns8 ifd, XMP_Uns16 id, bool isLangAlt = false )
{
try { // Don't let errors with one stop the others.
std::string xmpValue;
XMP_OptionBits xmpFlags;
bool foundXMP = xmp.GetProperty (... | DoS | 0 | ExportTIFF_EncodedString ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp,
TIFF_Manager * tiff, XMP_Uns8 ifd, XMP_Uns16 id, bool isLangAlt = false )
{
try { // Don't let errors with one stop the others.
std::string xmpValue;
XMP_OptionBits xmpFlags;
bool foundXMP = xmp.GetProperty (... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,798 | ExportTIFF_GPSCoordinate ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp,
TIFF_Manager * tiff, XMP_Uns8 ifd, XMP_Uns16 _id )
{
XMP_Uns16 refID = _id-1; // ! The GPS refs and locations are all tag N-1 and N pairs.
XMP_Uns16 locID = _id;
XMP_Assert ( (locID & 1) == 0 );
try { // Don't let ... | DoS | 0 | ExportTIFF_GPSCoordinate ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp,
TIFF_Manager * tiff, XMP_Uns8 ifd, XMP_Uns16 _id )
{
XMP_Uns16 refID = _id-1; // ! The GPS refs and locations are all tag N-1 and N pairs.
XMP_Uns16 locID = _id;
XMP_Assert ( (locID & 1) == 0 );
try { // Don't let ... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
12,799 | ExportTIFF_GPSTimeStamp ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp, TIFF_Manager * tiff )
{
try { // Don't let errors with one stop the others.
XMP_DateTime binXMP;
bool foundXMP = xmp.GetProperty_Date ( xmpNS, xmpProp, &binXMP, 0 );
if ( ! foundXMP ) {
tiff->DeleteTag ( kTIFF_GPSInfo... | DoS | 0 | ExportTIFF_GPSTimeStamp ( const SXMPMeta & xmp, const char * xmpNS, const char * xmpProp, TIFF_Manager * tiff )
{
try { // Don't let errors with one stop the others.
XMP_DateTime binXMP;
bool foundXMP = xmp.GetProperty_Date ( xmpNS, xmpProp, &binXMP, 0 );
if ( ! foundXMP ) {
tiff->DeleteTag ( kTIFF_GPSInfo... | @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*la... | CWE-416 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.