CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2016-9794
https://www.cvedetails.com/cve/CVE-2016-9794/
CWE-416
https://github.com/torvalds/linux/commit/3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4
3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4
ALSA: pcm : Call kill_fasync() in stream lock Currently kill_fasync() is called outside the stream lock in snd_pcm_period_elapsed(). This is potentially racy, since the stream may get released even during the irq handler is running. Although snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't guarantee that the irq handler finishes, thus the kill_fasync() call outside the stream spin lock may be invoked after the substream is detached, as recently reported by KASAN. As a quick workaround, move kill_fasync() call inside the stream lock. The fasync is rarely used interface, so this shouldn't have a big impact from the performance POV. Ideally, we should implement some sync mechanism for the proper finish of stream and irq handler. But this oneliner should suffice for most cases, so far. Reported-by: Baozeng Ding <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsigned int cond, unsigned int width, unsigned int msbits) { unsigned long l = (msbits << 16) | width; return snd_pcm_hw_rule_add(runtime, cond, -1, snd_pcm_hw_rule_msbits, (void*) l, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); }
int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsigned int cond, unsigned int width, unsigned int msbits) { unsigned long l = (msbits << 16) | width; return snd_pcm_hw_rule_add(runtime, cond, -1, snd_pcm_hw_rule_msbits, (void*) l, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); }
C
linux
0
CVE-2014-1713
https://www.cvedetails.com/cve/CVE-2014-1713/
CWE-399
https://github.com/chromium/chromium/commit/f85a87ec670ad0fce9d98d90c9a705b72a288154
f85a87ec670ad0fce9d98d90c9a705b72a288154
document.location bindings fix BUG=352374 [email protected] Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void voidMethodSequenceTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); TestObjectPythonV8Internal::voidMethodSequenceTestInterfaceEmptyArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
static void voidMethodSequenceTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); TestObjectPythonV8Internal::voidMethodSequenceTestInterfaceEmptyArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
C
Chrome
0
CVE-2017-18216
https://www.cvedetails.com/cve/CVE-2017-18216/
CWE-476
https://github.com/torvalds/linux/commit/853bc26a7ea39e354b9f8889ae7ad1492ffa28d2
853bc26a7ea39e354b9f8889ae7ad1492ffa28d2
ocfs2: subsystem.su_mutex is required while accessing the item->ci_parent The subsystem.su_mutex is required while accessing the item->ci_parent, otherwise, NULL pointer dereference to the item->ci_parent will be triggered in the following situation: add node delete node sys_write vfs_write configfs_write_file o2nm_node_store o2nm_node_local_write do_rmdir vfs_rmdir configfs_rmdir mutex_lock(&subsys->su_mutex); unlink_obj item->ci_group = NULL; item->ci_parent = NULL; to_o2nm_cluster_from_node node->nd_item.ci_parent->ci_parent BUG since of NULL pointer dereference to nd_item.ci_parent Moreover, the o2nm_cluster also should be protected by the subsystem.su_mutex. [[email protected]: v2] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Alex Chen <[email protected]> Reviewed-by: Jun Piao <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static struct o2nm_cluster *to_o2nm_cluster_from_node(struct o2nm_node *node) { /* through the first node_set .parent * mycluster/nodes/mynode == o2nm_cluster->o2nm_node_group->o2nm_node */ if (node->nd_item.ci_parent) return to_o2nm_cluster(node->nd_item.ci_parent->ci_parent); else return NULL; }
static struct o2nm_cluster *to_o2nm_cluster_from_node(struct o2nm_node *node) { /* through the first node_set .parent * mycluster/nodes/mynode == o2nm_cluster->o2nm_node_group->o2nm_node */ return to_o2nm_cluster(node->nd_item.ci_parent->ci_parent); }
C
linux
1
CVE-2017-0823
https://www.cvedetails.com/cve/CVE-2017-0823/
CWE-200
https://android.googlesource.com/platform/hardware/ril/+/cd5f15f588a5d27e99ba12f057245bfe507f8c42
cd5f15f588a5d27e99ba12f057245bfe507f8c42
DO NOT MERGE Fix security vulnerability in pre-O rild code. Remove wrong code for setup_data_call. Add check for max address for RIL_DIAL. Bug: 37896655 Test: Manual. Change-Id: I05c027140ae828a2653794fcdd94e1b1a130941b (cherry picked from commit dda24c6557911aa1f4708abbd6b2f20f0e205b9e)
static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI) { RIL_NV_WriteItem nvwi; int32_t t; status_t status; memset(&nvwi, 0, sizeof(nvwi)); status = p.readInt32(&t); nvwi.itemID = (RIL_NV_Item) t; nvwi.value = strdupReadString(p); if (status != NO_ERROR || nvwi.value == NULL) { goto invalid; } startRequest; appendPrintBuf("%snvwi.itemID=%d, value=%s, ", printBuf, nvwi.itemID, nvwi.value); closeRequest; printRequest(pRI->token, pRI->pCI->requestNumber); CALL_ONREQUEST(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI, pRI->socket_id); #ifdef MEMSET_FREED memsetString(nvwi.value); #endif free(nvwi.value); #ifdef MEMSET_FREED memset(&nvwi, 0, sizeof(nvwi)); #endif return; invalid: invalidCommandBlock(pRI); return; }
static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI) { RIL_NV_WriteItem nvwi; int32_t t; status_t status; memset(&nvwi, 0, sizeof(nvwi)); status = p.readInt32(&t); nvwi.itemID = (RIL_NV_Item) t; nvwi.value = strdupReadString(p); if (status != NO_ERROR || nvwi.value == NULL) { goto invalid; } startRequest; appendPrintBuf("%snvwi.itemID=%d, value=%s, ", printBuf, nvwi.itemID, nvwi.value); closeRequest; printRequest(pRI->token, pRI->pCI->requestNumber); CALL_ONREQUEST(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI, pRI->socket_id); #ifdef MEMSET_FREED memsetString(nvwi.value); #endif free(nvwi.value); #ifdef MEMSET_FREED memset(&nvwi, 0, sizeof(nvwi)); #endif return; invalid: invalidCommandBlock(pRI); return; }
C
Android
0
CVE-2015-5697
https://www.cvedetails.com/cve/CVE-2015-5697/
CWE-200
https://github.com/torvalds/linux/commit/b6878d9e03043695dbf3fa1caa6dfc09db225b16
b6878d9e03043695dbf3fa1caa6dfc09db225b16
md: use kzalloc() when bitmap is disabled In drivers/md/md.c get_bitmap_file() uses kmalloc() for creating a mdu_bitmap_file_t called "file". 5769 file = kmalloc(sizeof(*file), GFP_NOIO); 5770 if (!file) 5771 return -ENOMEM; This structure is copied to user space at the end of the function. 5786 if (err == 0 && 5787 copy_to_user(arg, file, sizeof(*file))) 5788 err = -EFAULT But if bitmap is disabled only the first byte of "file" is initialized with zero, so it's possible to read some bytes (up to 4095) of kernel space memory from user space. This is an information leak. 5775 /* bitmap disabled, zero the first byte and copy out */ 5776 if (!mddev->bitmap_info.file) 5777 file->pathname[0] = '\0'; Signed-off-by: Benjamin Randazzo <[email protected]> Signed-off-by: NeilBrown <[email protected]>
static ssize_t bb_store(struct md_rdev *rdev, const char *page, size_t len) { int rv = badblocks_store(&rdev->badblocks, page, len, 0); /* Maybe that ack was all we needed */ if (test_and_clear_bit(BlockedBadBlocks, &rdev->flags)) wake_up(&rdev->blocked_wait); return rv; }
static ssize_t bb_store(struct md_rdev *rdev, const char *page, size_t len) { int rv = badblocks_store(&rdev->badblocks, page, len, 0); /* Maybe that ack was all we needed */ if (test_and_clear_bit(BlockedBadBlocks, &rdev->flags)) wake_up(&rdev->blocked_wait); return rv; }
C
linux
0
CVE-2015-8382
https://www.cvedetails.com/cve/CVE-2015-8382/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=c351b47ce85a3a147cfa801fa9f0149ab4160834
c351b47ce85a3a147cfa801fa9f0149ab4160834
null
static PHP_FUNCTION(preg_quote) { int in_str_len; char *in_str; /* Input string argument */ char *in_str_end; /* End of the input string */ int delim_len = 0; char *delim = NULL; /* Additional delimiter argument */ char *out_str, /* Output string with quoted characters */ *p, /* Iterator for input string */ *q, /* Iterator for output string */ delim_char=0, /* Delimiter character to be quoted */ c; /* Current character */ zend_bool quote_delim = 0; /* Whether to quote additional delim char */ /* Get the arguments and check for errors */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len, &delim, &delim_len) == FAILURE) { return; } in_str_end = in_str + in_str_len; /* Nothing to do if we got an empty string */ if (in_str == in_str_end) { RETURN_EMPTY_STRING(); } if (delim && *delim) { delim_char = delim[0]; quote_delim = 1; } /* Allocate enough memory so that even if each character is quoted, we won't run out of room */ out_str = safe_emalloc(4, in_str_len, 1); /* Go through the string and quote necessary characters */ for(p = in_str, q = out_str; p != in_str_end; p++) { c = *p; switch(c) { case '.': case '\\': case '+': case '*': case '?': case '[': case '^': case ']': case '$': case '(': case ')': case '{': case '}': case '=': case '!': case '>': case '<': case '|': case ':': case '-': *q++ = '\\'; *q++ = c; break; case '\0': *q++ = '\\'; *q++ = '0'; *q++ = '0'; *q++ = '0'; break; default: if (quote_delim && c == delim_char) *q++ = '\\'; *q++ = c; break; } } *q = '\0'; /* Reallocate string and return it */ RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0); }
static PHP_FUNCTION(preg_quote) { int in_str_len; char *in_str; /* Input string argument */ char *in_str_end; /* End of the input string */ int delim_len = 0; char *delim = NULL; /* Additional delimiter argument */ char *out_str, /* Output string with quoted characters */ *p, /* Iterator for input string */ *q, /* Iterator for output string */ delim_char=0, /* Delimiter character to be quoted */ c; /* Current character */ zend_bool quote_delim = 0; /* Whether to quote additional delim char */ /* Get the arguments and check for errors */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len, &delim, &delim_len) == FAILURE) { return; } in_str_end = in_str + in_str_len; /* Nothing to do if we got an empty string */ if (in_str == in_str_end) { RETURN_EMPTY_STRING(); } if (delim && *delim) { delim_char = delim[0]; quote_delim = 1; } /* Allocate enough memory so that even if each character is quoted, we won't run out of room */ out_str = safe_emalloc(4, in_str_len, 1); /* Go through the string and quote necessary characters */ for(p = in_str, q = out_str; p != in_str_end; p++) { c = *p; switch(c) { case '.': case '\\': case '+': case '*': case '?': case '[': case '^': case ']': case '$': case '(': case ')': case '{': case '}': case '=': case '!': case '>': case '<': case '|': case ':': case '-': *q++ = '\\'; *q++ = c; break; case '\0': *q++ = '\\'; *q++ = '0'; *q++ = '0'; *q++ = '0'; break; default: if (quote_delim && c == delim_char) *q++ = '\\'; *q++ = c; break; } } *q = '\0'; /* Reallocate string and return it */ RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0); }
C
php
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Cree <[email protected]> Cc: Will Deacon <[email protected]> Cc: Deng-Cheng Zhu <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Eric B Munson <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mundt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jason Wessel <[email protected]> Cc: Don Zickus <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static __init int p4_pmu_init(void) { unsigned int low, high; /* If we get stripped -- indexing fails */ BUILD_BUG_ON(ARCH_P4_MAX_CCCR > X86_PMC_MAX_GENERIC); rdmsr(MSR_IA32_MISC_ENABLE, low, high); if (!(low & (1 << 7))) { pr_cont("unsupported Netburst CPU model %d ", boot_cpu_data.x86_model); return -ENODEV; } memcpy(hw_cache_event_ids, p4_hw_cache_event_ids, sizeof(hw_cache_event_ids)); pr_cont("Netburst events, "); x86_pmu = p4_pmu; return 0; }
static __init int p4_pmu_init(void) { unsigned int low, high; /* If we get stripped -- indexing fails */ BUILD_BUG_ON(ARCH_P4_MAX_CCCR > X86_PMC_MAX_GENERIC); rdmsr(MSR_IA32_MISC_ENABLE, low, high); if (!(low & (1 << 7))) { pr_cont("unsupported Netburst CPU model %d ", boot_cpu_data.x86_model); return -ENODEV; } memcpy(hw_cache_event_ids, p4_hw_cache_event_ids, sizeof(hw_cache_event_ids)); pr_cont("Netburst events, "); x86_pmu = p4_pmu; return 0; }
C
linux
0
CVE-2013-2915
https://www.cvedetails.com/cve/CVE-2013-2915/
null
https://github.com/chromium/chromium/commit/b12eb22a27110f49a2ad54b9e4ffd0ccb6cf9ce9
b12eb22a27110f49a2ad54b9e4ffd0ccb6cf9ce9
Delete unneeded pending entries in DidFailProvisionalLoad to prevent a spoof. BUG=280512 BUG=278899 TEST=See bug for repro steps. Review URL: https://chromiumcodereview.appspot.com/23978003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222146 0039d316-1c4b-4281-b951-d872f2087c98
bool DoImagesMatch(const gfx::Image& a, const gfx::Image& b) { SkBitmap a_bitmap = a.AsBitmap(); SkBitmap b_bitmap = b.AsBitmap(); if (a_bitmap.width() != b_bitmap.width() || a_bitmap.height() != b_bitmap.height()) { return false; } SkAutoLockPixels a_bitmap_lock(a_bitmap); SkAutoLockPixels b_bitmap_lock(b_bitmap); return memcmp(a_bitmap.getPixels(), b_bitmap.getPixels(), a_bitmap.getSize()) == 0; }
bool DoImagesMatch(const gfx::Image& a, const gfx::Image& b) { SkBitmap a_bitmap = a.AsBitmap(); SkBitmap b_bitmap = b.AsBitmap(); if (a_bitmap.width() != b_bitmap.width() || a_bitmap.height() != b_bitmap.height()) { return false; } SkAutoLockPixels a_bitmap_lock(a_bitmap); SkAutoLockPixels b_bitmap_lock(b_bitmap); return memcmp(a_bitmap.getPixels(), b_bitmap.getPixels(), a_bitmap.getSize()) == 0; }
C
Chrome
0
CVE-2019-5822
https://www.cvedetails.com/cve/CVE-2019-5822/
CWE-284
https://github.com/chromium/chromium/commit/2f81d000fdb5331121cba7ff81dfaaec25b520a5
2f81d000fdb5331121cba7ff81dfaaec25b520a5
When turning a download into a navigation, navigate the right frame Code changes from Nate Chapin <[email protected]> Bug: 926105 Change-Id: I098599394e6ebe7d2fce5af838014297a337d294 Reviewed-on: https://chromium-review.googlesource.com/c/1454962 Reviewed-by: Camille Lamy <[email protected]> Commit-Queue: Jochen Eisinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#629547}
ResourceLoader* ResourceDispatcherHostImpl::GetLoader( const GlobalRequestID& id) const { DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); auto i = pending_loaders_.find(id); if (i == pending_loaders_.end()) return nullptr; return i->second.get(); }
ResourceLoader* ResourceDispatcherHostImpl::GetLoader( const GlobalRequestID& id) const { DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); auto i = pending_loaders_.find(id); if (i == pending_loaders_.end()) return nullptr; return i->second.get(); }
C
Chrome
0
CVE-2016-9084
https://www.cvedetails.com/cve/CVE-2016-9084/
CWE-190
https://github.com/torvalds/linux/commit/05692d7005a364add85c6e25a6c4447ce08f913a
05692d7005a364add85c6e25a6c4447ce08f913a
vfio/pci: Fix integer overflows, bitmask check The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element in the VFIO_IRQ_SET_DATA_TYPE_MASK bitmask is set. VFIO_IRQ_SET_ACTION_TYPE_MASK is already correctly checked later in vfio_pci_set_irqs_ioctl(). Furthermore, a kzalloc is changed to a kcalloc because the use of a kzalloc with an integer multiplication allowed an integer overflow condition to be reached without this patch. kcalloc checks for overflow and should prevent a similar occurrence. Signed-off-by: Vlad Tsyrklevich <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
static int msix_sparse_mmap_cap(struct vfio_pci_device *vdev, struct vfio_info_cap *caps) { struct vfio_info_cap_header *header; struct vfio_region_info_cap_sparse_mmap *sparse; size_t end, size; int nr_areas = 2, i = 0; end = pci_resource_len(vdev->pdev, vdev->msix_bar); /* If MSI-X table is aligned to the start or end, only one area */ if (((vdev->msix_offset & PAGE_MASK) == 0) || (PAGE_ALIGN(vdev->msix_offset + vdev->msix_size) >= end)) nr_areas = 1; size = sizeof(*sparse) + (nr_areas * sizeof(*sparse->areas)); header = vfio_info_cap_add(caps, size, VFIO_REGION_INFO_CAP_SPARSE_MMAP, 1); if (IS_ERR(header)) return PTR_ERR(header); sparse = container_of(header, struct vfio_region_info_cap_sparse_mmap, header); sparse->nr_areas = nr_areas; if (vdev->msix_offset & PAGE_MASK) { sparse->areas[i].offset = 0; sparse->areas[i].size = vdev->msix_offset & PAGE_MASK; i++; } if (PAGE_ALIGN(vdev->msix_offset + vdev->msix_size) < end) { sparse->areas[i].offset = PAGE_ALIGN(vdev->msix_offset + vdev->msix_size); sparse->areas[i].size = end - sparse->areas[i].offset; i++; } return 0; }
static int msix_sparse_mmap_cap(struct vfio_pci_device *vdev, struct vfio_info_cap *caps) { struct vfio_info_cap_header *header; struct vfio_region_info_cap_sparse_mmap *sparse; size_t end, size; int nr_areas = 2, i = 0; end = pci_resource_len(vdev->pdev, vdev->msix_bar); /* If MSI-X table is aligned to the start or end, only one area */ if (((vdev->msix_offset & PAGE_MASK) == 0) || (PAGE_ALIGN(vdev->msix_offset + vdev->msix_size) >= end)) nr_areas = 1; size = sizeof(*sparse) + (nr_areas * sizeof(*sparse->areas)); header = vfio_info_cap_add(caps, size, VFIO_REGION_INFO_CAP_SPARSE_MMAP, 1); if (IS_ERR(header)) return PTR_ERR(header); sparse = container_of(header, struct vfio_region_info_cap_sparse_mmap, header); sparse->nr_areas = nr_areas; if (vdev->msix_offset & PAGE_MASK) { sparse->areas[i].offset = 0; sparse->areas[i].size = vdev->msix_offset & PAGE_MASK; i++; } if (PAGE_ALIGN(vdev->msix_offset + vdev->msix_size) < end) { sparse->areas[i].offset = PAGE_ALIGN(vdev->msix_offset + vdev->msix_size); sparse->areas[i].size = end - sparse->areas[i].offset; i++; } return 0; }
C
linux
0
CVE-2017-5039
https://www.cvedetails.com/cve/CVE-2017-5039/
CWE-416
https://github.com/chromium/chromium/commit/69b4b9ef7455753b12c3efe4eec71647e6fb1da1
69b4b9ef7455753b12c3efe4eec71647e6fb1da1
Disable all DRP URL fetches when holdback is enabled Disable secure proxy checker, warmup url fetcher and client config fetch when the client is in DRP (Data Reduction Proxy) holdback. This CL does not disable pingbacks when client is in the holdback, but the pingback code is going away soon. Change-Id: Icbb59d814d1452123869c609e0770d1439c1db51 Bug: 984964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1709965 Commit-Queue: Tarun Bansal <[email protected]> Reviewed-by: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#679649}
void DataReductionProxyConfig::OnConnectionChanged( network::mojom::ConnectionType type) { DCHECK(thread_checker_.CalledOnValidThread()); connection_type_ = type; RecordNetworkChangeEvent(NETWORK_CHANGED); #if defined(OS_CHROMEOS) if (get_network_id_asynchronously_) { base::PostTaskAndReplyWithResult( g_get_network_id_task_runner.Get().get(), FROM_HERE, base::BindOnce(&DoGetCurrentNetworkID, base::Unretained(network_connection_tracker_)), base::BindOnce(&DataReductionProxyConfig::ContinueNetworkChanged, weak_factory_.GetWeakPtr())); return; } #endif // defined(OS_CHROMEOS) ContinueNetworkChanged(GetCurrentNetworkID()); }
void DataReductionProxyConfig::OnConnectionChanged( network::mojom::ConnectionType type) { DCHECK(thread_checker_.CalledOnValidThread()); connection_type_ = type; RecordNetworkChangeEvent(NETWORK_CHANGED); #if defined(OS_CHROMEOS) if (get_network_id_asynchronously_) { base::PostTaskAndReplyWithResult( g_get_network_id_task_runner.Get().get(), FROM_HERE, base::BindOnce(&DoGetCurrentNetworkID, base::Unretained(network_connection_tracker_)), base::BindOnce(&DataReductionProxyConfig::ContinueNetworkChanged, weak_factory_.GetWeakPtr())); return; } #endif // defined(OS_CHROMEOS) ContinueNetworkChanged(GetCurrentNetworkID()); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
Support pausing media when a context is frozen. Media is resumed when the context is unpaused. This feature will be used for bfcache and pausing iframes feature policy. BUG=907125 Change-Id: Ic3925ea1a4544242b7bf0b9ad8c9cb9f63976bbd Reviewed-on: https://chromium-review.googlesource.com/c/1410126 Commit-Queue: Dave Tapuska <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Mounir Lamouri <[email protected]> Cr-Commit-Position: refs/heads/master@{#623319}
void DefaultAudioDestinationHandler::StopPlatformDestination() { if (platform_destination_->IsPlaying()) { platform_destination_->Stop(); } }
void DefaultAudioDestinationHandler::StopPlatformDestination() { if (platform_destination_->IsPlaying()) { platform_destination_->Stop(); } }
C
Chrome
0
CVE-2016-1683
https://www.cvedetails.com/cve/CVE-2016-1683/
CWE-119
https://github.com/chromium/chromium/commit/96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 BUG=583156,583171 Review URL: https://codereview.chromium.org/1853083002 Cr-Commit-Position: refs/heads/master@{#385338}
xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xmlNodePtr deleteNode, cur, txt, textNode = NULL; xmlDocPtr doc; xsltStylesheetPtr style; int internalize = 0, findSpaceAttr; int xsltStylesheetElemDepth; xmlAttrPtr attr; xmlChar *value; const xmlChar *name, *nsNameXSLT = NULL; int strictWhitespace, inXSLText = 0; #ifdef XSLT_REFACTORED_XSLT_NSCOMP xsltNsMapPtr nsMapItem; #endif if ((cctxt == NULL) || (cctxt->style == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); doc = node->doc; if (doc == NULL) goto internal_err; style = cctxt->style; if ((style->dict != NULL) && (doc->dict == style->dict)) internalize = 1; else style->internalized = 0; /* * Init value of xml:space. Since this might be an embedded * stylesheet, this is needed to be performed on the element * where the stylesheet is rooted at, taking xml:space of * ancestors into account. */ if (! cctxt->simplified) xsltStylesheetElemDepth = cctxt->depth +1; else xsltStylesheetElemDepth = 0; if (xmlNodeGetSpacePreserve(node) != 1) cctxt->inode->preserveWhitespace = 0; else cctxt->inode->preserveWhitespace = 1; /* * Eval if we should keep the old incorrect behaviour. */ strictWhitespace = (cctxt->strict != 0) ? 1 : 0; nsNameXSLT = xsltConstNamespaceNameXSLT; deleteNode = NULL; cur = node; while (cur != NULL) { if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS xsltGenericDebug(xsltGenericDebugContext, "xsltParsePreprocessStylesheetTree: removing node\n"); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); deleteNode = NULL; } if (cur->type == XML_ELEMENT_NODE) { /* * Clear the PSVI field. */ cur->psvi = NULL; xsltCompilerNodePush(cctxt, cur); inXSLText = 0; textNode = NULL; findSpaceAttr = 1; cctxt->inode->stripWhitespace = 0; /* * TODO: I'd love to use a string pointer comparison here :-/ */ if (IS_XSLT_ELEM(cur)) { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if (cur->ns->href != nsNameXSLT) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, cur->ns, cur); if (nsMapItem == NULL) goto internal_err; cur->ns->href = nsNameXSLT; } #endif if (cur->name == NULL) goto process_attributes; /* * Mark the XSLT element for later recognition. * TODO: Using the marker is still too dangerous, since if * the parsing mechanism leaves out an XSLT element, then * this might hit the transformation-mechanism, which * will break if it doesn't expect such a marker. */ /* cur->psvi = (void *) xsltXSLTElemMarker; */ /* * XSLT 2.0: "Any whitespace text node whose parent is * one of the following elements is removed from the " * tree, regardless of any xml:space attributes:..." * xsl:apply-imports, * xsl:apply-templates, * xsl:attribute-set, * xsl:call-template, * xsl:choose, * xsl:stylesheet, xsl:transform. * XSLT 2.0: xsl:analyze-string, * xsl:character-map, * xsl:next-match * * TODO: I'd love to use a string pointer comparison here :-/ */ name = cur->name; switch (*name) { case 't': if ((name[0] == 't') && (name[1] == 'e') && (name[2] == 'x') && (name[3] == 't') && (name[4] == 0)) { /* * Process the xsl:text element. * ---------------------------- * Mark it for later recognition. */ cur->psvi = (void *) xsltXSLTTextMarker; /* * For stylesheets, the set of * whitespace-preserving element names * consists of just xsl:text. */ findSpaceAttr = 0; cctxt->inode->preserveWhitespace = 1; inXSLText = 1; } break; case 'c': if (xmlStrEqual(name, BAD_CAST "choose") || xmlStrEqual(name, BAD_CAST "call-template")) cctxt->inode->stripWhitespace = 1; break; case 'a': if (xmlStrEqual(name, BAD_CAST "apply-templates") || xmlStrEqual(name, BAD_CAST "apply-imports") || xmlStrEqual(name, BAD_CAST "attribute-set")) cctxt->inode->stripWhitespace = 1; break; default: if (xsltStylesheetElemDepth == cctxt->depth) { /* * This is a xsl:stylesheet/xsl:transform. */ cctxt->inode->stripWhitespace = 1; break; } if ((cur->prev != NULL) && (cur->prev->type == XML_TEXT_NODE)) { /* * XSLT 2.0 : "Any whitespace text node whose * following-sibling node is an xsl:param or * xsl:sort element is removed from the tree, * regardless of any xml:space attributes." */ if (((*name == 'p') || (*name == 's')) && (xmlStrEqual(name, BAD_CAST "param") || xmlStrEqual(name, BAD_CAST "sort"))) { do { if (IS_BLANK_NODE(cur->prev)) { txt = cur->prev; xmlUnlinkNode(txt); xmlFreeNode(txt); } else { /* * This will result in a content * error, when hitting the parsing * functions. */ break; } } while (cur->prev); } } break; } } process_attributes: /* * Process attributes. * ------------------ */ if (cur->properties != NULL) { if (cur->children == NULL) findSpaceAttr = 0; attr = cur->properties; do { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if ((attr->ns) && (attr->ns->href != nsNameXSLT) && xmlStrEqual(attr->ns->href, nsNameXSLT)) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, attr->ns, cur); if (nsMapItem == NULL) goto internal_err; attr->ns->href = nsNameXSLT; } #endif if (internalize) { /* * Internalize the attribute's value; the goal is to * speed up operations and minimize used space by * compiled stylesheets. */ txt = attr->children; /* * NOTE that this assumes only one * text-node in the attribute's content. */ if ((txt != NULL) && (txt->content != NULL) && (!xmlDictOwns(style->dict, txt->content))) { value = (xmlChar *) xmlDictLookup(style->dict, txt->content, -1); xmlNodeSetContent(txt, NULL); txt->content = value; } } /* * Process xml:space attributes. * ---------------------------- */ if ((findSpaceAttr != 0) && (attr->ns != NULL) && (attr->name != NULL) && (attr->name[0] == 's') && (attr->ns->prefix != NULL) && (attr->ns->prefix[0] == 'x') && (attr->ns->prefix[1] == 'm') && (attr->ns->prefix[2] == 'l') && (attr->ns->prefix[3] == 0)) { value = xmlGetNsProp(cur, BAD_CAST "space", XML_XML_NAMESPACE); if (value != NULL) { if (xmlStrEqual(value, BAD_CAST "preserve")) { cctxt->inode->preserveWhitespace = 1; } else if (xmlStrEqual(value, BAD_CAST "default")) { cctxt->inode->preserveWhitespace = 0; } else { /* Invalid value for xml:space. */ xsltTransformError(NULL, style, cur, "Attribute xml:space: Invalid value.\n"); cctxt->style->warnings++; } findSpaceAttr = 0; xmlFree(value); } } attr = attr->next; } while (attr != NULL); } /* * We'll descend into the children of element nodes only. */ if (cur->children != NULL) { cur = cur->children; continue; } } else if ((cur->type == XML_TEXT_NODE) || (cur->type == XML_CDATA_SECTION_NODE)) { /* * Merge adjacent text/CDATA-section-nodes * --------------------------------------- * In order to avoid breaking of existing stylesheets, * if the old behaviour is wanted (strictWhitespace == 0), * then we *won't* merge adjacent text-nodes * (except in xsl:text); this will ensure that whitespace-only * text nodes are (incorrectly) not stripped in some cases. * * Example: : <foo> <!-- bar -->zoo</foo> * Corrent (strict) result: <foo> zoo</foo> * Incorrect (old) result : <foo>zoo</foo> * * NOTE that we *will* merge adjacent text-nodes if * they are in xsl:text. * Example, the following: * <xsl:text> <!-- bar -->zoo<xsl:text> * will result in both cases in: * <xsl:text> zoo<xsl:text> */ cur->type = XML_TEXT_NODE; if ((strictWhitespace != 0) || (inXSLText != 0)) { /* * New behaviour; merge nodes. */ if (textNode == NULL) textNode = cur; else { if (cur->content != NULL) xmlNodeAddContent(textNode, cur->content); deleteNode = cur; } if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { /* * Old behaviour. */ if (textNode == NULL) textNode = cur; goto end_of_text; } } else if ((cur->type == XML_COMMENT_NODE) || (cur->type == XML_PI_NODE)) { /* * Remove processing instructions and comments. */ deleteNode = cur; if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { textNode = NULL; /* * Invalid node-type for this data-model. */ xsltTransformError(NULL, style, cur, "Invalid type of node for the XSLT data model.\n"); cctxt->style->errors++; goto next_sibling; } end_of_text: if (textNode) { value = textNode->content; /* * At this point all adjacent text/CDATA-section nodes * have been merged. * * Strip whitespace-only text-nodes. * (cctxt->inode->stripWhitespace) */ if ((value == NULL) || (*value == 0) || (((cctxt->inode->stripWhitespace) || (! cctxt->inode->preserveWhitespace)) && IS_BLANK(*value) && xsltIsBlank(value))) { if (textNode != cur) { xmlUnlinkNode(textNode); xmlFreeNode(textNode); } else deleteNode = textNode; textNode = NULL; goto next_sibling; } /* * Convert CDATA-section nodes to text-nodes. * TODO: Can this produce problems? */ if (textNode->type != XML_TEXT_NODE) { textNode->type = XML_TEXT_NODE; textNode->name = xmlStringText; } if (internalize && (textNode->content != NULL) && (!xmlDictOwns(style->dict, textNode->content))) { /* * Internalize the string. */ value = (xmlChar *) xmlDictLookup(style->dict, textNode->content, -1); xmlNodeSetContent(textNode, NULL); textNode->content = value; } textNode = NULL; /* * Note that "disable-output-escaping" of the xsl:text * element will be applied at a later level, when * XSLT elements are processed. */ } next_sibling: if (cur->type == XML_ELEMENT_NODE) { xsltCompilerNodePop(cctxt, cur); } if (cur == node) break; if (cur->next != NULL) { cur = cur->next; } else { cur = cur->parent; inXSLText = 0; goto next_sibling; }; } if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParsePreprocessStylesheetTree: removing node\n"); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); } return(0); internal_err: return(-1); }
xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xmlNodePtr deleteNode, cur, txt, textNode = NULL; xmlDocPtr doc; xsltStylesheetPtr style; int internalize = 0, findSpaceAttr; int xsltStylesheetElemDepth; xmlAttrPtr attr; xmlChar *value; const xmlChar *name, *nsNameXSLT = NULL; int strictWhitespace, inXSLText = 0; #ifdef XSLT_REFACTORED_XSLT_NSCOMP xsltNsMapPtr nsMapItem; #endif if ((cctxt == NULL) || (cctxt->style == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); doc = node->doc; if (doc == NULL) goto internal_err; style = cctxt->style; if ((style->dict != NULL) && (doc->dict == style->dict)) internalize = 1; else style->internalized = 0; /* * Init value of xml:space. Since this might be an embedded * stylesheet, this is needed to be performed on the element * where the stylesheet is rooted at, taking xml:space of * ancestors into account. */ if (! cctxt->simplified) xsltStylesheetElemDepth = cctxt->depth +1; else xsltStylesheetElemDepth = 0; if (xmlNodeGetSpacePreserve(node) != 1) cctxt->inode->preserveWhitespace = 0; else cctxt->inode->preserveWhitespace = 1; /* * Eval if we should keep the old incorrect behaviour. */ strictWhitespace = (cctxt->strict != 0) ? 1 : 0; nsNameXSLT = xsltConstNamespaceNameXSLT; deleteNode = NULL; cur = node; while (cur != NULL) { if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS xsltGenericDebug(xsltGenericDebugContext, "xsltParsePreprocessStylesheetTree: removing node\n"); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); deleteNode = NULL; } if (cur->type == XML_ELEMENT_NODE) { /* * Clear the PSVI field. */ cur->psvi = NULL; xsltCompilerNodePush(cctxt, cur); inXSLText = 0; textNode = NULL; findSpaceAttr = 1; cctxt->inode->stripWhitespace = 0; /* * TODO: I'd love to use a string pointer comparison here :-/ */ if (IS_XSLT_ELEM(cur)) { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if (cur->ns->href != nsNameXSLT) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, cur->ns, cur); if (nsMapItem == NULL) goto internal_err; cur->ns->href = nsNameXSLT; } #endif if (cur->name == NULL) goto process_attributes; /* * Mark the XSLT element for later recognition. * TODO: Using the marker is still too dangerous, since if * the parsing mechanism leaves out an XSLT element, then * this might hit the transformation-mechanism, which * will break if it doesn't expect such a marker. */ /* cur->psvi = (void *) xsltXSLTElemMarker; */ /* * XSLT 2.0: "Any whitespace text node whose parent is * one of the following elements is removed from the " * tree, regardless of any xml:space attributes:..." * xsl:apply-imports, * xsl:apply-templates, * xsl:attribute-set, * xsl:call-template, * xsl:choose, * xsl:stylesheet, xsl:transform. * XSLT 2.0: xsl:analyze-string, * xsl:character-map, * xsl:next-match * * TODO: I'd love to use a string pointer comparison here :-/ */ name = cur->name; switch (*name) { case 't': if ((name[0] == 't') && (name[1] == 'e') && (name[2] == 'x') && (name[3] == 't') && (name[4] == 0)) { /* * Process the xsl:text element. * ---------------------------- * Mark it for later recognition. */ cur->psvi = (void *) xsltXSLTTextMarker; /* * For stylesheets, the set of * whitespace-preserving element names * consists of just xsl:text. */ findSpaceAttr = 0; cctxt->inode->preserveWhitespace = 1; inXSLText = 1; } break; case 'c': if (xmlStrEqual(name, BAD_CAST "choose") || xmlStrEqual(name, BAD_CAST "call-template")) cctxt->inode->stripWhitespace = 1; break; case 'a': if (xmlStrEqual(name, BAD_CAST "apply-templates") || xmlStrEqual(name, BAD_CAST "apply-imports") || xmlStrEqual(name, BAD_CAST "attribute-set")) cctxt->inode->stripWhitespace = 1; break; default: if (xsltStylesheetElemDepth == cctxt->depth) { /* * This is a xsl:stylesheet/xsl:transform. */ cctxt->inode->stripWhitespace = 1; break; } if ((cur->prev != NULL) && (cur->prev->type == XML_TEXT_NODE)) { /* * XSLT 2.0 : "Any whitespace text node whose * following-sibling node is an xsl:param or * xsl:sort element is removed from the tree, * regardless of any xml:space attributes." */ if (((*name == 'p') || (*name == 's')) && (xmlStrEqual(name, BAD_CAST "param") || xmlStrEqual(name, BAD_CAST "sort"))) { do { if (IS_BLANK_NODE(cur->prev)) { txt = cur->prev; xmlUnlinkNode(txt); xmlFreeNode(txt); } else { /* * This will result in a content * error, when hitting the parsing * functions. */ break; } } while (cur->prev); } } break; } } process_attributes: /* * Process attributes. * ------------------ */ if (cur->properties != NULL) { if (cur->children == NULL) findSpaceAttr = 0; attr = cur->properties; do { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if ((attr->ns) && (attr->ns->href != nsNameXSLT) && xmlStrEqual(attr->ns->href, nsNameXSLT)) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, attr->ns, cur); if (nsMapItem == NULL) goto internal_err; attr->ns->href = nsNameXSLT; } #endif if (internalize) { /* * Internalize the attribute's value; the goal is to * speed up operations and minimize used space by * compiled stylesheets. */ txt = attr->children; /* * NOTE that this assumes only one * text-node in the attribute's content. */ if ((txt != NULL) && (txt->content != NULL) && (!xmlDictOwns(style->dict, txt->content))) { value = (xmlChar *) xmlDictLookup(style->dict, txt->content, -1); xmlNodeSetContent(txt, NULL); txt->content = value; } } /* * Process xml:space attributes. * ---------------------------- */ if ((findSpaceAttr != 0) && (attr->ns != NULL) && (attr->name != NULL) && (attr->name[0] == 's') && (attr->ns->prefix != NULL) && (attr->ns->prefix[0] == 'x') && (attr->ns->prefix[1] == 'm') && (attr->ns->prefix[2] == 'l') && (attr->ns->prefix[3] == 0)) { value = xmlGetNsProp(cur, BAD_CAST "space", XML_XML_NAMESPACE); if (value != NULL) { if (xmlStrEqual(value, BAD_CAST "preserve")) { cctxt->inode->preserveWhitespace = 1; } else if (xmlStrEqual(value, BAD_CAST "default")) { cctxt->inode->preserveWhitespace = 0; } else { /* Invalid value for xml:space. */ xsltTransformError(NULL, style, cur, "Attribute xml:space: Invalid value.\n"); cctxt->style->warnings++; } findSpaceAttr = 0; xmlFree(value); } } attr = attr->next; } while (attr != NULL); } /* * We'll descend into the children of element nodes only. */ if (cur->children != NULL) { cur = cur->children; continue; } } else if ((cur->type == XML_TEXT_NODE) || (cur->type == XML_CDATA_SECTION_NODE)) { /* * Merge adjacent text/CDATA-section-nodes * --------------------------------------- * In order to avoid breaking of existing stylesheets, * if the old behaviour is wanted (strictWhitespace == 0), * then we *won't* merge adjacent text-nodes * (except in xsl:text); this will ensure that whitespace-only * text nodes are (incorrectly) not stripped in some cases. * * Example: : <foo> <!-- bar -->zoo</foo> * Corrent (strict) result: <foo> zoo</foo> * Incorrect (old) result : <foo>zoo</foo> * * NOTE that we *will* merge adjacent text-nodes if * they are in xsl:text. * Example, the following: * <xsl:text> <!-- bar -->zoo<xsl:text> * will result in both cases in: * <xsl:text> zoo<xsl:text> */ cur->type = XML_TEXT_NODE; if ((strictWhitespace != 0) || (inXSLText != 0)) { /* * New behaviour; merge nodes. */ if (textNode == NULL) textNode = cur; else { if (cur->content != NULL) xmlNodeAddContent(textNode, cur->content); deleteNode = cur; } if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { /* * Old behaviour. */ if (textNode == NULL) textNode = cur; goto end_of_text; } } else if ((cur->type == XML_COMMENT_NODE) || (cur->type == XML_PI_NODE)) { /* * Remove processing instructions and comments. */ deleteNode = cur; if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { textNode = NULL; /* * Invalid node-type for this data-model. */ xsltTransformError(NULL, style, cur, "Invalid type of node for the XSLT data model.\n"); cctxt->style->errors++; goto next_sibling; } end_of_text: if (textNode) { value = textNode->content; /* * At this point all adjacent text/CDATA-section nodes * have been merged. * * Strip whitespace-only text-nodes. * (cctxt->inode->stripWhitespace) */ if ((value == NULL) || (*value == 0) || (((cctxt->inode->stripWhitespace) || (! cctxt->inode->preserveWhitespace)) && IS_BLANK(*value) && xsltIsBlank(value))) { if (textNode != cur) { xmlUnlinkNode(textNode); xmlFreeNode(textNode); } else deleteNode = textNode; textNode = NULL; goto next_sibling; } /* * Convert CDATA-section nodes to text-nodes. * TODO: Can this produce problems? */ if (textNode->type != XML_TEXT_NODE) { textNode->type = XML_TEXT_NODE; textNode->name = xmlStringText; } if (internalize && (textNode->content != NULL) && (!xmlDictOwns(style->dict, textNode->content))) { /* * Internalize the string. */ value = (xmlChar *) xmlDictLookup(style->dict, textNode->content, -1); xmlNodeSetContent(textNode, NULL); textNode->content = value; } textNode = NULL; /* * Note that "disable-output-escaping" of the xsl:text * element will be applied at a later level, when * XSLT elements are processed. */ } next_sibling: if (cur->type == XML_ELEMENT_NODE) { xsltCompilerNodePop(cctxt, cur); } if (cur == node) break; if (cur->next != NULL) { cur = cur->next; } else { cur = cur->parent; inXSLText = 0; goto next_sibling; }; } if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParsePreprocessStylesheetTree: removing node\n"); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); } return(0); internal_err: return(-1); }
C
Chrome
0
CVE-2018-1068
https://www.cvedetails.com/cve/CVE-2018-1068/
CWE-787
https://github.com/torvalds/linux/commit/b71812168571fa55e44cdd0254471331b9c4c4c6
b71812168571fa55e44cdd0254471331b9c4c4c6
netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets We need to make sure the offsets are not out of range of the total size. Also check that they are in ascending order. The WARN_ON triggered by syzkaller (it sets panic_on_warn) is changed to also bail out, no point in continuing parsing. Briefly tested with simple ruleset of -A INPUT --limit 1/s' --log plus jump to custom chains using 32bit ebtables binary. Reported-by: <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
static int compat_target_to_user(struct ebt_entry_target *t, void __user **dstptr, unsigned int *size) { const struct xt_target *target = t->u.target; struct compat_ebt_entry_mwt __user *cm = *dstptr; int off = xt_compat_target_offset(target); compat_uint_t tsize = t->target_size - off; if (WARN_ON(off >= t->target_size)) return -EINVAL; if (copy_to_user(cm->u.name, target->name, strlen(target->name) + 1) || put_user(tsize, &cm->match_size)) return -EFAULT; if (target->compat_to_user) { if (target->compat_to_user(cm->data, t->data)) return -EFAULT; } else { if (xt_data_to_user(cm->data, t->data, target->usersize, tsize, COMPAT_XT_ALIGN(tsize))) return -EFAULT; } *size -= ebt_compat_entry_padsize() + off; *dstptr = cm->data; *dstptr += tsize; return 0; }
static int compat_target_to_user(struct ebt_entry_target *t, void __user **dstptr, unsigned int *size) { const struct xt_target *target = t->u.target; struct compat_ebt_entry_mwt __user *cm = *dstptr; int off = xt_compat_target_offset(target); compat_uint_t tsize = t->target_size - off; if (WARN_ON(off >= t->target_size)) return -EINVAL; if (copy_to_user(cm->u.name, target->name, strlen(target->name) + 1) || put_user(tsize, &cm->match_size)) return -EFAULT; if (target->compat_to_user) { if (target->compat_to_user(cm->data, t->data)) return -EFAULT; } else { if (xt_data_to_user(cm->data, t->data, target->usersize, tsize, COMPAT_XT_ALIGN(tsize))) return -EFAULT; } *size -= ebt_compat_entry_padsize() + off; *dstptr = cm->data; *dstptr += tsize; return 0; }
C
linux
0
CVE-2014-1747
https://www.cvedetails.com/cve/CVE-2014-1747/
CWE-79
https://github.com/chromium/chromium/commit/1924f747637265f563892b8f56a64391f6208194
1924f747637265f563892b8f56a64391f6208194
Allow the cast tray to function as expected when the installed extension is missing API methods. BUG=489445 Review URL: https://codereview.chromium.org/1145833003 Cr-Commit-Position: refs/heads/master@{#330663}
void TrayCast::OnCastingSessionStartedOrStopped(bool started) { is_casting_ = started; UpdatePrimaryView(); }
void TrayCast::OnCastingSessionStartedOrStopped(bool started) { is_casting_ = started; UpdatePrimaryView(); }
C
Chrome
0
CVE-2015-5697
https://www.cvedetails.com/cve/CVE-2015-5697/
CWE-200
https://github.com/torvalds/linux/commit/b6878d9e03043695dbf3fa1caa6dfc09db225b16
b6878d9e03043695dbf3fa1caa6dfc09db225b16
md: use kzalloc() when bitmap is disabled In drivers/md/md.c get_bitmap_file() uses kmalloc() for creating a mdu_bitmap_file_t called "file". 5769 file = kmalloc(sizeof(*file), GFP_NOIO); 5770 if (!file) 5771 return -ENOMEM; This structure is copied to user space at the end of the function. 5786 if (err == 0 && 5787 copy_to_user(arg, file, sizeof(*file))) 5788 err = -EFAULT But if bitmap is disabled only the first byte of "file" is initialized with zero, so it's possible to read some bytes (up to 4095) of kernel space memory from user space. This is an information leak. 5775 /* bitmap disabled, zero the first byte and copy out */ 5776 if (!mddev->bitmap_info.file) 5777 file->pathname[0] = '\0'; Signed-off-by: Benjamin Randazzo <[email protected]> Signed-off-by: NeilBrown <[email protected]>
rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) { struct mddev *my_mddev = rdev->mddev; sector_t oldsectors = rdev->sectors; sector_t sectors; if (strict_blocks_to_sectors(buf, &sectors) < 0) return -EINVAL; if (rdev->data_offset != rdev->new_data_offset) return -EINVAL; /* too confusing */ if (my_mddev->pers && rdev->raid_disk >= 0) { if (my_mddev->persistent) { sectors = super_types[my_mddev->major_version]. rdev_size_change(rdev, sectors); if (!sectors) return -EBUSY; } else if (!sectors) sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) - rdev->data_offset; if (!my_mddev->pers->resize) /* Cannot change size for RAID0 or Linear etc */ return -EINVAL; } if (sectors < my_mddev->dev_sectors) return -EINVAL; /* component must fit device */ rdev->sectors = sectors; if (sectors > oldsectors && my_mddev->external) { /* Need to check that all other rdevs with the same * ->bdev do not overlap. 'rcu' is sufficient to walk * the rdev lists safely. * This check does not provide a hard guarantee, it * just helps avoid dangerous mistakes. */ struct mddev *mddev; int overlap = 0; struct list_head *tmp; rcu_read_lock(); for_each_mddev(mddev, tmp) { struct md_rdev *rdev2; rdev_for_each(rdev2, mddev) if (rdev->bdev == rdev2->bdev && rdev != rdev2 && overlaps(rdev->data_offset, rdev->sectors, rdev2->data_offset, rdev2->sectors)) { overlap = 1; break; } if (overlap) { mddev_put(mddev); break; } } rcu_read_unlock(); if (overlap) { /* Someone else could have slipped in a size * change here, but doing so is just silly. * We put oldsectors back because we *know* it is * safe, and trust userspace not to race with * itself */ rdev->sectors = oldsectors; return -EBUSY; } } return len; }
rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) { struct mddev *my_mddev = rdev->mddev; sector_t oldsectors = rdev->sectors; sector_t sectors; if (strict_blocks_to_sectors(buf, &sectors) < 0) return -EINVAL; if (rdev->data_offset != rdev->new_data_offset) return -EINVAL; /* too confusing */ if (my_mddev->pers && rdev->raid_disk >= 0) { if (my_mddev->persistent) { sectors = super_types[my_mddev->major_version]. rdev_size_change(rdev, sectors); if (!sectors) return -EBUSY; } else if (!sectors) sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) - rdev->data_offset; if (!my_mddev->pers->resize) /* Cannot change size for RAID0 or Linear etc */ return -EINVAL; } if (sectors < my_mddev->dev_sectors) return -EINVAL; /* component must fit device */ rdev->sectors = sectors; if (sectors > oldsectors && my_mddev->external) { /* Need to check that all other rdevs with the same * ->bdev do not overlap. 'rcu' is sufficient to walk * the rdev lists safely. * This check does not provide a hard guarantee, it * just helps avoid dangerous mistakes. */ struct mddev *mddev; int overlap = 0; struct list_head *tmp; rcu_read_lock(); for_each_mddev(mddev, tmp) { struct md_rdev *rdev2; rdev_for_each(rdev2, mddev) if (rdev->bdev == rdev2->bdev && rdev != rdev2 && overlaps(rdev->data_offset, rdev->sectors, rdev2->data_offset, rdev2->sectors)) { overlap = 1; break; } if (overlap) { mddev_put(mddev); break; } } rcu_read_unlock(); if (overlap) { /* Someone else could have slipped in a size * change here, but doing so is just silly. * We put oldsectors back because we *know* it is * safe, and trust userspace not to race with * itself */ rdev->sectors = oldsectors; return -EBUSY; } } return len; }
C
linux
0
CVE-2019-5755
https://www.cvedetails.com/cve/CVE-2019-5755/
CWE-189
https://github.com/chromium/chromium/commit/f045c704568e9cf6279b3cbccbec6d86c35f8a13
f045c704568e9cf6279b3cbccbec6d86c35f8a13
Disable FileSystemManager::CreateWriter if WritableFiles isn't enabled. Bug: 922677 Change-Id: Ib16137cbabb2ec07f1ffc0484722f1d9cc533404 Reviewed-on: https://chromium-review.googlesource.com/c/1416570 Commit-Queue: Marijn Kruisselbrink <[email protected]> Reviewed-by: Victor Costan <[email protected]> Cr-Commit-Position: refs/heads/master@{#623552}
void FileSystemManagerImpl::DidWrite(OperationListenerID listener_id, base::File::Error result, int64_t bytes, bool complete) { DCHECK_CURRENTLY_ON(BrowserThread::IO); blink::mojom::FileSystemOperationListener* listener = GetOpListener(listener_id); if (!listener) return; if (result == base::File::FILE_OK) { listener->DidWrite(bytes, complete); if (complete) RemoveOpListener(listener_id); } else { listener->ErrorOccurred(result); RemoveOpListener(listener_id); } }
void FileSystemManagerImpl::DidWrite(OperationListenerID listener_id, base::File::Error result, int64_t bytes, bool complete) { DCHECK_CURRENTLY_ON(BrowserThread::IO); blink::mojom::FileSystemOperationListener* listener = GetOpListener(listener_id); if (!listener) return; if (result == base::File::FILE_OK) { listener->DidWrite(bytes, complete); if (complete) RemoveOpListener(listener_id); } else { listener->ErrorOccurred(result); RemoveOpListener(listener_id); } }
C
Chrome
0
CVE-2014-9664
https://www.cvedetails.com/cve/CVE-2014-9664/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=dd89710f0f643eb0f99a3830e0712d26c7642acd
dd89710f0f643eb0f99a3830e0712d26c7642acd
null
parse_subrs( T1_Face face, T1_Loader loader ) { T1_Parser parser = &loader->parser; PS_Table table = &loader->subrs; FT_Memory memory = parser->root.memory; FT_Error error; FT_Int num_subrs; PSAux_Service psaux = (PSAux_Service)face->psaux; T1_Skip_Spaces( parser ); /* test for empty array */ if ( parser->root.cursor < parser->root.limit && *parser->root.cursor == '[' ) { T1_Skip_PS_Token( parser ); T1_Skip_Spaces ( parser ); if ( parser->root.cursor >= parser->root.limit || *parser->root.cursor != ']' ) parser->root.error = FT_THROW( Invalid_File_Format ); return; } num_subrs = (FT_Int)T1_ToInt( parser ); /* position the parser right before the `dup' of the first subr */ T1_Skip_PS_Token( parser ); /* `array' */ if ( parser->root.error ) return; T1_Skip_Spaces( parser ); /* initialize subrs array -- with synthetic fonts it is possible */ /* we get here twice */ if ( !loader->num_subrs ) { error = psaux->ps_table_funcs->init( table, num_subrs, memory ); if ( error ) goto Fail; } /* the format is simple: */ /* */ /* `index' + binary data */ /* */ for (;;) { FT_Long idx, size; FT_Byte* base; /* If we are out of data, or if the next token isn't `dup', */ /* we are done. */ if ( parser->root.cursor + 4 >= parser->root.limit || ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; T1_Skip_PS_Token( parser ); /* `dup' */ idx = T1_ToInt( parser ); if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* The binary string is followed by one token, e.g. `NP' */ /* (bound to `noaccess put') or by two separate tokens: */ /* `noaccess' & `put'. We position the parser right */ /* before the next `dup', if any. */ T1_Skip_PS_Token( parser ); /* `NP' or `|' or `noaccess' */ if ( parser->root.error ) return; T1_Skip_Spaces ( parser ); if ( parser->root.cursor + 4 < parser->root.limit && ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) { T1_Skip_PS_Token( parser ); /* skip `put' */ T1_Skip_Spaces ( parser ); } /* with synthetic fonts it is possible we get here twice */ if ( loader->num_subrs ) continue; /* some fonts use a value of -1 for lenIV to indicate that */ /* the charstrings are unencoded */ /* */ /* thanks to Tom Kacvinsky for pointing this out */ /* */ if ( face->type1.private_dict.lenIV >= 0 ) { FT_Byte* temp; /* some fonts define empty subr records -- this is not totally */ /* compliant to the specification (which says they should at */ /* least contain a `return'), but we support them anyway */ if ( size < face->type1.private_dict.lenIV ) { error = FT_THROW( Invalid_File_Format ); goto Fail; } /* t1_decrypt() shouldn't write to base -- make temporary copy */ if ( FT_ALLOC( temp, size ) ) goto Fail; FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= face->type1.private_dict.lenIV; error = T1_Add_Table( table, (FT_Int)idx, temp + face->type1.private_dict.lenIV, size ); FT_FREE( temp ); } else error = T1_Add_Table( table, (FT_Int)idx, base, size ); if ( error ) goto Fail; } if ( !loader->num_subrs ) loader->num_subrs = num_subrs; return; Fail: parser->root.error = error; }
parse_subrs( T1_Face face, T1_Loader loader ) { T1_Parser parser = &loader->parser; PS_Table table = &loader->subrs; FT_Memory memory = parser->root.memory; FT_Error error; FT_Int num_subrs; PSAux_Service psaux = (PSAux_Service)face->psaux; T1_Skip_Spaces( parser ); /* test for empty array */ if ( parser->root.cursor < parser->root.limit && *parser->root.cursor == '[' ) { T1_Skip_PS_Token( parser ); T1_Skip_Spaces ( parser ); if ( parser->root.cursor >= parser->root.limit || *parser->root.cursor != ']' ) parser->root.error = FT_THROW( Invalid_File_Format ); return; } num_subrs = (FT_Int)T1_ToInt( parser ); /* position the parser right before the `dup' of the first subr */ T1_Skip_PS_Token( parser ); /* `array' */ if ( parser->root.error ) return; T1_Skip_Spaces( parser ); /* initialize subrs array -- with synthetic fonts it is possible */ /* we get here twice */ if ( !loader->num_subrs ) { error = psaux->ps_table_funcs->init( table, num_subrs, memory ); if ( error ) goto Fail; } /* the format is simple: */ /* */ /* `index' + binary data */ /* */ for (;;) { FT_Long idx, size; FT_Byte* base; /* If we are out of data, or if the next token isn't `dup', */ /* we are done. */ if ( parser->root.cursor + 4 >= parser->root.limit || ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; T1_Skip_PS_Token( parser ); /* `dup' */ idx = T1_ToInt( parser ); if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* The binary string is followed by one token, e.g. `NP' */ /* (bound to `noaccess put') or by two separate tokens: */ /* `noaccess' & `put'. We position the parser right */ /* before the next `dup', if any. */ T1_Skip_PS_Token( parser ); /* `NP' or `|' or `noaccess' */ if ( parser->root.error ) return; T1_Skip_Spaces ( parser ); if ( parser->root.cursor + 4 < parser->root.limit && ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) { T1_Skip_PS_Token( parser ); /* skip `put' */ T1_Skip_Spaces ( parser ); } /* with synthetic fonts it is possible we get here twice */ if ( loader->num_subrs ) continue; /* some fonts use a value of -1 for lenIV to indicate that */ /* the charstrings are unencoded */ /* */ /* thanks to Tom Kacvinsky for pointing this out */ /* */ if ( face->type1.private_dict.lenIV >= 0 ) { FT_Byte* temp; /* some fonts define empty subr records -- this is not totally */ /* compliant to the specification (which says they should at */ /* least contain a `return'), but we support them anyway */ if ( size < face->type1.private_dict.lenIV ) { error = FT_THROW( Invalid_File_Format ); goto Fail; } /* t1_decrypt() shouldn't write to base -- make temporary copy */ if ( FT_ALLOC( temp, size ) ) goto Fail; FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= face->type1.private_dict.lenIV; error = T1_Add_Table( table, (FT_Int)idx, temp + face->type1.private_dict.lenIV, size ); FT_FREE( temp ); } else error = T1_Add_Table( table, (FT_Int)idx, base, size ); if ( error ) goto Fail; } if ( !loader->num_subrs ) loader->num_subrs = num_subrs; return; Fail: parser->root.error = error; }
C
savannah
0
CVE-2013-1828
https://www.cvedetails.com/cve/CVE-2013-1828/
CWE-20
https://github.com/torvalds/linux/commit/726bc6b092da4c093eb74d13c07184b18c1af0f1
726bc6b092da4c093eb74d13c07184b18c1af0f1
net/sctp: Validate parameter size for SCTP_GET_ASSOC_STATS Building sctp may fail with: In function ‘copy_from_user’, inlined from ‘sctp_getsockopt_assoc_stats’ at net/sctp/socket.c:5656:20: arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error: copy_from_user() buffer size is not provably correct if built with W=1 due to a missing parameter size validation before the call to copy_from_user. Signed-off-by: Guenter Roeck <[email protected]> Acked-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, struct sctp_association *assoc, sctp_socket_type_t type) { struct sctp_sock *oldsp = sctp_sk(oldsk); struct sctp_sock *newsp = sctp_sk(newsk); struct sctp_bind_bucket *pp; /* hash list port iterator */ struct sctp_endpoint *newep = newsp->ep; struct sk_buff *skb, *tmp; struct sctp_ulpevent *event; struct sctp_bind_hashbucket *head; struct list_head tmplist; /* Migrate socket buffer sizes and all the socket level options to the * new socket. */ newsk->sk_sndbuf = oldsk->sk_sndbuf; newsk->sk_rcvbuf = oldsk->sk_rcvbuf; /* Brute force copy old sctp opt. */ if (oldsp->do_auto_asconf) { memcpy(&tmplist, &newsp->auto_asconf_list, sizeof(tmplist)); inet_sk_copy_descendant(newsk, oldsk); memcpy(&newsp->auto_asconf_list, &tmplist, sizeof(tmplist)); } else inet_sk_copy_descendant(newsk, oldsk); /* Restore the ep value that was overwritten with the above structure * copy. */ newsp->ep = newep; newsp->hmac = NULL; /* Hook this new socket in to the bind_hash list. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(oldsk), inet_sk(oldsk)->inet_num)]; sctp_local_bh_disable(); sctp_spin_lock(&head->lock); pp = sctp_sk(oldsk)->bind_hash; sk_add_bind_node(newsk, &pp->owner); sctp_sk(newsk)->bind_hash = pp; inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num; sctp_spin_unlock(&head->lock); sctp_local_bh_enable(); /* Copy the bind_addr list from the original endpoint to the new * endpoint so that we can handle restarts properly */ sctp_bind_addr_dup(&newsp->ep->base.bind_addr, &oldsp->ep->base.bind_addr, GFP_KERNEL); /* Move any messages in the old socket's receive queue that are for the * peeled off association to the new socket's receive queue. */ sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) { event = sctp_skb2event(skb); if (event->asoc == assoc) { __skb_unlink(skb, &oldsk->sk_receive_queue); __skb_queue_tail(&newsk->sk_receive_queue, skb); sctp_skb_set_owner_r_frag(skb, newsk); } } /* Clean up any messages pending delivery due to partial * delivery. Three cases: * 1) No partial deliver; no work. * 2) Peeling off partial delivery; keep pd_lobby in new pd_lobby. * 3) Peeling off non-partial delivery; move pd_lobby to receive_queue. */ skb_queue_head_init(&newsp->pd_lobby); atomic_set(&sctp_sk(newsk)->pd_mode, assoc->ulpq.pd_mode); if (atomic_read(&sctp_sk(oldsk)->pd_mode)) { struct sk_buff_head *queue; /* Decide which queue to move pd_lobby skbs to. */ if (assoc->ulpq.pd_mode) { queue = &newsp->pd_lobby; } else queue = &newsk->sk_receive_queue; /* Walk through the pd_lobby, looking for skbs that * need moved to the new socket. */ sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) { event = sctp_skb2event(skb); if (event->asoc == assoc) { __skb_unlink(skb, &oldsp->pd_lobby); __skb_queue_tail(queue, skb); sctp_skb_set_owner_r_frag(skb, newsk); } } /* Clear up any skbs waiting for the partial * delivery to finish. */ if (assoc->ulpq.pd_mode) sctp_clear_pd(oldsk, NULL); } sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp) sctp_skb_set_owner_r_frag(skb, newsk); sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) sctp_skb_set_owner_r_frag(skb, newsk); /* Set the type of socket to indicate that it is peeled off from the * original UDP-style socket or created with the accept() call on a * TCP-style socket.. */ newsp->type = type; /* Mark the new socket "in-use" by the user so that any packets * that may arrive on the association after we've moved it are * queued to the backlog. This prevents a potential race between * backlog processing on the old socket and new-packet processing * on the new socket. * * The caller has just allocated newsk so we can guarantee that other * paths won't try to lock it and then oldsk. */ lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); sctp_assoc_migrate(assoc, newsk); /* If the association on the newsk is already closed before accept() * is called, set RCV_SHUTDOWN flag. */ if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP)) newsk->sk_shutdown |= RCV_SHUTDOWN; newsk->sk_state = SCTP_SS_ESTABLISHED; sctp_release_sock(newsk); }
static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, struct sctp_association *assoc, sctp_socket_type_t type) { struct sctp_sock *oldsp = sctp_sk(oldsk); struct sctp_sock *newsp = sctp_sk(newsk); struct sctp_bind_bucket *pp; /* hash list port iterator */ struct sctp_endpoint *newep = newsp->ep; struct sk_buff *skb, *tmp; struct sctp_ulpevent *event; struct sctp_bind_hashbucket *head; struct list_head tmplist; /* Migrate socket buffer sizes and all the socket level options to the * new socket. */ newsk->sk_sndbuf = oldsk->sk_sndbuf; newsk->sk_rcvbuf = oldsk->sk_rcvbuf; /* Brute force copy old sctp opt. */ if (oldsp->do_auto_asconf) { memcpy(&tmplist, &newsp->auto_asconf_list, sizeof(tmplist)); inet_sk_copy_descendant(newsk, oldsk); memcpy(&newsp->auto_asconf_list, &tmplist, sizeof(tmplist)); } else inet_sk_copy_descendant(newsk, oldsk); /* Restore the ep value that was overwritten with the above structure * copy. */ newsp->ep = newep; newsp->hmac = NULL; /* Hook this new socket in to the bind_hash list. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(oldsk), inet_sk(oldsk)->inet_num)]; sctp_local_bh_disable(); sctp_spin_lock(&head->lock); pp = sctp_sk(oldsk)->bind_hash; sk_add_bind_node(newsk, &pp->owner); sctp_sk(newsk)->bind_hash = pp; inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num; sctp_spin_unlock(&head->lock); sctp_local_bh_enable(); /* Copy the bind_addr list from the original endpoint to the new * endpoint so that we can handle restarts properly */ sctp_bind_addr_dup(&newsp->ep->base.bind_addr, &oldsp->ep->base.bind_addr, GFP_KERNEL); /* Move any messages in the old socket's receive queue that are for the * peeled off association to the new socket's receive queue. */ sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) { event = sctp_skb2event(skb); if (event->asoc == assoc) { __skb_unlink(skb, &oldsk->sk_receive_queue); __skb_queue_tail(&newsk->sk_receive_queue, skb); sctp_skb_set_owner_r_frag(skb, newsk); } } /* Clean up any messages pending delivery due to partial * delivery. Three cases: * 1) No partial deliver; no work. * 2) Peeling off partial delivery; keep pd_lobby in new pd_lobby. * 3) Peeling off non-partial delivery; move pd_lobby to receive_queue. */ skb_queue_head_init(&newsp->pd_lobby); atomic_set(&sctp_sk(newsk)->pd_mode, assoc->ulpq.pd_mode); if (atomic_read(&sctp_sk(oldsk)->pd_mode)) { struct sk_buff_head *queue; /* Decide which queue to move pd_lobby skbs to. */ if (assoc->ulpq.pd_mode) { queue = &newsp->pd_lobby; } else queue = &newsk->sk_receive_queue; /* Walk through the pd_lobby, looking for skbs that * need moved to the new socket. */ sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) { event = sctp_skb2event(skb); if (event->asoc == assoc) { __skb_unlink(skb, &oldsp->pd_lobby); __skb_queue_tail(queue, skb); sctp_skb_set_owner_r_frag(skb, newsk); } } /* Clear up any skbs waiting for the partial * delivery to finish. */ if (assoc->ulpq.pd_mode) sctp_clear_pd(oldsk, NULL); } sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp) sctp_skb_set_owner_r_frag(skb, newsk); sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) sctp_skb_set_owner_r_frag(skb, newsk); /* Set the type of socket to indicate that it is peeled off from the * original UDP-style socket or created with the accept() call on a * TCP-style socket.. */ newsp->type = type; /* Mark the new socket "in-use" by the user so that any packets * that may arrive on the association after we've moved it are * queued to the backlog. This prevents a potential race between * backlog processing on the old socket and new-packet processing * on the new socket. * * The caller has just allocated newsk so we can guarantee that other * paths won't try to lock it and then oldsk. */ lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); sctp_assoc_migrate(assoc, newsk); /* If the association on the newsk is already closed before accept() * is called, set RCV_SHUTDOWN flag. */ if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP)) newsk->sk_shutdown |= RCV_SHUTDOWN; newsk->sk_state = SCTP_SS_ESTABLISHED; sctp_release_sock(newsk); }
C
linux
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance [email protected],[email protected] Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
scoped_refptr<VertexAttribManager> CreateVertexAttribManager( GLuint client_id, GLuint service_id, bool client_visible) { return vertex_array_manager()->CreateVertexAttribManager( client_id, service_id, group_->max_vertex_attribs(), client_visible); }
scoped_refptr<VertexAttribManager> CreateVertexAttribManager( GLuint client_id, GLuint service_id, bool client_visible) { return vertex_array_manager()->CreateVertexAttribManager( client_id, service_id, group_->max_vertex_attribs(), client_visible); }
C
Chrome
0
CVE-2014-3515
https://www.cvedetails.com/cve/CVE-2014-3515/
null
https://git.php.net/?p=php-src.git;a=commit;h=88223c5245e9b470e1e6362bfd96829562ffe6ab
88223c5245e9b470e1e6362bfd96829562ffe6ab
null
static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, char *hash) { if (intern->fptr_get_hash) { efree(hash); } else { #if HAVE_PACKED_OBJECT_VALUE /* Nothing to do */ #else efree(hash); #endif } }
static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, char *hash) { if (intern->fptr_get_hash) { efree(hash); } else { #if HAVE_PACKED_OBJECT_VALUE /* Nothing to do */ #else efree(hash); #endif } }
C
php
0
CVE-2017-9228
https://www.cvedetails.com/cve/CVE-2017-9228/
CWE-787
https://github.com/kkos/oniguruma/commit/3b63d12038c8d8fc278e81c942fa9bec7c704c8b
3b63d12038c8d8fc278e81c942fa9bec7c704c8b
fix #60 : invalid state(CCS_VALUE) in parse_char_class()
fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, UChar** rname_end, ScanEnv* env, int* rback_num, int ref) { int r, is_num, sign; OnigCodePoint end_code; OnigCodePoint c = 0; OnigEncoding enc = env->enc; UChar *name_end; UChar *pnum_head; UChar *p = *src; *rback_num = 0; end_code = get_name_end_code_point(start_code); name_end = end; pnum_head = *src; r = 0; is_num = 0; sign = 1; if (PEND) { return ONIGERR_EMPTY_GROUP_NAME; } else { PFETCH_S(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (ONIGENC_IS_CODE_DIGIT(enc, c)) { if (ref == 1) is_num = 1; else { r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else if (c == '-') { if (ref == 1) { is_num = 2; sign = -1; pnum_head = p; } else { r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } if (r == 0) { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') { if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; break; } if (is_num != 0) { if (ONIGENC_IS_CODE_DIGIT(enc, c)) { is_num = 1; } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; else r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } } if (c != end_code) { r = ONIGERR_INVALID_GROUP_NAME; name_end = end; } if (is_num != 0) { *rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) { r = ONIGERR_INVALID_GROUP_NAME; goto err; } *rback_num *= sign; } *rname_end = name_end; *src = p; return 0; } else { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') break; } if (PEND) name_end = end; err: onig_scan_env_set_error_string(env, r, *src, name_end); return r; } }
fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, UChar** rname_end, ScanEnv* env, int* rback_num, int ref) { int r, is_num, sign; OnigCodePoint end_code; OnigCodePoint c = 0; OnigEncoding enc = env->enc; UChar *name_end; UChar *pnum_head; UChar *p = *src; *rback_num = 0; end_code = get_name_end_code_point(start_code); name_end = end; pnum_head = *src; r = 0; is_num = 0; sign = 1; if (PEND) { return ONIGERR_EMPTY_GROUP_NAME; } else { PFETCH_S(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (ONIGENC_IS_CODE_DIGIT(enc, c)) { if (ref == 1) is_num = 1; else { r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else if (c == '-') { if (ref == 1) { is_num = 2; sign = -1; pnum_head = p; } else { r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } if (r == 0) { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') { if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; break; } if (is_num != 0) { if (ONIGENC_IS_CODE_DIGIT(enc, c)) { is_num = 1; } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; else r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } } if (c != end_code) { r = ONIGERR_INVALID_GROUP_NAME; name_end = end; } if (is_num != 0) { *rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) { r = ONIGERR_INVALID_GROUP_NAME; goto err; } *rback_num *= sign; } *rname_end = name_end; *src = p; return 0; } else { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') break; } if (PEND) name_end = end; err: onig_scan_env_set_error_string(env, r, *src, name_end); return r; } }
C
oniguruma
0
CVE-2014-1715
https://www.cvedetails.com/cve/CVE-2014-1715/
CWE-22
https://github.com/chromium/chromium/commit/ce70785c73a2b7cf2b34de0d8439ca31929b4743
ce70785c73a2b7cf2b34de0d8439ca31929b4743
Consistently check if a block can handle pagination strut propagation. https://codereview.chromium.org/1360753002 got it right for inline child layout, but did nothing for block child layout. BUG=329421 [email protected],[email protected] Review URL: https://codereview.chromium.org/1387553002 Cr-Commit-Position: refs/heads/master@{#352429}
void LayoutBlockFlow::adjustPositionedBlock(LayoutBox& child, const MarginInfo& marginInfo) { LayoutUnit logicalTop = logicalHeight(); updateStaticInlinePositionForChild(child, logicalTop); if (!marginInfo.canCollapseWithMarginBefore()) { LayoutUnit collapsedBeforePos = marginInfo.positiveMargin(); LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin(); logicalTop += collapsedBeforePos - collapsedBeforeNeg; } PaintLayer* childLayer = child.layer(); if (childLayer->staticBlockPosition() != logicalTop) childLayer->setStaticBlockPosition(logicalTop); }
void LayoutBlockFlow::adjustPositionedBlock(LayoutBox& child, const MarginInfo& marginInfo) { LayoutUnit logicalTop = logicalHeight(); updateStaticInlinePositionForChild(child, logicalTop); if (!marginInfo.canCollapseWithMarginBefore()) { LayoutUnit collapsedBeforePos = marginInfo.positiveMargin(); LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin(); logicalTop += collapsedBeforePos - collapsedBeforeNeg; } PaintLayer* childLayer = child.layer(); if (childLayer->staticBlockPosition() != logicalTop) childLayer->setStaticBlockPosition(logicalTop); }
C
Chrome
0
CVE-2018-6942
https://www.cvedetails.com/cve/CVE-2018-6942/
CWE-476
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=29c759284e305ec428703c9a5831d0b1fc3497ef
29c759284e305ec428703c9a5831d0b1fc3497ef
null
Ins_NPUSHB( TT_ExecContext exc, FT_Long* args ) { FT_UShort L, K; L = (FT_UShort)exc->code[exc->IP + 1]; if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { exc->error = FT_THROW( Stack_Overflow ); return; } for ( K = 1; K <= L; K++ ) args[K - 1] = exc->code[exc->IP + K + 1]; exc->new_top += L; }
Ins_NPUSHB( TT_ExecContext exc, FT_Long* args ) { FT_UShort L, K; L = (FT_UShort)exc->code[exc->IP + 1]; if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { exc->error = FT_THROW( Stack_Overflow ); return; } for ( K = 1; K <= L; K++ ) args[K - 1] = exc->code[exc->IP + K + 1]; exc->new_top += L; }
C
savannah
0
null
null
null
https://github.com/chromium/chromium/commit/27c68f543e5eba779902447445dfb05ec3f5bf75
27c68f543e5eba779902447445dfb05ec3f5bf75
Revert of Add accelerated VP9 decode infrastructure and an implementation for VA-API. (patchset #7 id:260001 of https://codereview.chromium.org/1318863003/ ) Reason for revert: I think this patch broke compile step for Chromium Linux ChromeOS MSan Builder. First failing build: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/8310 All recent builds: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder?numbuilds=200 Sorry for the revert. I'll re-revert if I'm wrong. Cheers, Tommy Original issue's description: > Add accelerated VP9 decode infrastructure and an implementation for VA-API. > > - Add a hardware/platform-independent VP9Decoder class and related > infrastructure, implementing AcceleratedVideoDecoder interface. VP9Decoder > performs the initial stages of the decode process, which are to be done > on host/in software, such as stream parsing and reference frame management. > > - Add a VP9Accelerator interface, used by the VP9Decoder to offload the > remaining stages of the decode process to hardware. VP9Accelerator > implementations are platform-specific. > > - Add the first implementation of VP9Accelerator - VaapiVP9Accelerator - and > integrate it with VaapiVideoDecodeAccelerator, for devices which provide > hardware VP9 acceleration through VA-API. Hook it up to the new > infrastructure and VP9Decoder. > > - Extend Vp9Parser to provide functionality required by VP9Decoder and > VP9Accelerator, including superframe parsing, handling of loop filter > and segmentation initialization, state persistence across frames and > resetting when needed. Also add code calculating segmentation dequants > and loop filter levels. > > - Update vp9_parser_unittest to the new Vp9Parser interface and flow. > > TEST=vp9_parser_unittest,vda_unittest,Chrome VP9 playback > BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 > [email protected] > > Committed: https://crrev.com/e3cc0a661b8abfdc74f569940949bc1f336ece40 > Cr-Commit-Position: refs/heads/master@{#349312} [email protected],[email protected],[email protected],[email protected],[email protected] NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 Review URL: https://codereview.chromium.org/1357513002 Cr-Commit-Position: refs/heads/master@{#349443}
void VaapiVideoDecodeAccelerator::Reset() { DCHECK_EQ(message_loop_, base::MessageLoop::current()); DVLOG(1) << "Got reset request"; base::AutoLock auto_lock(lock_); state_ = kResetting; finish_flush_pending_ = false; while (!input_buffers_.empty()) { message_loop_->PostTask(FROM_HERE, base::Bind( &Client::NotifyEndOfBitstreamBuffer, client_, input_buffers_.front()->id)); input_buffers_.pop(); } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::ResetTask, base::Unretained(this))); input_ready_.Signal(); surfaces_available_.Signal(); }
void VaapiVideoDecodeAccelerator::Reset() { DCHECK_EQ(message_loop_, base::MessageLoop::current()); DVLOG(1) << "Got reset request"; base::AutoLock auto_lock(lock_); state_ = kResetting; finish_flush_pending_ = false; while (!input_buffers_.empty()) { message_loop_->PostTask(FROM_HERE, base::Bind( &Client::NotifyEndOfBitstreamBuffer, client_, input_buffers_.front()->id)); input_buffers_.pop(); } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::ResetTask, base::Unretained(this))); input_ready_.Signal(); surfaces_available_.Signal(); }
C
Chrome
0
CVE-2011-3927
https://www.cvedetails.com/cve/CVE-2011-3927/
CWE-19
https://github.com/chromium/chromium/commit/58ffd25567098d8ce9443b7c977382929d163b3d
58ffd25567098d8ce9443b7c977382929d163b3d
[skia] not all convex paths are convex, so recompute convexity for the problematic ones https://bugs.webkit.org/show_bug.cgi?id=75960 Reviewed by Stephen White. No new tests. See related chrome issue http://code.google.com/p/chromium/issues/detail?id=108605 * platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::setPathFromConvexPoints): git-svn-id: svn://svn.chromium.org/blink/trunk@104609 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static bool isPointSkiaSafe(const SkMatrix& transform, const SkPoint& pt) { #ifdef ENSURE_VALUE_SAFETY_FOR_SKIA SkPoint xPt; transform.mapPoints(&xPt, &pt, 1); return isCoordinateSkiaSafe(xPt.fX) && isCoordinateSkiaSafe(xPt.fY); #else return true; #endif }
static bool isPointSkiaSafe(const SkMatrix& transform, const SkPoint& pt) { #ifdef ENSURE_VALUE_SAFETY_FOR_SKIA SkPoint xPt; transform.mapPoints(&xPt, &pt, 1); return isCoordinateSkiaSafe(xPt.fX) && isCoordinateSkiaSafe(xPt.fY); #else return true; #endif }
C
Chrome
0
CVE-2017-9310
https://www.cvedetails.com/cve/CVE-2017-9310/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=4154c7e03fa55b4cf52509a83d50d6c09d743b7
4154c7e03fa55b4cf52509a83d50d6c09d743b77
null
e1000e_core_reset(E1000ECore *core) { int i; timer_del(core->autoneg_timer); e1000e_intrmgr_reset(core); memset(core->phy, 0, sizeof core->phy); memmove(core->phy, e1000e_phy_reg_init, sizeof e1000e_phy_reg_init); memset(core->mac, 0, sizeof core->mac); memmove(core->mac, e1000e_mac_reg_init, sizeof e1000e_mac_reg_init); core->rxbuf_min_shift = 1 + E1000_RING_DESC_LEN_SHIFT; if (qemu_get_queue(core->owner_nic)->link_down) { e1000e_link_down(core); } e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_mac); for (i = 0; i < ARRAY_SIZE(core->tx); i++) { net_tx_pkt_reset(core->tx[i].tx_pkt); memset(&core->tx[i].props, 0, sizeof(core->tx[i].props)); core->tx[i].skip_cp = false; } }
e1000e_core_reset(E1000ECore *core) { int i; timer_del(core->autoneg_timer); e1000e_intrmgr_reset(core); memset(core->phy, 0, sizeof core->phy); memmove(core->phy, e1000e_phy_reg_init, sizeof e1000e_phy_reg_init); memset(core->mac, 0, sizeof core->mac); memmove(core->mac, e1000e_mac_reg_init, sizeof e1000e_mac_reg_init); core->rxbuf_min_shift = 1 + E1000_RING_DESC_LEN_SHIFT; if (qemu_get_queue(core->owner_nic)->link_down) { e1000e_link_down(core); } e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_mac); for (i = 0; i < ARRAY_SIZE(core->tx); i++) { net_tx_pkt_reset(core->tx[i].tx_pkt); memset(&core->tx[i].props, 0, sizeof(core->tx[i].props)); core->tx[i].skip_cp = false; } }
C
qemu
0
CVE-2017-0589
https://www.cvedetails.com/cve/CVE-2017-0589/
CWE-119
https://android.googlesource.com/platform/external/libhevc/+/bcfc7124f6ef9f1ec128fb2e90de774a5b33d199
bcfc7124f6ef9f1ec128fb2e90de774a5b33d199
Return error from cabac init if offset is greater than range When the offset was greater than range, the bitstream was read more than the valid range in leaf-level cabac parsing modules. Error check was added to cabac init to fix this issue. Additionally end of slice and slice error were signalled to suppress further parsing of current slice. Bug: 34897036 Change-Id: I1263f1d1219684ffa6e952c76e5a08e9a933c9d2 (cherry picked from commit 3b175da88a1807d19cdd248b74bce60e57f05c6a) (cherry picked from commit b92314c860d01d754ef579eafe55d7377962b3ba)
IHEVCD_ERROR_T ihevcd_parse_prediction_unit(codec_t *ps_codec, WORD32 x0, WORD32 y0, WORD32 wd, WORD32 ht) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; slice_header_t *ps_slice_hdr; sps_t *ps_sps; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 ctb_x_base; WORD32 ctb_y_base; pu_t *ps_pu = ps_codec->s_parse.ps_pu; cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac; ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr; /* Set PU structure to default values */ memset(ps_pu, 0, sizeof(pu_t)); ps_sps = ps_codec->s_parse.ps_sps; ctb_x_base = ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size; ctb_y_base = ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size; ps_pu->b4_pos_x = (x0 - ctb_x_base) >> 2; ps_pu->b4_pos_y = (y0 - ctb_y_base) >> 2; ps_pu->b4_wd = (wd >> 2) - 1; ps_pu->b4_ht = (ht >> 2) - 1; ps_pu->b1_intra_flag = 0; ps_pu->b3_part_mode = ps_codec->s_parse.s_cu.i4_part_mode; if(PRED_MODE_SKIP == ps_codec->s_parse.s_cu.i4_pred_mode) { WORD32 merge_idx = 0; if(ps_slice_hdr->i1_max_num_merge_cand > 1) { WORD32 ctxt_idx = IHEVC_CAB_MERGE_IDX_EXT; WORD32 bin; TRACE_CABAC_CTXT("merge_idx", ps_cabac->u4_range, ctxt_idx); bin = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(bin) { if(ps_slice_hdr->i1_max_num_merge_cand > 2) { merge_idx = ihevcd_cabac_decode_bypass_bins_tunary( ps_cabac, ps_bitstrm, (ps_slice_hdr->i1_max_num_merge_cand - 2)); } merge_idx++; } AEV_TRACE("merge_idx", merge_idx, ps_cabac->u4_range); } ps_pu->b1_merge_flag = 1; ps_pu->b3_merge_idx = merge_idx; } else { /* MODE_INTER */ WORD32 merge_flag; WORD32 ctxt_idx = IHEVC_CAB_MERGE_FLAG_EXT; TRACE_CABAC_CTXT("merge_flag", ps_cabac->u4_range, ctxt_idx); merge_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE("merge_flag", merge_flag, ps_cabac->u4_range); ps_pu->b1_merge_flag = merge_flag; if(merge_flag) { WORD32 merge_idx = 0; if(ps_slice_hdr->i1_max_num_merge_cand > 1) { WORD32 ctxt_idx = IHEVC_CAB_MERGE_IDX_EXT; WORD32 bin; TRACE_CABAC_CTXT("merge_idx", ps_cabac->u4_range, ctxt_idx); bin = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(bin) { if(ps_slice_hdr->i1_max_num_merge_cand > 2) { merge_idx = ihevcd_cabac_decode_bypass_bins_tunary( ps_cabac, ps_bitstrm, (ps_slice_hdr->i1_max_num_merge_cand - 2)); } merge_idx++; } AEV_TRACE("merge_idx", merge_idx, ps_cabac->u4_range); } ps_pu->b3_merge_idx = merge_idx; } else { ihevcd_parse_pu_mvp(ps_codec, ps_pu); } } STATS_UPDATE_PU_SIZE(ps_pu); /* Increment PU pointer */ ps_codec->s_parse.ps_pu++; ps_codec->s_parse.i4_pic_pu_idx++; return ret; }
IHEVCD_ERROR_T ihevcd_parse_prediction_unit(codec_t *ps_codec, WORD32 x0, WORD32 y0, WORD32 wd, WORD32 ht) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; slice_header_t *ps_slice_hdr; sps_t *ps_sps; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 ctb_x_base; WORD32 ctb_y_base; pu_t *ps_pu = ps_codec->s_parse.ps_pu; cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac; ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr; /* Set PU structure to default values */ memset(ps_pu, 0, sizeof(pu_t)); ps_sps = ps_codec->s_parse.ps_sps; ctb_x_base = ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size; ctb_y_base = ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size; ps_pu->b4_pos_x = (x0 - ctb_x_base) >> 2; ps_pu->b4_pos_y = (y0 - ctb_y_base) >> 2; ps_pu->b4_wd = (wd >> 2) - 1; ps_pu->b4_ht = (ht >> 2) - 1; ps_pu->b1_intra_flag = 0; ps_pu->b3_part_mode = ps_codec->s_parse.s_cu.i4_part_mode; if(PRED_MODE_SKIP == ps_codec->s_parse.s_cu.i4_pred_mode) { WORD32 merge_idx = 0; if(ps_slice_hdr->i1_max_num_merge_cand > 1) { WORD32 ctxt_idx = IHEVC_CAB_MERGE_IDX_EXT; WORD32 bin; TRACE_CABAC_CTXT("merge_idx", ps_cabac->u4_range, ctxt_idx); bin = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(bin) { if(ps_slice_hdr->i1_max_num_merge_cand > 2) { merge_idx = ihevcd_cabac_decode_bypass_bins_tunary( ps_cabac, ps_bitstrm, (ps_slice_hdr->i1_max_num_merge_cand - 2)); } merge_idx++; } AEV_TRACE("merge_idx", merge_idx, ps_cabac->u4_range); } ps_pu->b1_merge_flag = 1; ps_pu->b3_merge_idx = merge_idx; } else { /* MODE_INTER */ WORD32 merge_flag; WORD32 ctxt_idx = IHEVC_CAB_MERGE_FLAG_EXT; TRACE_CABAC_CTXT("merge_flag", ps_cabac->u4_range, ctxt_idx); merge_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE("merge_flag", merge_flag, ps_cabac->u4_range); ps_pu->b1_merge_flag = merge_flag; if(merge_flag) { WORD32 merge_idx = 0; if(ps_slice_hdr->i1_max_num_merge_cand > 1) { WORD32 ctxt_idx = IHEVC_CAB_MERGE_IDX_EXT; WORD32 bin; TRACE_CABAC_CTXT("merge_idx", ps_cabac->u4_range, ctxt_idx); bin = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(bin) { if(ps_slice_hdr->i1_max_num_merge_cand > 2) { merge_idx = ihevcd_cabac_decode_bypass_bins_tunary( ps_cabac, ps_bitstrm, (ps_slice_hdr->i1_max_num_merge_cand - 2)); } merge_idx++; } AEV_TRACE("merge_idx", merge_idx, ps_cabac->u4_range); } ps_pu->b3_merge_idx = merge_idx; } else { ihevcd_parse_pu_mvp(ps_codec, ps_pu); } } STATS_UPDATE_PU_SIZE(ps_pu); /* Increment PU pointer */ ps_codec->s_parse.ps_pu++; ps_codec->s_parse.i4_pic_pu_idx++; return ret; }
C
Android
0
CVE-2017-5044
https://www.cvedetails.com/cve/CVE-2017-5044/
CWE-119
https://github.com/chromium/chromium/commit/62154472bd2c43e1790dd1bd8a527c1db9118d88
62154472bd2c43e1790dd1bd8a527c1db9118d88
bluetooth: Implement getAvailability() This change implements the getAvailability() method for navigator.bluetooth as defined in the specification. Bug: 707640 Change-Id: I9e9b3e7f8ea7f259e975f71cb6d9570e5f04b479 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1651516 Reviewed-by: Chris Harrelson <[email protected]> Reviewed-by: Giovanni Ortuño Urquidi <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <[email protected]> Auto-Submit: Ovidio de Jesús Ruiz-Henríquez <[email protected]> Cr-Commit-Position: refs/heads/master@{#688987}
FakeRemoteGattService* FakeCentral::GetFakeRemoteGattService( const std::string& peripheral_address, const std::string& service_id) const { FakePeripheral* fake_peripheral = GetFakePeripheral(peripheral_address); if (fake_peripheral == nullptr) { return nullptr; } return static_cast<FakeRemoteGattService*>( fake_peripheral->GetGattService(service_id)); }
FakeRemoteGattService* FakeCentral::GetFakeRemoteGattService( const std::string& peripheral_address, const std::string& service_id) const { FakePeripheral* fake_peripheral = GetFakePeripheral(peripheral_address); if (fake_peripheral == nullptr) { return nullptr; } return static_cast<FakeRemoteGattService*>( fake_peripheral->GetGattService(service_id)); }
C
Chrome
0
CVE-2018-18352
https://www.cvedetails.com/cve/CVE-2018-18352/
CWE-732
https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949
a9cbaa7a40e2b2723cfc2f266c42f4980038a949
Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whether the response body is available for scripts. They are known to be confusing, and actually MediaElementAudioSourceHandler::WouldTaintOrigin misuses them. This CL merges the three predicates to one, WouldTaintOrigin, to remove the confusion. Now the "response type" concept is available and we don't need a custom CORS check, so this CL removes BaseAudioContext::WouldTaintOrigin. This CL also renames URLData::has_opaque_data_ and its (direct and indirect) data accessors to match the spec. Bug: 849942, 875153 Change-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a Reviewed-on: https://chromium-review.googlesource.com/c/1238098 Reviewed-by: Fredrik Hubinette <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Reviewed-by: Raymond Toy <[email protected]> Commit-Queue: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/master@{#598258}
void HTMLMediaElement::SetSrc(const AtomicString& url) { setAttribute(srcAttr, url); }
void HTMLMediaElement::SetSrc(const AtomicString& url) { setAttribute(srcAttr, url); }
C
Chrome
0
CVE-2016-9317
https://www.cvedetails.com/cve/CVE-2016-9317/
CWE-20
https://github.com/libgd/libgd/commit/1846f48e5fcdde996e7c27a4bbac5d0aef183e4b
1846f48e5fcdde996e7c27a4bbac5d0aef183e4b
Fix #340: System frozen gdImageCreate() doesn't check for oversized images and as such is prone to DoS vulnerabilities. We fix that by applying the same overflow check that is already in place for gdImageCreateTrueColor(). CVE-2016-9317
HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2) { RGBType RGB1, RGB2; HWBType HWB1, HWB2; float diff; SETUP_RGB (RGB1, r1, g1, b1); SETUP_RGB (RGB2, r2, g2, b2); RGB_to_HWB (RGB1, &HWB1); RGB_to_HWB (RGB2, &HWB2); /* * I made this bit up; it seems to produce OK results, and it is certainly * more visually correct than the current RGB metric. (PJW) */ if ((HWB1.H == HWB_UNDEFINED) || (HWB2.H == HWB_UNDEFINED)) { diff = 0; /* Undefined hues always match... */ } else { diff = fabs (HWB1.H - HWB2.H); if (diff > 3) { diff = 6 - diff; /* Remember, it's a colour circle */ } } diff = diff * diff + (HWB1.W - HWB2.W) * (HWB1.W - HWB2.W) + (HWB1.B - HWB2.B) * (HWB1.B - HWB2.B); return diff; }
HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2) { RGBType RGB1, RGB2; HWBType HWB1, HWB2; float diff; SETUP_RGB (RGB1, r1, g1, b1); SETUP_RGB (RGB2, r2, g2, b2); RGB_to_HWB (RGB1, &HWB1); RGB_to_HWB (RGB2, &HWB2); /* * I made this bit up; it seems to produce OK results, and it is certainly * more visually correct than the current RGB metric. (PJW) */ if ((HWB1.H == HWB_UNDEFINED) || (HWB2.H == HWB_UNDEFINED)) { diff = 0; /* Undefined hues always match... */ } else { diff = fabs (HWB1.H - HWB2.H); if (diff > 3) { diff = 6 - diff; /* Remember, it's a colour circle */ } } diff = diff * diff + (HWB1.W - HWB2.W) * (HWB1.W - HWB2.W) + (HWB1.B - HWB2.B) * (HWB1.B - HWB2.B); return diff; }
C
libgd
0
CVE-2019-12980
https://www.cvedetails.com/cve/CVE-2019-12980/
CWE-190
https://github.com/libming/libming/pull/179/commits/2223f7a1e431455a1411bee77c90db94a6f8e8fe
2223f7a1e431455a1411bee77c90db94a6f8e8fe
Fix left shift of a negative value in SWFInput_readSBits. Check for number before before left-shifting by (number-1).
newSWFInput_input(SWFInput in, unsigned int length) { SWFInput input; struct SWFInputPtr *data; if (in == NULL) return NULL; input = (SWFInput)malloc(sizeof(struct SWFInput_s)); /* If malloc failed, return NULL to signify this */ if (NULL == input) return NULL; input->getChar = SWFInput_input_getChar; input->destroy = SWFInput_input_dtor; input->eof = SWFInput_input_eof; input->read = SWFInput_input_read; input->seek = SWFInput_input_seek; data = (struct SWFInputPtr *)malloc(sizeof(struct SWFInputPtr)); /* If malloc failed, free memory allocated for input and return NULL to signify the failure */ if (NULL == data) { free(input); return NULL; } data->offset = SWFInput_tell(in); data->input = in; input->offset = 0; input->length = length; input->data = (void *)data; input->buffer = 0; input->bufbits = 0; #if TRACK_ALLOCS input->gcnode = ming_gc_add_node(input, (dtorfunctype) destroySWFInput); #endif return input; }
newSWFInput_input(SWFInput in, unsigned int length) { SWFInput input; struct SWFInputPtr *data; if (in == NULL) return NULL; input = (SWFInput)malloc(sizeof(struct SWFInput_s)); /* If malloc failed, return NULL to signify this */ if (NULL == input) return NULL; input->getChar = SWFInput_input_getChar; input->destroy = SWFInput_input_dtor; input->eof = SWFInput_input_eof; input->read = SWFInput_input_read; input->seek = SWFInput_input_seek; data = (struct SWFInputPtr *)malloc(sizeof(struct SWFInputPtr)); /* If malloc failed, free memory allocated for input and return NULL to signify the failure */ if (NULL == data) { free(input); return NULL; } data->offset = SWFInput_tell(in); data->input = in; input->offset = 0; input->length = length; input->data = (void *)data; input->buffer = 0; input->bufbits = 0; #if TRACK_ALLOCS input->gcnode = ming_gc_add_node(input, (dtorfunctype) destroySWFInput); #endif return input; }
C
libming
0
CVE-2013-0292
https://www.cvedetails.com/cve/CVE-2013-0292/
CWE-20
https://cgit.freedesktop.org/dbus/dbus-glib/commit/?id=166978a09cf5edff4028e670b6074215a4c75eca
166978a09cf5edff4028e670b6074215a4c75eca
null
g_proxy_get_signal_match_rule (DBusGProxy *proxy) { DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy); /* FIXME Escaping is required here */ if (priv->name) return g_strdup_printf ("type='signal',sender='%s',path='%s',interface='%s'", priv->name, priv->path, priv->interface); else return g_strdup_printf ("type='signal',path='%s',interface='%s'", priv->path, priv->interface); }
g_proxy_get_signal_match_rule (DBusGProxy *proxy) { DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy); /* FIXME Escaping is required here */ if (priv->name) return g_strdup_printf ("type='signal',sender='%s',path='%s',interface='%s'", priv->name, priv->path, priv->interface); else return g_strdup_printf ("type='signal',path='%s',interface='%s'", priv->path, priv->interface); }
C
dbus
0
CVE-2018-6094
https://www.cvedetails.com/cve/CVE-2018-6094/
CWE-119
https://github.com/chromium/chromium/commit/0749ec24fae74ec32d0567eef0e5ec43c84dbcb9
0749ec24fae74ec32d0567eef0e5ec43c84dbcb9
Call HeapObjectHeader::checkHeader solely for its side-effect. This requires changing its signature. This is a preliminary stage to making it private. BUG=633030 Review-Url: https://codereview.chromium.org/2698673003 Cr-Commit-Position: refs/heads/master@{#460489}
FreeList::FreeList() : m_biggestFreeListIndex(0) {}
FreeList::FreeList() : m_biggestFreeListIndex(0) {}
C
Chrome
0
CVE-2019-1010298
https://www.cvedetails.com/cve/CVE-2019-1010298/
CWE-119
https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
TEE_Result syscall_asymm_operate(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; uint64_t dlen64; size_t dlen; struct tee_obj *o; void *label = NULL; size_t label_len = 0; size_t n; int salt_len; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) src_data, src_len); if (res != TEE_SUCCESS) return res; res = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64)); if (res != TEE_SUCCESS) return res; dlen = dlen64; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) dst_data, dlen); if (res != TEE_SUCCESS) return res; size_t alloc_size = 0; if (MUL_OVERFLOW(sizeof(TEE_Attribute), num_params, &alloc_size)) return TEE_ERROR_OVERFLOW; params = malloc(alloc_size); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_GENERIC; goto out; } switch (cs->algo) { case TEE_ALG_RSA_NOPAD: if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsanopad_encrypt(o->attr, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsanopad_decrypt(o->attr, src_data, src_len, dst_data, &dlen); } else { /* * We will panic because "the mode is not compatible * with the function" */ res = TEE_ERROR_GENERIC; } break; case TEE_ALG_RSAES_PKCS1_V1_5: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512: for (n = 0; n < num_params; n++) { if (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) { label = params[n].content.ref.buffer; label_len = params[n].content.ref.length; break; } } if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsaes_encrypt(cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsaes_decrypt( cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else { res = TEE_ERROR_BAD_PARAMETERS; } break; #if defined(CFG_CRYPTO_RSASSA_NA1) case TEE_ALG_RSASSA_PKCS1_V1_5: #endif case TEE_ALG_RSASSA_PKCS1_V1_5_MD5: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA1: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA224: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA256: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA384: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA512: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512: if (cs->mode != TEE_MODE_SIGN) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, src_len); res = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_DSA_SHA1: case TEE_ALG_DSA_SHA224: case TEE_ALG_DSA_SHA256: res = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_ECDSA_P192: case TEE_ALG_ECDSA_P224: case TEE_ALG_ECDSA_P256: case TEE_ALG_ECDSA_P384: case TEE_ALG_ECDSA_P521: res = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; default: res = TEE_ERROR_BAD_PARAMETERS; break; } out: free(params); if (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) { TEE_Result res2; dlen64 = dlen; res2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len)); if (res2 != TEE_SUCCESS) return res2; } return res; }
TEE_Result syscall_asymm_operate(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; uint64_t dlen64; size_t dlen; struct tee_obj *o; void *label = NULL; size_t label_len = 0; size_t n; int salt_len; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) src_data, src_len); if (res != TEE_SUCCESS) return res; res = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64)); if (res != TEE_SUCCESS) return res; dlen = dlen64; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) dst_data, dlen); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * num_params); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_GENERIC; goto out; } switch (cs->algo) { case TEE_ALG_RSA_NOPAD: if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsanopad_encrypt(o->attr, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsanopad_decrypt(o->attr, src_data, src_len, dst_data, &dlen); } else { /* * We will panic because "the mode is not compatible * with the function" */ res = TEE_ERROR_GENERIC; } break; case TEE_ALG_RSAES_PKCS1_V1_5: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512: for (n = 0; n < num_params; n++) { if (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) { label = params[n].content.ref.buffer; label_len = params[n].content.ref.length; break; } } if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsaes_encrypt(cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsaes_decrypt( cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else { res = TEE_ERROR_BAD_PARAMETERS; } break; #if defined(CFG_CRYPTO_RSASSA_NA1) case TEE_ALG_RSASSA_PKCS1_V1_5: #endif case TEE_ALG_RSASSA_PKCS1_V1_5_MD5: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA1: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA224: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA256: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA384: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA512: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512: if (cs->mode != TEE_MODE_SIGN) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, src_len); res = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_DSA_SHA1: case TEE_ALG_DSA_SHA224: case TEE_ALG_DSA_SHA256: res = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_ECDSA_P192: case TEE_ALG_ECDSA_P224: case TEE_ALG_ECDSA_P256: case TEE_ALG_ECDSA_P384: case TEE_ALG_ECDSA_P521: res = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; default: res = TEE_ERROR_BAD_PARAMETERS; break; } out: free(params); if (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) { TEE_Result res2; dlen64 = dlen; res2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len)); if (res2 != TEE_SUCCESS) return res2; } return res; }
C
optee_os
1
CVE-2018-6053
https://www.cvedetails.com/cve/CVE-2018-6053/
CWE-200
https://github.com/chromium/chromium/commit/6c6888565ff1fde9ef21ef17c27ad4c8304643d2
6c6888565ff1fde9ef21ef17c27ad4c8304643d2
TopSites: Clear thumbnails from the cache when their URLs get removed We already cleared the thumbnails from persistent storage, but they remained in the in-memory cache, so they remained accessible (until the next Chrome restart) even after all browsing data was cleared. Bug: 758169 Change-Id: Id916d22358430a82e6d5043ac04fa463a32f824f Reviewed-on: https://chromium-review.googlesource.com/758640 Commit-Queue: Marc Treib <[email protected]> Reviewed-by: Sylvain Defresne <[email protected]> Cr-Commit-Position: refs/heads/master@{#514861}
int TopSitesImpl::num_results_to_request_from_history() const { DCHECK(thread_checker_.CalledOnValidThread()); const base::DictionaryValue* blacklist = pref_service_->GetDictionary(kMostVisitedURLsBlacklist); return kNonForcedTopSitesNumber + (blacklist ? blacklist->size() : 0); }
int TopSitesImpl::num_results_to_request_from_history() const { DCHECK(thread_checker_.CalledOnValidThread()); const base::DictionaryValue* blacklist = pref_service_->GetDictionary(kMostVisitedURLsBlacklist); return kNonForcedTopSitesNumber + (blacklist ? blacklist->size() : 0); }
C
Chrome
0
CVE-2012-3552
https://www.cvedetails.com/cve/CVE-2012-3552/
CWE-362
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
f6d8bd051c391c1c0458a30b2a7abcd939329259
inet: add RCU protection to inet->opt We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb[], so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) { proc_net_remove(net, afinfo->name); }
void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) { proc_net_remove(net, afinfo->name); }
C
linux
0
CVE-2015-0291
https://www.cvedetails.com/cve/CVE-2015-0291/
null
https://git.openssl.org/?p=openssl.git;a=commit;h=76343947ada960b6269090638f5391068daee88d
76343947ada960b6269090638f5391068daee88d
null
const EVP_MD *tls12_get_hash(unsigned char hash_alg) { switch (hash_alg) { # ifndef OPENSSL_NO_MD5 case TLSEXT_hash_md5: # ifdef OPENSSL_FIPS if (FIPS_mode()) return NULL; # endif return EVP_md5(); # endif # ifndef OPENSSL_NO_SHA case TLSEXT_hash_sha1: return EVP_sha1(); # endif # ifndef OPENSSL_NO_SHA256 case TLSEXT_hash_sha224: return EVP_sha224(); case TLSEXT_hash_sha256: return EVP_sha256(); # endif # ifndef OPENSSL_NO_SHA512 case TLSEXT_hash_sha384: return EVP_sha384(); case TLSEXT_hash_sha512: return EVP_sha512(); # endif default: return NULL; } }
const EVP_MD *tls12_get_hash(unsigned char hash_alg) { switch (hash_alg) { # ifndef OPENSSL_NO_MD5 case TLSEXT_hash_md5: # ifdef OPENSSL_FIPS if (FIPS_mode()) return NULL; # endif return EVP_md5(); # endif # ifndef OPENSSL_NO_SHA case TLSEXT_hash_sha1: return EVP_sha1(); # endif # ifndef OPENSSL_NO_SHA256 case TLSEXT_hash_sha224: return EVP_sha224(); case TLSEXT_hash_sha256: return EVP_sha256(); # endif # ifndef OPENSSL_NO_SHA512 case TLSEXT_hash_sha384: return EVP_sha384(); case TLSEXT_hash_sha512: return EVP_sha512(); # endif default: return NULL; } }
C
openssl
0
CVE-2017-14954
https://www.cvedetails.com/cve/CVE-2017-14954/
CWE-200
https://github.com/torvalds/linux/commit/6c85501f2fabcfc4fc6ed976543d252c4eaf4be9
6c85501f2fabcfc4fc6ed976543d252c4eaf4be9
fix infoleak in waitid(2) kernel_waitid() can return a PID, an error or 0. rusage is filled in the first case and waitid(2) rusage should've been copied out exactly in that case, *not* whenever kernel_waitid() has not returned an error. Compat variant shares that braino; none of kernel_wait4() callers do, so the below ought to fix it. Reported-and-tested-by: Alexander Potapenko <[email protected]> Fixes: ce72a16fa705 ("wait4(2)/waitid(2): separate copying rusage to userland") Cc: [email protected] # v4.13 Signed-off-by: Al Viro <[email protected]>
kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) { struct pid *pgrp = task_pgrp(tsk); struct task_struct *ignored_task = tsk; if (!parent) /* exit: our father is in a different pgrp than * we are and we were the only connection outside. */ parent = tsk->real_parent; else /* reparent: our child is in a different pgrp than * we are, and it was the only connection outside. */ ignored_task = NULL; if (task_pgrp(parent) != pgrp && task_session(parent) == task_session(tsk) && will_become_orphaned_pgrp(pgrp, ignored_task) && has_stopped_jobs(pgrp)) { __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); } }
kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) { struct pid *pgrp = task_pgrp(tsk); struct task_struct *ignored_task = tsk; if (!parent) /* exit: our father is in a different pgrp than * we are and we were the only connection outside. */ parent = tsk->real_parent; else /* reparent: our child is in a different pgrp than * we are, and it was the only connection outside. */ ignored_task = NULL; if (task_pgrp(parent) != pgrp && task_session(parent) == task_session(tsk) && will_become_orphaned_pgrp(pgrp, ignored_task) && has_stopped_jobs(pgrp)) { __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); } }
C
linux
0
CVE-2017-15391
https://www.cvedetails.com/cve/CVE-2017-15391/
null
https://github.com/chromium/chromium/commit/f1afce25b3f94d8bddec69b08ffbc29b989ad844
f1afce25b3f94d8bddec69b08ffbc29b989ad844
[Extensions] Update navigations across hypothetical extension extents Update code to treat navigations across hypothetical extension extents (e.g. for nonexistent extensions) the same as we do for navigations crossing installed extension extents. Bug: 598265 Change-Id: Ibdf2f563ce1fd108ead279077901020a24de732b Reviewed-on: https://chromium-review.googlesource.com/617180 Commit-Queue: Devlin <[email protected]> Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Cr-Commit-Position: refs/heads/master@{#495779}
const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const base::FilePath& path, int expected_change) { return InstallOrUpdateExtension( std::string(), path, INSTALL_UI_TYPE_AUTO_CONFIRM, expected_change, Manifest::INTERNAL, browser(), Extension::FROM_WEBSTORE, true, false); }
const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const base::FilePath& path, int expected_change) { return InstallOrUpdateExtension( std::string(), path, INSTALL_UI_TYPE_AUTO_CONFIRM, expected_change, Manifest::INTERNAL, browser(), Extension::FROM_WEBSTORE, true, false); }
C
Chrome
0
CVE-2011-3897
https://www.cvedetails.com/cve/CVE-2011-3897/
CWE-399
https://github.com/chromium/chromium/commit/c7a90019bf7054145b11d2577b851cf2779d3d79
c7a90019bf7054145b11d2577b851cf2779d3d79
Fix print preview workflow to reflect settings of selected printer. BUG=95110 TEST=none Review URL: http://codereview.chromium.org/7831041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102242 0039d316-1c4b-4281-b951-d872f2087c98
printing::PrintDialogGtkInterface* PrintDialogGtk::CreatePrintDialog( PrintingContextCairo* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return new PrintDialogGtk(context); }
printing::PrintDialogGtkInterface* PrintDialogGtk::CreatePrintDialog( PrintingContextCairo* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return new PrintDialogGtk(context); }
C
Chrome
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
bool BrowserTabStripController::IsIncognito() { return browser_->profile()->IsOffTheRecord(); }
bool BrowserTabStripController::IsIncognito() { return browser_->profile()->IsOffTheRecord(); }
C
Chrome
0
CVE-2009-3607
https://www.cvedetails.com/cve/CVE-2009-3607/
CWE-189
https://cgit.freedesktop.org/poppler/poppler/commit/?id=c839b706
c839b706092583f6b12ed3cc634bf5af34b7a2bb
null
poppler_page_get_transition (PopplerPage *page) { PageTransition *trans; PopplerPageTransition *transition; Object obj; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); trans = new PageTransition (page->page->getTrans (&obj)); obj.free (); if (!trans->isOk ()) { delete trans; return NULL; } transition = poppler_page_transition_new (); switch (trans->getType ()) { case transitionReplace: transition->type = POPPLER_PAGE_TRANSITION_REPLACE; break; case transitionSplit: transition->type = POPPLER_PAGE_TRANSITION_SPLIT; break; case transitionBlinds: transition->type = POPPLER_PAGE_TRANSITION_BLINDS; break; case transitionBox: transition->type = POPPLER_PAGE_TRANSITION_BOX; break; case transitionWipe: transition->type = POPPLER_PAGE_TRANSITION_WIPE; break; case transitionDissolve: transition->type = POPPLER_PAGE_TRANSITION_DISSOLVE; break; case transitionGlitter: transition->type = POPPLER_PAGE_TRANSITION_GLITTER; break; case transitionFly: transition->type = POPPLER_PAGE_TRANSITION_FLY; break; case transitionPush: transition->type = POPPLER_PAGE_TRANSITION_PUSH; break; case transitionCover: transition->type = POPPLER_PAGE_TRANSITION_COVER; break; case transitionUncover: transition->type = POPPLER_PAGE_TRANSITION_UNCOVER; break; case transitionFade: transition->type = POPPLER_PAGE_TRANSITION_FADE; break; default: g_assert_not_reached (); } transition->alignment = (trans->getAlignment() == transitionHorizontal) ? POPPLER_PAGE_TRANSITION_HORIZONTAL : POPPLER_PAGE_TRANSITION_VERTICAL; transition->direction = (trans->getDirection() == transitionInward) ? POPPLER_PAGE_TRANSITION_INWARD : POPPLER_PAGE_TRANSITION_OUTWARD; transition->duration = trans->getDuration(); transition->angle = trans->getAngle(); transition->scale = trans->getScale(); transition->rectangular = trans->isRectangular(); delete trans; return transition; }
poppler_page_get_transition (PopplerPage *page) { PageTransition *trans; PopplerPageTransition *transition; Object obj; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); trans = new PageTransition (page->page->getTrans (&obj)); obj.free (); if (!trans->isOk ()) { delete trans; return NULL; } transition = poppler_page_transition_new (); switch (trans->getType ()) { case transitionReplace: transition->type = POPPLER_PAGE_TRANSITION_REPLACE; break; case transitionSplit: transition->type = POPPLER_PAGE_TRANSITION_SPLIT; break; case transitionBlinds: transition->type = POPPLER_PAGE_TRANSITION_BLINDS; break; case transitionBox: transition->type = POPPLER_PAGE_TRANSITION_BOX; break; case transitionWipe: transition->type = POPPLER_PAGE_TRANSITION_WIPE; break; case transitionDissolve: transition->type = POPPLER_PAGE_TRANSITION_DISSOLVE; break; case transitionGlitter: transition->type = POPPLER_PAGE_TRANSITION_GLITTER; break; case transitionFly: transition->type = POPPLER_PAGE_TRANSITION_FLY; break; case transitionPush: transition->type = POPPLER_PAGE_TRANSITION_PUSH; break; case transitionCover: transition->type = POPPLER_PAGE_TRANSITION_COVER; break; case transitionUncover: transition->type = POPPLER_PAGE_TRANSITION_UNCOVER; break; case transitionFade: transition->type = POPPLER_PAGE_TRANSITION_FADE; break; default: g_assert_not_reached (); } transition->alignment = (trans->getAlignment() == transitionHorizontal) ? POPPLER_PAGE_TRANSITION_HORIZONTAL : POPPLER_PAGE_TRANSITION_VERTICAL; transition->direction = (trans->getDirection() == transitionInward) ? POPPLER_PAGE_TRANSITION_INWARD : POPPLER_PAGE_TRANSITION_OUTWARD; transition->duration = trans->getDuration(); transition->angle = trans->getAngle(); transition->scale = trans->getScale(); transition->rectangular = trans->isRectangular(); delete trans; return transition; }
CPP
poppler
0
CVE-2011-2347
https://www.cvedetails.com/cve/CVE-2011-2347/
CWE-119
https://github.com/chromium/chromium/commit/60cc89e8d2e761dea28bb9e4cf9ebbad516bff09
60cc89e8d2e761dea28bb9e4cf9ebbad516bff09
iwyu: Include callback_old.h where appropriate, final. BUG=82098 TEST=none Review URL: http://codereview.chromium.org/7003003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85003 0039d316-1c4b-4281-b951-d872f2087c98
void TestCropFront(int pos, int size) { CompoundBuffer cropped; cropped.CopyFrom(target_, 0, target_.total_bytes()); cropped.CropFront(pos); EXPECT_TRUE(CompareData(cropped, data_->data() + pos, target_.total_bytes() - pos)); }
void TestCropFront(int pos, int size) { CompoundBuffer cropped; cropped.CopyFrom(target_, 0, target_.total_bytes()); cropped.CropFront(pos); EXPECT_TRUE(CompareData(cropped, data_->data() + pos, target_.total_bytes() - pos)); }
C
Chrome
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
HTMLDataListElement* HTMLInputElement::DataList() const { if (!has_non_empty_list_) return nullptr; if (!input_type_->ShouldRespectListAttribute()) return nullptr; return ToHTMLDataListElementOrNull( GetTreeScope().getElementById(FastGetAttribute(listAttr))); }
HTMLDataListElement* HTMLInputElement::DataList() const { if (!has_non_empty_list_) return nullptr; if (!input_type_->ShouldRespectListAttribute()) return nullptr; return ToHTMLDataListElementOrNull( GetTreeScope().getElementById(FastGetAttribute(listAttr))); }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
error::Error GLES2DecoderPassthroughImpl::DoFramebufferTextureMultiviewOVR( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint base_view_index, GLsizei num_views) { if (IsEmulatedFramebufferBound(target)) { InsertError(GL_INVALID_OPERATION, "Cannot change the attachments of the default framebuffer."); return error::kNoError; } api()->glFramebufferTextureMultiviewOVRFn( target, attachment, GetTextureServiceID(api(), texture, resources_, false), level, base_view_index, num_views); return error::kNoError; }
error::Error GLES2DecoderPassthroughImpl::DoFramebufferTextureMultiviewOVR( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint base_view_index, GLsizei num_views) { if (IsEmulatedFramebufferBound(target)) { InsertError(GL_INVALID_OPERATION, "Cannot change the attachments of the default framebuffer."); return error::kNoError; } api()->glFramebufferTextureMultiviewOVRFn( target, attachment, GetTextureServiceID(api(), texture, resources_, false), level, base_view_index, num_views); return error::kNoError; }
C
Chrome
0
CVE-2019-10664
https://www.cvedetails.com/cve/CVE-2019-10664/
CWE-89
https://github.com/domoticz/domoticz/commit/ee70db46f81afa582c96b887b73bcd2a86feda00
ee70db46f81afa582c96b887b73bcd2a86feda00
Fixed possible SQL Injection Vulnerability (Thanks to Fabio Carretto!)
void CWebServer::RType_Notifications(WebEmSession & session, const request& req, Json::Value &root) { root["status"] = "OK"; root["title"] = "Notifications"; int ii = 0; for (const auto & ittNotifiers : m_notifications.m_notifiers) { root["notifiers"][ii]["name"] = ittNotifiers.first; root["notifiers"][ii]["description"] = ittNotifiers.first; ii++; } uint64_t idx = 0; if (request::findValue(&req, "idx") != "") { idx = std::strtoull(request::findValue(&req, "idx").c_str(), nullptr, 10); } std::vector<_tNotification> notifications = m_notifications.GetNotifications(idx); if (notifications.size() > 0) { ii = 0; for (const auto & itt : notifications) { root["result"][ii]["idx"] = itt.ID; std::string sParams = itt.Params; if (sParams.empty()) { sParams = "S"; } root["result"][ii]["Params"] = sParams; root["result"][ii]["Priority"] = itt.Priority; root["result"][ii]["SendAlways"] = itt.SendAlways; root["result"][ii]["CustomMessage"] = itt.CustomMessage; root["result"][ii]["ActiveSystems"] = itt.ActiveSystems; ii++; } } }
void CWebServer::RType_Notifications(WebEmSession & session, const request& req, Json::Value &root) { root["status"] = "OK"; root["title"] = "Notifications"; int ii = 0; for (const auto & ittNotifiers : m_notifications.m_notifiers) { root["notifiers"][ii]["name"] = ittNotifiers.first; root["notifiers"][ii]["description"] = ittNotifiers.first; ii++; } uint64_t idx = 0; if (request::findValue(&req, "idx") != "") { idx = std::strtoull(request::findValue(&req, "idx").c_str(), nullptr, 10); } std::vector<_tNotification> notifications = m_notifications.GetNotifications(idx); if (notifications.size() > 0) { ii = 0; for (const auto & itt : notifications) { root["result"][ii]["idx"] = itt.ID; std::string sParams = itt.Params; if (sParams.empty()) { sParams = "S"; } root["result"][ii]["Params"] = sParams; root["result"][ii]["Priority"] = itt.Priority; root["result"][ii]["SendAlways"] = itt.SendAlways; root["result"][ii]["CustomMessage"] = itt.CustomMessage; root["result"][ii]["ActiveSystems"] = itt.ActiveSystems; ii++; } } }
C
domoticz
0
CVE-2017-5077
https://www.cvedetails.com/cve/CVE-2017-5077/
CWE-125
https://github.com/chromium/chromium/commit/fec26ff33bf372476a70326f3669a35f34a9d474
fec26ff33bf372476a70326f3669a35f34a9d474
Origins should be represented as url::Origin (not as GURL). As pointed out in //docs/security/origin-vs-url.md, origins should be represented as url::Origin (not as GURL). This CL applies this guideline to predictor-related code and changes the type of the following fields from GURL to url::Origin: - OriginRequestSummary::origin - PreconnectedRequestStats::origin - PreconnectRequest::origin The old code did not depend on any non-origin parts of GURL (like path and/or query). Therefore, this CL has no intended behavior change. Bug: 973885 Change-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: Alex Ilin <[email protected]> Cr-Commit-Position: refs/heads/master@{#716311}
float ComputeRedirectConfidence(const predictors::RedirectStat& redirect) { return (redirect.number_of_hits() + 0.0) / (redirect.number_of_hits() + redirect.number_of_misses()); }
float ComputeRedirectConfidence(const predictors::RedirectStat& redirect) { return (redirect.number_of_hits() + 0.0) / (redirect.number_of_hits() + redirect.number_of_misses()); }
C
Chrome
0
CVE-2017-9985
https://www.cvedetails.com/cve/CVE-2017-9985/
CWE-125
https://github.com/torvalds/linux/commit/20e2b791796bd68816fa115f12be5320de2b8021
20e2b791796bd68816fa115f12be5320de2b8021
ALSA: msnd: Optimize / harden DSP and MIDI loops The ISA msnd drivers have loops fetching the ring-buffer head, tail and size values inside the loops. Such codes are inefficient and fragile. This patch optimizes it, and also adds the sanity check to avoid the endless loops. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196131 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196133 Signed-off-by: Takashi Iwai <[email protected]>
static int snd_msnd_write_cfg_io1(int cfg, int num, u16 io) { if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io))) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io))) return -EIO; return 0; }
static int snd_msnd_write_cfg_io1(int cfg, int num, u16 io) { if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io))) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io))) return -EIO; return 0; }
C
linux
0
CVE-2014-3645
https://www.cvedetails.com/cve/CVE-2014-3645/
CWE-20
https://github.com/torvalds/linux/commit/bfd0a56b90005f8c8a004baf407ad90045c2b11e
bfd0a56b90005f8c8a004baf407ad90045c2b11e
nEPT: Nested INVEPT If we let L1 use EPT, we should probably also support the INVEPT instruction. In our current nested EPT implementation, when L1 changes its EPT table for L2 (i.e., EPT12), L0 modifies the shadow EPT table (EPT02), and in the course of this modification already calls INVEPT. But if last level of shadow page is unsync not all L1's changes to EPT12 are intercepted, which means roots need to be synced when L1 calls INVEPT. Global INVEPT should not be different since roots are synced by kvm_mmu_load() each time EPTP02 changes. Reviewed-by: Xiao Guangrong <[email protected]> Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Jun Nakajima <[email protected]> Signed-off-by: Xinhao Xu <[email protected]> Signed-off-by: Yang Zhang <[email protected]> Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static int nonpaging_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code, bool prefault) { gfn_t gfn; int r; pgprintk("%s: gva %lx error %x\n", __func__, gva, error_code); if (unlikely(error_code & PFERR_RSVD_MASK)) { r = handle_mmio_page_fault(vcpu, gva, error_code, true); if (likely(r != RET_MMIO_PF_INVALID)) return r; } r = mmu_topup_memory_caches(vcpu); if (r) return r; ASSERT(vcpu); ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa)); gfn = gva >> PAGE_SHIFT; return nonpaging_map(vcpu, gva & PAGE_MASK, error_code, gfn, prefault); }
static int nonpaging_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code, bool prefault) { gfn_t gfn; int r; pgprintk("%s: gva %lx error %x\n", __func__, gva, error_code); if (unlikely(error_code & PFERR_RSVD_MASK)) { r = handle_mmio_page_fault(vcpu, gva, error_code, true); if (likely(r != RET_MMIO_PF_INVALID)) return r; } r = mmu_topup_memory_caches(vcpu); if (r) return r; ASSERT(vcpu); ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa)); gfn = gva >> PAGE_SHIFT; return nonpaging_map(vcpu, gva & PAGE_MASK, error_code, gfn, prefault); }
C
linux
0
CVE-2018-17206
https://www.cvedetails.com/cve/CVE-2018-17206/
null
https://github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8
9237a63c47bd314b807cda0bd2216264e82edbe8
ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <[email protected]> Acked-by: Justin Pettit <[email protected]>
put_u32(struct ofpbuf *b, uint32_t x) { put_be32(b, htonl(x)); }
put_u32(struct ofpbuf *b, uint32_t x) { put_be32(b, htonl(x)); }
C
ovs
0
CVE-2015-8896
https://www.cvedetails.com/cve/CVE-2015-8896/
CWE-189
https://github.com/ImageMagick/ImageMagick/commit/0f6fc2d5bf8f500820c3dbcf0d23ee14f2d9f734
0f6fc2d5bf8f500820c3dbcf0d23ee14f2d9f734
null
MagickExport const char *GetMagickLicense(void) { return(MagickAuthoritativeLicense); }
MagickExport const char *GetMagickLicense(void) { return(MagickAuthoritativeLicense); }
C
ImageMagick
0
CVE-2018-6140
https://www.cvedetails.com/cve/CVE-2018-6140/
CWE-20
https://github.com/chromium/chromium/commit/2aec794f26098c7a361c27d7c8f57119631cca8a
2aec794f26098c7a361c27d7c8f57119631cca8a
[DevTools] Do not allow chrome.debugger to attach to web ui pages If the page navigates to web ui, we force detach the debugger extension. [email protected] Bug: 798222 Change-Id: Idb46c2f59e839388397a8dfa6ce2e2a897698df3 Reviewed-on: https://chromium-review.googlesource.com/935961 Commit-Queue: Dmitry Gozman <[email protected]> Reviewed-by: Devlin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Cr-Commit-Position: refs/heads/master@{#540916}
DevToolsAgentHost* agent_host() { return agent_host_.get(); }
DevToolsAgentHost* agent_host() { return agent_host_.get(); }
C
Chrome
0
CVE-2012-2875
https://www.cvedetails.com/cve/CVE-2012-2875/
null
https://github.com/chromium/chromium/commit/40ed2b7ae4f6f5adb1b0ce9acf9c4dece339c2a6
40ed2b7ae4f6f5adb1b0ce9acf9c4dece339c2a6
gdata: Define the resource ID for the root directory Per the spec, the resource ID for the root directory is defined as "folder:root". Add the resource ID to the root directory in our file system representation so we can look up the root directory by the resource ID. BUG=127697 TEST=add unit tests Review URL: https://chromiumcodereview.appspot.com/10332253 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137928 0039d316-1c4b-4281-b951-d872f2087c98
void GDataRootDirectory::AddEntryToResourceMap(GDataEntry* entry) { DVLOG(1) << "AddEntryToResourceMap " << entry->resource_id(); resource_map_.insert(std::make_pair(entry->resource_id(), entry)); }
void GDataRootDirectory::AddEntryToResourceMap(GDataEntry* entry) { DVLOG(1) << "AddEntryToResourceMap " << entry->resource_id(); resource_map_.insert(std::make_pair(entry->resource_id(), entry)); }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
void GLES2Implementation::GetActiveUniformBlockiv(GLuint program, GLuint index, GLenum pname, GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockiv(" << program << ", " << index << ", " << GLES2Util::GetStringUniformBlockParameter(pname) << ", " << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockiv"); bool success = share_group_->program_info_manager()->GetActiveUniformBlockiv( this, program, index, pname, params); if (success) { if (params) { GPU_CLIENT_LOG(" params: " << params[0]); } } CheckGLError(); }
void GLES2Implementation::GetActiveUniformBlockiv(GLuint program, GLuint index, GLenum pname, GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockiv(" << program << ", " << index << ", " << GLES2Util::GetStringUniformBlockParameter(pname) << ", " << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockiv"); bool success = share_group_->program_info_manager()->GetActiveUniformBlockiv( this, program, index, pname, params); if (success) { if (params) { GPU_CLIENT_LOG(" params: " << params[0]); } } CheckGLError(); }
C
Chrome
0
CVE-2015-9059
https://www.cvedetails.com/cve/CVE-2015-9059/
CWE-77
https://github.com/npat-efault/picocom/commit/1ebc60b20fbe9a02436d5cbbf8951714e749ddb1
1ebc60b20fbe9a02436d5cbbf8951714e749ddb1
Do not use "/bin/sh" to run external commands. Picocom no longer uses /bin/sh to run external commands for file-transfer operations. Parsing the command line and spliting it into arguments is now performed internally by picocom, using quoting rules very similar to those of the Unix shell. Hopefully, this makes it impossible to inject shell-commands when supplying filenames or extra arguments to the send- and receive-file commands.
read_filename (void) { char fname[_POSIX_PATH_MAX]; int r; fd_printf(STO, "\r\n*** file: "); r = fd_readline(STI, STO, fname, sizeof(fname)); fd_printf(STO, "\r\n"); if ( r < 0 ) return NULL; else return strdup(fname); }
read_filename (void) { char fname[_POSIX_PATH_MAX]; int r; fd_printf(STO, "\r\n*** file: "); r = fd_readline(STI, STO, fname, sizeof(fname)); fd_printf(STO, "\r\n"); if ( r < 0 ) return NULL; else return strdup(fname); }
C
picocom
0
null
null
null
https://github.com/chromium/chromium/commit/283fb25624bf253d120708152e23cf9143519198
283fb25624bf253d120708152e23cf9143519198
Coverity; Fixing pass by value bugs. CID=101466, 101464, 101494, 101495, 101496, 101497 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/8956046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115399 0039d316-1c4b-4281-b951-d872f2087c98
bool ExtensionInstallUI::Prompt::HasAbortButtonLabel() const { return kAbortButtonIds[type_] > 0; }
bool ExtensionInstallUI::Prompt::HasAbortButtonLabel() const { return kAbortButtonIds[type_] > 0; }
C
Chrome
0
CVE-2011-2881
https://www.cvedetails.com/cve/CVE-2011-2881/
CWE-119
https://github.com/chromium/chromium/commit/88c4913f11967abfd08a8b22b4423710322ac49b
88c4913f11967abfd08a8b22b4423710322ac49b
[chromium] Fix shutdown race when posting main thread task to CCThreadProxy and enable tests https://bugs.webkit.org/show_bug.cgi?id=70161 Reviewed by David Levin. Source/WebCore: Adds a weak pointer mechanism to cancel main thread tasks posted to CCThreadProxy instances from the compositor thread. Previously there was a race condition where main thread tasks could run even after the CCThreadProxy was destroyed. This race does not exist in the other direction because when tearing down a CCThreadProxy we first post a quit task to the compositor thread and then suspend execution of the main thread until all compositor tasks for the CCThreadProxy have been drained. Covered by the now-enabled CCLayerTreeHostTest* unit tests. * WebCore.gypi: * platform/graphics/chromium/cc/CCScopedMainThreadProxy.h: Added. (WebCore::CCScopedMainThreadProxy::create): (WebCore::CCScopedMainThreadProxy::postTask): (WebCore::CCScopedMainThreadProxy::shutdown): (WebCore::CCScopedMainThreadProxy::CCScopedMainThreadProxy): (WebCore::CCScopedMainThreadProxy::runTaskIfNotShutdown): * platform/graphics/chromium/cc/CCThreadProxy.cpp: (WebCore::CCThreadProxy::CCThreadProxy): (WebCore::CCThreadProxy::~CCThreadProxy): (WebCore::CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread): * platform/graphics/chromium/cc/CCThreadProxy.h: Source/WebKit/chromium: Enables the CCLayerTreeHostTest* tests by default. Most tests are run twice in a single thread and multiple thread configuration. Some tests run only in the multiple thread configuration if they depend on the compositor thread scheduling draws by itself. * tests/CCLayerTreeHostTest.cpp: (::CCLayerTreeHostTest::timeout): (::CCLayerTreeHostTest::clearTimeout): (::CCLayerTreeHostTest::CCLayerTreeHostTest): (::CCLayerTreeHostTest::onEndTest): (::CCLayerTreeHostTest::TimeoutTask::TimeoutTask): (::CCLayerTreeHostTest::TimeoutTask::clearTest): (::CCLayerTreeHostTest::TimeoutTask::~TimeoutTask): (::CCLayerTreeHostTest::TimeoutTask::Run): (::CCLayerTreeHostTest::runTest): (::CCLayerTreeHostTest::doBeginTest): (::CCLayerTreeHostTestThreadOnly::runTest): (::CCLayerTreeHostTestSetNeedsRedraw::commitCompleteOnCCThread): git-svn-id: svn://svn.chromium.org/blink/trunk@97784 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void CCLayerTreeHostTest::endTest() { if (!isMainThread()) m_mainThreadProxy->postTask(createMainThreadTask(this, &CCLayerTreeHostTest::endTest)); else { if (m_beginning) m_endWhenBeginReturns = true; else onEndTest(static_cast<void*>(this)); } }
void CCLayerTreeHostTest::endTest() { if (!isMainThread()) CCMainThread::postTask(createMainThreadTask(this, &CCLayerTreeHostTest::endTest)); else { if (m_beginning) m_endWhenBeginReturns = true; else onEndTest(static_cast<void*>(this)); } }
C
Chrome
1
CVE-2016-2496
https://www.cvedetails.com/cve/CVE-2016-2496/
CWE-264
https://android.googlesource.com/platform/frameworks/native/+/03a53d1c7765eeb3af0bc34c3dff02ada1953fbf
03a53d1c7765eeb3af0bc34c3dff02ada1953fbf
Add new MotionEvent flag for partially obscured windows. Due to more complex window layouts resulting in lots of overlapping windows, the policy around FLAG_WINDOW_IS_OBSCURED has changed to only be set when the point at which the window was touched is obscured. Unfortunately, this doesn't prevent tapjacking attacks that overlay the dialog's text, making a potentially dangerous operation seem innocuous. To avoid this on particularly sensitive dialogs, introduce a new flag that really does tell you when your window is being even partially overlapped. We aren't exposing this as API since we plan on making the original flag more robust. This is really a workaround for system dialogs since we generally know their layout and screen position, and that they're unlikely to be overlapped by other applications. Bug: 26677796 Change-Id: I9e336afe90f262ba22015876769a9c510048fd47
bool InputDispatcher::isWindowObscuredAtPointLocked( const sp<InputWindowHandle>& windowHandle, int32_t x, int32_t y) const { int32_t displayId = windowHandle->getInfo()->displayId; size_t numWindows = mWindowHandles.size(); for (size_t i = 0; i < numWindows; i++) { sp<InputWindowHandle> otherHandle = mWindowHandles.itemAt(i); if (otherHandle == windowHandle) { break; } const InputWindowInfo* otherInfo = otherHandle->getInfo(); if (otherInfo->displayId == displayId && otherInfo->visible && !otherInfo->isTrustedOverlay() && otherInfo->frameContainsPoint(x, y)) { return true; } } return false; }
bool InputDispatcher::isWindowObscuredAtPointLocked( const sp<InputWindowHandle>& windowHandle, int32_t x, int32_t y) const { int32_t displayId = windowHandle->getInfo()->displayId; size_t numWindows = mWindowHandles.size(); for (size_t i = 0; i < numWindows; i++) { sp<InputWindowHandle> otherHandle = mWindowHandles.itemAt(i); if (otherHandle == windowHandle) { break; } const InputWindowInfo* otherInfo = otherHandle->getInfo(); if (otherInfo->displayId == displayId && otherInfo->visible && !otherInfo->isTrustedOverlay() && otherInfo->frameContainsPoint(x, y)) { return true; } } return false; }
C
Android
0
CVE-2013-0921
https://www.cvedetails.com/cve/CVE-2013-0921/
CWE-264
https://github.com/chromium/chromium/commit/e9841fbdaf41b4a2baaa413f94d5c0197f9261f4
e9841fbdaf41b4a2baaa413f94d5c0197f9261f4
Ensure extensions and the Chrome Web Store are loaded in new BrowsingInstances. BUG=174943 TEST=Can't post message to CWS. See bug for repro steps. Review URL: https://chromiumcodereview.appspot.com/12301013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184208 0039d316-1c4b-4281-b951-d872f2087c98
std::string ChromeContentBrowserClient::GetDefaultDownloadName() { return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME); }
std::string ChromeContentBrowserClient::GetDefaultDownloadName() { return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME); }
C
Chrome
0
CVE-2016-1621
https://www.cvedetails.com/cve/CVE-2016-1621/
CWE-119
https://android.googlesource.com/platform/external/libvpx/+/04839626ed859623901ebd3a5fd483982186b59d
04839626ed859623901ebd3a5fd483982186b59d
libwebm: Pull from upstream Rolling mkvparser from upstream. Primarily for fixing a bug on parsing failures with certain Opus WebM files. Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae The diff is so huge because there were some style clean ups upstream. But it was ensured that there were no breaking changes when the style clean ups was done upstream. Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
Segment::Segment(
Segment::Segment( IMkvReader* pReader, long long elem_start, long long start, long long size) : m_pReader(pReader), m_element_start(elem_start), m_start(start), m_size(size), m_pos(start), m_pUnknownSize(0), m_pSeekHead(NULL), m_pInfo(NULL), m_pTracks(NULL), m_pCues(NULL), m_pChapters(NULL), m_clusters(NULL), m_clusterCount(0), m_clusterPreloadCount(0), m_clusterSize(0) { }
C
Android
1
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int sha1_export(struct shash_desc *desc, void *out) { struct sha1_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; }
static int sha1_export(struct shash_desc *desc, void *out) { struct sha1_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; }
C
linux
0
CVE-2014-1700
https://www.cvedetails.com/cve/CVE-2014-1700/
CWE-399
https://github.com/chromium/chromium/commit/d926098e2e2be270c80a5ba25ab8a611b80b8556
d926098e2e2be270c80a5ba25ab8a611b80b8556
Connect WebUSB client interface to the devices app This provides a basic WebUSB client interface in content/renderer. Most of the interface is unimplemented, but this CL hooks up navigator.usb.getDevices() to the browser's Mojo devices app to enumerate available USB devices. BUG=492204 Review URL: https://codereview.chromium.org/1293253002 Cr-Commit-Position: refs/heads/master@{#344881}
blink::WebPushClient* RenderFrameImpl::pushClient() { if (!push_messaging_dispatcher_) push_messaging_dispatcher_ = new PushMessagingDispatcher(this); return push_messaging_dispatcher_; }
blink::WebPushClient* RenderFrameImpl::pushClient() { if (!push_messaging_dispatcher_) push_messaging_dispatcher_ = new PushMessagingDispatcher(this); return push_messaging_dispatcher_; }
C
Chrome
0
CVE-2018-1000040
https://www.cvedetails.com/cve/CVE-2018-1000040/
CWE-20
http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=83d4dae44c71816c084a635550acc1a51529b881;hp=f597300439e62f5e921f0d7b1e880b5c1a1f1607
83d4dae44c71816c084a635550acc1a51529b881
null
static void gray_to_rgb(fz_context *ctx, const fz_colorspace *cs, const float *gray, float *rgb) { rgb[0] = gray[0]; rgb[1] = gray[0]; rgb[2] = gray[0]; }
static void gray_to_rgb(fz_context *ctx, const fz_colorspace *cs, const float *gray, float *rgb) { rgb[0] = gray[0]; rgb[1] = gray[0]; rgb[2] = gray[0]; }
C
ghostscript
0
CVE-2017-18203
https://www.cvedetails.com/cve/CVE-2017-18203/
CWE-362
https://github.com/torvalds/linux/commit/b9a41d21dceadf8104812626ef85dc56ee8a60ed
b9a41d21dceadf8104812626ef85dc56ee8a60ed
dm: fix race between dm_get_from_kobject() and __dm_destroy() The following BUG_ON was hit when testing repeat creation and removal of DM devices: kernel BUG at drivers/md/dm.c:2919! CPU: 7 PID: 750 Comm: systemd-udevd Not tainted 4.1.44 Call Trace: [<ffffffff81649e8b>] dm_get_from_kobject+0x34/0x3a [<ffffffff81650ef1>] dm_attr_show+0x2b/0x5e [<ffffffff817b46d1>] ? mutex_lock+0x26/0x44 [<ffffffff811df7f5>] sysfs_kf_seq_show+0x83/0xcf [<ffffffff811de257>] kernfs_seq_show+0x23/0x25 [<ffffffff81199118>] seq_read+0x16f/0x325 [<ffffffff811de994>] kernfs_fop_read+0x3a/0x13f [<ffffffff8117b625>] __vfs_read+0x26/0x9d [<ffffffff8130eb59>] ? security_file_permission+0x3c/0x44 [<ffffffff8117bdb8>] ? rw_verify_area+0x83/0xd9 [<ffffffff8117be9d>] vfs_read+0x8f/0xcf [<ffffffff81193e34>] ? __fdget_pos+0x12/0x41 [<ffffffff8117c686>] SyS_read+0x4b/0x76 [<ffffffff817b606e>] system_call_fastpath+0x12/0x71 The bug can be easily triggered, if an extra delay (e.g. 10ms) is added between the test of DMF_FREEING & DMF_DELETING and dm_get() in dm_get_from_kobject(). To fix it, we need to ensure the test of DMF_FREEING & DMF_DELETING and dm_get() are done in an atomic way, so _minor_lock is used. The other callers of dm_get() have also been checked to be OK: some callers invoke dm_get() under _minor_lock, some callers invoke it under _hash_lock, and dm_start_request() invoke it after increasing md->open_count. Cc: [email protected] Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
static void dm_blk_close(struct gendisk *disk, fmode_t mode) { struct mapped_device *md; spin_lock(&_minor_lock); md = disk->private_data; if (WARN_ON(!md)) goto out; if (atomic_dec_and_test(&md->open_count) && (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) queue_work(deferred_remove_workqueue, &deferred_remove_work); dm_put(md); out: spin_unlock(&_minor_lock); }
static void dm_blk_close(struct gendisk *disk, fmode_t mode) { struct mapped_device *md; spin_lock(&_minor_lock); md = disk->private_data; if (WARN_ON(!md)) goto out; if (atomic_dec_and_test(&md->open_count) && (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) queue_work(deferred_remove_workqueue, &deferred_remove_work); dm_put(md); out: spin_unlock(&_minor_lock); }
C
linux
0
CVE-2015-1265
https://www.cvedetails.com/cve/CVE-2015-1265/
null
https://github.com/chromium/chromium/commit/8ea5693d5cf304e56174bb6b65412f04209904db
8ea5693d5cf304e56174bb6b65412f04209904db
Move Editor::Transpose() out of Editor class This patch moves |Editor::Transpose()| out of |Editor| class as preparation of expanding it into |ExecutTranspose()| in "EditorCommand.cpp" to make |Editor| class simpler for improving code health. Following patch will expand |Transpose()| into |ExecutTranspose()|. Bug: 672405 Change-Id: Icde253623f31813d2b4517c4da7d4798bd5fadf6 Reviewed-on: https://chromium-review.googlesource.com/583880 Reviewed-by: Xiaocheng Hu <[email protected]> Commit-Queue: Yoshifumi Inoue <[email protected]> Cr-Commit-Position: refs/heads/master@{#489518}
static bool ExecuteMoveRight(LocalFrame& frame, Event*, EditorCommandSource, const String&) { return frame.Selection().Modify( SelectionModifyAlteration::kMove, SelectionModifyDirection::kRight, TextGranularity::kCharacter, SetSelectionBy::kUser); }
static bool ExecuteMoveRight(LocalFrame& frame, Event*, EditorCommandSource, const String&) { return frame.Selection().Modify( SelectionModifyAlteration::kMove, SelectionModifyDirection::kRight, TextGranularity::kCharacter, SetSelectionBy::kUser); }
C
Chrome
0
CVE-2017-18241
https://www.cvedetails.com/cve/CVE-2017-18241/
CWE-476
https://github.com/torvalds/linux/commit/d4fdf8ba0e5808ba9ad6b44337783bd9935e0982
d4fdf8ba0e5808ba9ad6b44337783bd9935e0982
f2fs: fix a panic caused by NULL flush_cmd_control Mount fs with option noflush_merge, boot failed for illegal address fcc in function f2fs_issue_flush: if (!test_opt(sbi, FLUSH_MERGE)) { ret = submit_flush_wait(sbi); atomic_inc(&fcc->issued_flush); -> Here, fcc illegal return ret; } Signed-off-by: Yunlei He <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
void register_inmem_page(struct inode *inode, struct page *page) { struct f2fs_inode_info *fi = F2FS_I(inode); struct inmem_pages *new; f2fs_trace_pid(page); set_page_private(page, (unsigned long)ATOMIC_WRITTEN_PAGE); SetPagePrivate(page); new = f2fs_kmem_cache_alloc(inmem_entry_slab, GFP_NOFS); /* add atomic page indices to the list */ new->page = page; INIT_LIST_HEAD(&new->list); /* increase reference count with clean state */ mutex_lock(&fi->inmem_lock); get_page(page); list_add_tail(&new->list, &fi->inmem_pages); inc_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES); mutex_unlock(&fi->inmem_lock); trace_f2fs_register_inmem_page(page, INMEM); }
void register_inmem_page(struct inode *inode, struct page *page) { struct f2fs_inode_info *fi = F2FS_I(inode); struct inmem_pages *new; f2fs_trace_pid(page); set_page_private(page, (unsigned long)ATOMIC_WRITTEN_PAGE); SetPagePrivate(page); new = f2fs_kmem_cache_alloc(inmem_entry_slab, GFP_NOFS); /* add atomic page indices to the list */ new->page = page; INIT_LIST_HEAD(&new->list); /* increase reference count with clean state */ mutex_lock(&fi->inmem_lock); get_page(page); list_add_tail(&new->list, &fi->inmem_pages); inc_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES); mutex_unlock(&fi->inmem_lock); trace_f2fs_register_inmem_page(page, INMEM); }
C
linux
0
CVE-2014-1713
https://www.cvedetails.com/cve/CVE-2014-1713/
CWE-399
https://github.com/chromium/chromium/commit/f85a87ec670ad0fce9d98d90c9a705b72a288154
f85a87ec670ad0fce9d98d90c9a705b72a288154
document.location bindings fix BUG=352374 [email protected] Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void overloadedMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate())); imp->overloadedMethod(arrayArg); }
static void overloadedMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate())); imp->overloadedMethod(arrayArg); }
C
Chrome
0
CVE-2015-6779
https://www.cvedetails.com/cve/CVE-2015-6779/
CWE-264
https://github.com/chromium/chromium/commit/1eefa26e1795192c5a347a1e1e7a99e88c47f9c4
1eefa26e1795192c5a347a1e1e7a99e88c47f9c4
This patch implements a mechanism for more granular link URL permissions (filtering on scheme/host). This fixes the bug that allowed PDFs to have working links to any "chrome://" URLs. BUG=528505,226927 Review URL: https://codereview.chromium.org/1362433002 Cr-Commit-Position: refs/heads/master@{#351705}
bool ChildProcessSecurityPolicyImpl::HasPermissionsForFile( int child_id, const base::FilePath& file, int permissions) { base::AutoLock lock(lock_); bool result = ChildProcessHasPermissionsForFile(child_id, file, permissions); if (!result) { WorkerToMainProcessMap::iterator iter = worker_map_.find(child_id); if (iter != worker_map_.end() && iter->second != 0) { result = ChildProcessHasPermissionsForFile(iter->second, file, permissions); } } return result; }
bool ChildProcessSecurityPolicyImpl::HasPermissionsForFile( int child_id, const base::FilePath& file, int permissions) { base::AutoLock lock(lock_); bool result = ChildProcessHasPermissionsForFile(child_id, file, permissions); if (!result) { WorkerToMainProcessMap::iterator iter = worker_map_.find(child_id); if (iter != worker_map_.end() && iter->second != 0) { result = ChildProcessHasPermissionsForFile(iter->second, file, permissions); } } return result; }
C
Chrome
0
CVE-2016-4997
https://www.cvedetails.com/cve/CVE-2016-4997/
CWE-264
https://github.com/torvalds/linux/commit/ce683e5f9d045e5d67d1312a42b359cb2ab2a13c
ce683e5f9d045e5d67d1312a42b359cb2ab2a13c
netfilter: x_tables: check for bogus target offset We're currently asserting that targetoff + targetsize <= nextoff. Extend it to also check that targetoff is >= sizeof(xt_entry). Since this is generic code, add an argument pointing to the start of the match/target, we can then derive the base structure size from the delta. We also need the e->elems pointer in a followup change to validate matches. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
get_entries(struct net *net, struct ip6t_get_entries __user *uptr, const int *len) { int ret; struct ip6t_get_entries get; struct xt_table *t; if (*len < sizeof(get)) { duprintf("get_entries: %u < %zu\n", *len, sizeof(get)); return -EINVAL; } if (copy_from_user(&get, uptr, sizeof(get)) != 0) return -EFAULT; if (*len != sizeof(struct ip6t_get_entries) + get.size) { duprintf("get_entries: %u != %zu\n", *len, sizeof(get) + get.size); return -EINVAL; } get.name[sizeof(get.name) - 1] = '\0'; t = xt_find_table_lock(net, AF_INET6, get.name); if (!IS_ERR_OR_NULL(t)) { struct xt_table_info *private = t->private; duprintf("t->private->number = %u\n", private->number); if (get.size == private->size) ret = copy_entries_to_user(private->size, t, uptr->entrytable); else { duprintf("get_entries: I've got %u not %u!\n", private->size, get.size); ret = -EAGAIN; } module_put(t->me); xt_table_unlock(t); } else ret = t ? PTR_ERR(t) : -ENOENT; return ret; }
get_entries(struct net *net, struct ip6t_get_entries __user *uptr, const int *len) { int ret; struct ip6t_get_entries get; struct xt_table *t; if (*len < sizeof(get)) { duprintf("get_entries: %u < %zu\n", *len, sizeof(get)); return -EINVAL; } if (copy_from_user(&get, uptr, sizeof(get)) != 0) return -EFAULT; if (*len != sizeof(struct ip6t_get_entries) + get.size) { duprintf("get_entries: %u != %zu\n", *len, sizeof(get) + get.size); return -EINVAL; } get.name[sizeof(get.name) - 1] = '\0'; t = xt_find_table_lock(net, AF_INET6, get.name); if (!IS_ERR_OR_NULL(t)) { struct xt_table_info *private = t->private; duprintf("t->private->number = %u\n", private->number); if (get.size == private->size) ret = copy_entries_to_user(private->size, t, uptr->entrytable); else { duprintf("get_entries: I've got %u not %u!\n", private->size, get.size); ret = -EAGAIN; } module_put(t->me); xt_table_unlock(t); } else ret = t ? PTR_ERR(t) : -ENOENT; return ret; }
C
linux
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <[email protected]> CC: Karsten Keil <[email protected]> CC: "David S. Miller" <[email protected]> CC: Jay Vosburgh <[email protected]> CC: Andy Gospodarek <[email protected]> CC: Patrick McHardy <[email protected]> CC: Krzysztof Halasa <[email protected]> CC: "John W. Linville" <[email protected]> CC: Greg Kroah-Hartman <[email protected]> CC: Marcel Holtmann <[email protected]> CC: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void prism2_tx_timeout(struct net_device *dev) { struct hostap_interface *iface; local_info_t *local; struct hfa384x_regs regs; iface = netdev_priv(dev); local = iface->local; printk(KERN_WARNING "%s Tx timed out! Resetting card\n", dev->name); netif_stop_queue(local->dev); local->func->read_regs(dev, &regs); printk(KERN_DEBUG "%s: CMD=%04x EVSTAT=%04x " "OFFSET0=%04x OFFSET1=%04x SWSUPPORT0=%04x\n", dev->name, regs.cmd, regs.evstat, regs.offset0, regs.offset1, regs.swsupport0); local->func->schedule_reset(local); }
static void prism2_tx_timeout(struct net_device *dev) { struct hostap_interface *iface; local_info_t *local; struct hfa384x_regs regs; iface = netdev_priv(dev); local = iface->local; printk(KERN_WARNING "%s Tx timed out! Resetting card\n", dev->name); netif_stop_queue(local->dev); local->func->read_regs(dev, &regs); printk(KERN_DEBUG "%s: CMD=%04x EVSTAT=%04x " "OFFSET0=%04x OFFSET1=%04x SWSUPPORT0=%04x\n", dev->name, regs.cmd, regs.evstat, regs.offset0, regs.offset1, regs.swsupport0); local->func->schedule_reset(local); }
C
linux
0
CVE-2014-8481
https://www.cvedetails.com/cve/CVE-2014-8481/
CWE-399
https://github.com/torvalds/linux/commit/a430c9166312e1aa3d80bce32374233bdbfeba32
a430c9166312e1aa3d80bce32374233bdbfeba32
KVM: emulate: avoid accessing NULL ctxt->memopp A failure to decode the instruction can cause a NULL pointer access. This is fixed simply by moving the "done" label as close as possible to the return. This fixes CVE-2014-8481. Reported-by: Andy Lutomirski <[email protected]> Cc: [email protected] Fixes: 41061cdb98a0bec464278b4db8e894a3121671f5 Signed-off-by: Paolo Bonzini <[email protected]>
static int task_switch_32(struct x86_emulate_ctxt *ctxt, u16 tss_selector, u16 old_tss_sel, ulong old_tss_base, struct desc_struct *new_desc) { const struct x86_emulate_ops *ops = ctxt->ops; struct tss_segment_32 tss_seg; int ret; u32 new_tss_base = get_desc_base(new_desc); u32 eip_offset = offsetof(struct tss_segment_32, eip); u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector); ret = ops->read_std(ctxt, old_tss_base, &tss_seg, sizeof tss_seg, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; save_state_to_tss32(ctxt, &tss_seg); /* Only GP registers and segment selectors are saved */ ret = ops->write_std(ctxt, old_tss_base + eip_offset, &tss_seg.eip, ldt_sel_offset - eip_offset, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; ret = ops->read_std(ctxt, new_tss_base, &tss_seg, sizeof tss_seg, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; if (old_tss_sel != 0xffff) { tss_seg.prev_task_link = old_tss_sel; ret = ops->write_std(ctxt, new_tss_base, &tss_seg.prev_task_link, sizeof tss_seg.prev_task_link, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; } return load_state_from_tss32(ctxt, &tss_seg); }
static int task_switch_32(struct x86_emulate_ctxt *ctxt, u16 tss_selector, u16 old_tss_sel, ulong old_tss_base, struct desc_struct *new_desc) { const struct x86_emulate_ops *ops = ctxt->ops; struct tss_segment_32 tss_seg; int ret; u32 new_tss_base = get_desc_base(new_desc); u32 eip_offset = offsetof(struct tss_segment_32, eip); u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector); ret = ops->read_std(ctxt, old_tss_base, &tss_seg, sizeof tss_seg, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; save_state_to_tss32(ctxt, &tss_seg); /* Only GP registers and segment selectors are saved */ ret = ops->write_std(ctxt, old_tss_base + eip_offset, &tss_seg.eip, ldt_sel_offset - eip_offset, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; ret = ops->read_std(ctxt, new_tss_base, &tss_seg, sizeof tss_seg, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; if (old_tss_sel != 0xffff) { tss_seg.prev_task_link = old_tss_sel; ret = ops->write_std(ctxt, new_tss_base, &tss_seg.prev_task_link, sizeof tss_seg.prev_task_link, &ctxt->exception); if (ret != X86EMUL_CONTINUE) /* FIXME: need to provide precise fault address */ return ret; } return load_state_from_tss32(ctxt, &tss_seg); }
C
linux
0
CVE-2017-15649
https://www.cvedetails.com/cve/CVE-2017-15649/
CWE-362
https://github.com/torvalds/linux/commit/4971613c1639d8e5f102c4e797c3bf8f83a5a69e
4971613c1639d8e5f102c4e797c3bf8f83a5a69e
packet: in packet_do_bind, test fanout with bind_lock held Once a socket has po->fanout set, it remains a member of the group until it is destroyed. The prot_hook must be constant and identical across sockets in the group. If fanout_add races with packet_do_bind between the test of po->fanout and taking the lock, the bind call may make type or dev inconsistent with that of the fanout group. Hold po->bind_lock when testing po->fanout to avoid this race. I had to introduce artificial delay (local_bh_enable) to actually observe the race. Fixes: dc99f600698d ("packet: Add fanout support.") Signed-off-by: Willem de Bruijn <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int tpacket_parse_header(struct packet_sock *po, void *frame, int size_max, void **data) { union tpacket_uhdr ph; int tp_len, off; ph.raw = frame; switch (po->tp_version) { case TPACKET_V3: if (ph.h3->tp_next_offset != 0) { pr_warn_once("variable sized slot not supported"); return -EINVAL; } tp_len = ph.h3->tp_len; break; case TPACKET_V2: tp_len = ph.h2->tp_len; break; default: tp_len = ph.h1->tp_len; break; } if (unlikely(tp_len > size_max)) { pr_err("packet size is too long (%d > %d)\n", tp_len, size_max); return -EMSGSIZE; } if (unlikely(po->tp_tx_has_off)) { int off_min, off_max; off_min = po->tp_hdrlen - sizeof(struct sockaddr_ll); off_max = po->tx_ring.frame_size - tp_len; if (po->sk.sk_type == SOCK_DGRAM) { switch (po->tp_version) { case TPACKET_V3: off = ph.h3->tp_net; break; case TPACKET_V2: off = ph.h2->tp_net; break; default: off = ph.h1->tp_net; break; } } else { switch (po->tp_version) { case TPACKET_V3: off = ph.h3->tp_mac; break; case TPACKET_V2: off = ph.h2->tp_mac; break; default: off = ph.h1->tp_mac; break; } } if (unlikely((off < off_min) || (off_max < off))) return -EINVAL; } else { off = po->tp_hdrlen - sizeof(struct sockaddr_ll); } *data = frame + off; return tp_len; }
static int tpacket_parse_header(struct packet_sock *po, void *frame, int size_max, void **data) { union tpacket_uhdr ph; int tp_len, off; ph.raw = frame; switch (po->tp_version) { case TPACKET_V3: if (ph.h3->tp_next_offset != 0) { pr_warn_once("variable sized slot not supported"); return -EINVAL; } tp_len = ph.h3->tp_len; break; case TPACKET_V2: tp_len = ph.h2->tp_len; break; default: tp_len = ph.h1->tp_len; break; } if (unlikely(tp_len > size_max)) { pr_err("packet size is too long (%d > %d)\n", tp_len, size_max); return -EMSGSIZE; } if (unlikely(po->tp_tx_has_off)) { int off_min, off_max; off_min = po->tp_hdrlen - sizeof(struct sockaddr_ll); off_max = po->tx_ring.frame_size - tp_len; if (po->sk.sk_type == SOCK_DGRAM) { switch (po->tp_version) { case TPACKET_V3: off = ph.h3->tp_net; break; case TPACKET_V2: off = ph.h2->tp_net; break; default: off = ph.h1->tp_net; break; } } else { switch (po->tp_version) { case TPACKET_V3: off = ph.h3->tp_mac; break; case TPACKET_V2: off = ph.h2->tp_mac; break; default: off = ph.h1->tp_mac; break; } } if (unlikely((off < off_min) || (off_max < off))) return -EINVAL; } else { off = po->tp_hdrlen - sizeof(struct sockaddr_ll); } *data = frame + off; return tp_len; }
C
linux
0
CVE-2018-13094
https://www.cvedetails.com/cve/CVE-2018-13094/
CWE-476
https://github.com/torvalds/linux/commit/bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a
bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a
xfs: don't call xfs_da_shrink_inode with NULL bp xfs_attr3_leaf_create may have errored out before instantiating a buffer, for example if the blkno is out of range. In that case there is no work to do to remove it, and in fact xfs_da_shrink_inode will lead to an oops if we try. This also seems to fix a flaw where the original error from xfs_attr3_leaf_create gets overwritten in the cleanup case, and it removes a pointless assignment to bp which isn't used after this. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199969 Reported-by: Xu, Wen <[email protected]> Tested-by: Xu, Wen <[email protected]> Signed-off-by: Eric Sandeen <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
xfs_attr3_leaf_add( struct xfs_buf *bp, struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf; struct xfs_attr3_icleaf_hdr ichdr; int tablesize; int entsize; int sum; int tmp; int i; trace_xfs_attr_leaf_add(args); leaf = bp->b_addr; xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); ASSERT(args->index >= 0 && args->index <= ichdr.count); entsize = xfs_attr_leaf_newentsize(args, NULL); /* * Search through freemap for first-fit on new name length. * (may need to figure in size of entry struct too) */ tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t) + xfs_attr3_leaf_hdr_size(leaf); for (sum = 0, i = XFS_ATTR_LEAF_MAPSIZE - 1; i >= 0; i--) { if (tablesize > ichdr.firstused) { sum += ichdr.freemap[i].size; continue; } if (!ichdr.freemap[i].size) continue; /* no space in this map */ tmp = entsize; if (ichdr.freemap[i].base < ichdr.firstused) tmp += sizeof(xfs_attr_leaf_entry_t); if (ichdr.freemap[i].size >= tmp) { tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); goto out_log_hdr; } sum += ichdr.freemap[i].size; } /* * If there are no holes in the address space of the block, * and we don't have enough freespace, then compaction will do us * no good and we should just give up. */ if (!ichdr.holes && sum < entsize) return -ENOSPC; /* * Compact the entries to coalesce free space. * This may change the hdr->count via dropping INCOMPLETE entries. */ xfs_attr3_leaf_compact(args, &ichdr, bp); /* * After compaction, the block is guaranteed to have only one * free region, in freemap[0]. If it is not big enough, give up. */ if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { tmp = -ENOSPC; goto out_log_hdr; } tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); out_log_hdr: xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); xfs_trans_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, &leaf->hdr, xfs_attr3_leaf_hdr_size(leaf))); return tmp; }
xfs_attr3_leaf_add( struct xfs_buf *bp, struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf; struct xfs_attr3_icleaf_hdr ichdr; int tablesize; int entsize; int sum; int tmp; int i; trace_xfs_attr_leaf_add(args); leaf = bp->b_addr; xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); ASSERT(args->index >= 0 && args->index <= ichdr.count); entsize = xfs_attr_leaf_newentsize(args, NULL); /* * Search through freemap for first-fit on new name length. * (may need to figure in size of entry struct too) */ tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t) + xfs_attr3_leaf_hdr_size(leaf); for (sum = 0, i = XFS_ATTR_LEAF_MAPSIZE - 1; i >= 0; i--) { if (tablesize > ichdr.firstused) { sum += ichdr.freemap[i].size; continue; } if (!ichdr.freemap[i].size) continue; /* no space in this map */ tmp = entsize; if (ichdr.freemap[i].base < ichdr.firstused) tmp += sizeof(xfs_attr_leaf_entry_t); if (ichdr.freemap[i].size >= tmp) { tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); goto out_log_hdr; } sum += ichdr.freemap[i].size; } /* * If there are no holes in the address space of the block, * and we don't have enough freespace, then compaction will do us * no good and we should just give up. */ if (!ichdr.holes && sum < entsize) return -ENOSPC; /* * Compact the entries to coalesce free space. * This may change the hdr->count via dropping INCOMPLETE entries. */ xfs_attr3_leaf_compact(args, &ichdr, bp); /* * After compaction, the block is guaranteed to have only one * free region, in freemap[0]. If it is not big enough, give up. */ if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { tmp = -ENOSPC; goto out_log_hdr; } tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); out_log_hdr: xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); xfs_trans_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, &leaf->hdr, xfs_attr3_leaf_hdr_size(leaf))); return tmp; }
C
linux
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
void AXLayoutObject::addInlineTextBoxChildren(bool force) { Settings* settings = getDocument()->settings(); if (!force && (!settings || !settings->getInlineTextBoxAccessibilityEnabled())) return; if (!getLayoutObject() || !getLayoutObject()->isText()) return; if (getLayoutObject()->needsLayout()) { return; } LayoutText* layoutText = toLayoutText(getLayoutObject()); for (RefPtr<AbstractInlineTextBox> box = layoutText->firstAbstractInlineTextBox(); box.get(); box = box->nextInlineTextBox()) { AXObject* axObject = axObjectCache().getOrCreate(box.get()); if (!axObject->accessibilityIsIgnored()) m_children.push_back(axObject); } }
void AXLayoutObject::addInlineTextBoxChildren(bool force) { Settings* settings = getDocument()->settings(); if (!force && (!settings || !settings->getInlineTextBoxAccessibilityEnabled())) return; if (!getLayoutObject() || !getLayoutObject()->isText()) return; if (getLayoutObject()->needsLayout()) { return; } LayoutText* layoutText = toLayoutText(getLayoutObject()); for (RefPtr<AbstractInlineTextBox> box = layoutText->firstAbstractInlineTextBox(); box.get(); box = box->nextInlineTextBox()) { AXObject* axObject = axObjectCache().getOrCreate(box.get()); if (!axObject->accessibilityIsIgnored()) m_children.push_back(axObject); } }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
IntSize DrawingBuffer::AdjustSize(const IntSize& desired_size, const IntSize& cur_size, int max_texture_size) { IntSize adjusted_size = desired_size; if (adjusted_size.Height() > max_texture_size) adjusted_size.SetHeight(max_texture_size); if (adjusted_size.Width() > max_texture_size) adjusted_size.SetWidth(max_texture_size); return adjusted_size; }
IntSize DrawingBuffer::AdjustSize(const IntSize& desired_size, const IntSize& cur_size, int max_texture_size) { IntSize adjusted_size = desired_size; if (adjusted_size.Height() > max_texture_size) adjusted_size.SetHeight(max_texture_size); if (adjusted_size.Width() > max_texture_size) adjusted_size.SetWidth(max_texture_size); return adjusted_size; }
C
Chrome
0
CVE-2018-20067
https://www.cvedetails.com/cve/CVE-2018-20067/
CWE-254
https://github.com/chromium/chromium/commit/a7d715ae5b654d1f98669fd979a00282a7229044
a7d715ae5b654d1f98669fd979a00282a7229044
Prevent renderer initiated back navigation to cancel a browser one. Renderer initiated back/forward navigations must not be able to cancel ongoing browser initiated navigation if they are not user initiated. Note: 'normal' renderer initiated navigation uses the FrameHost::BeginNavigation() path. A code similar to this patch is done in NavigatorImpl::OnBeginNavigation(). Test: ----- Added: NavigationBrowserTest. * HistoryBackInBeforeUnload * HistoryBackInBeforeUnloadAfterSetTimeout * HistoryBackCancelPendingNavigationNoUserGesture * HistoryBackCancelPendingNavigationUserGesture Fixed: * (WPT) .../the-history-interface/traverse_the_history_2.html * (WPT) .../the-history-interface/traverse_the_history_3.html * (WPT) .../the-history-interface/traverse_the_history_4.html * (WPT) .../the-history-interface/traverse_the_history_5.html Bug: 879965 Change-Id: I1a9bfaaea1ffc219e6c32f6e676b660e746c578c Reviewed-on: https://chromium-review.googlesource.com/1209744 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Mustaq Ahmed <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Reviewed-by: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#592823}
void LocalFrameClientImpl::DidContainInsecureFormAction() { if (web_frame_->Client()) web_frame_->Client()->DidContainInsecureFormAction(); }
void LocalFrameClientImpl::DidContainInsecureFormAction() { if (web_frame_->Client()) web_frame_->Client()->DidContainInsecureFormAction(); }
C
Chrome
0
CVE-2017-18203
https://www.cvedetails.com/cve/CVE-2017-18203/
CWE-362
https://github.com/torvalds/linux/commit/b9a41d21dceadf8104812626ef85dc56ee8a60ed
b9a41d21dceadf8104812626ef85dc56ee8a60ed
dm: fix race between dm_get_from_kobject() and __dm_destroy() The following BUG_ON was hit when testing repeat creation and removal of DM devices: kernel BUG at drivers/md/dm.c:2919! CPU: 7 PID: 750 Comm: systemd-udevd Not tainted 4.1.44 Call Trace: [<ffffffff81649e8b>] dm_get_from_kobject+0x34/0x3a [<ffffffff81650ef1>] dm_attr_show+0x2b/0x5e [<ffffffff817b46d1>] ? mutex_lock+0x26/0x44 [<ffffffff811df7f5>] sysfs_kf_seq_show+0x83/0xcf [<ffffffff811de257>] kernfs_seq_show+0x23/0x25 [<ffffffff81199118>] seq_read+0x16f/0x325 [<ffffffff811de994>] kernfs_fop_read+0x3a/0x13f [<ffffffff8117b625>] __vfs_read+0x26/0x9d [<ffffffff8130eb59>] ? security_file_permission+0x3c/0x44 [<ffffffff8117bdb8>] ? rw_verify_area+0x83/0xd9 [<ffffffff8117be9d>] vfs_read+0x8f/0xcf [<ffffffff81193e34>] ? __fdget_pos+0x12/0x41 [<ffffffff8117c686>] SyS_read+0x4b/0x76 [<ffffffff817b606e>] system_call_fastpath+0x12/0x71 The bug can be easily triggered, if an extra delay (e.g. 10ms) is added between the test of DMF_FREEING & DMF_DELETING and dm_get() in dm_get_from_kobject(). To fix it, we need to ensure the test of DMF_FREEING & DMF_DELETING and dm_get() are done in an atomic way, so _minor_lock is used. The other callers of dm_get() have also been checked to be OK: some callers invoke dm_get() under _minor_lock, some callers invoke it under _hash_lock, and dm_start_request() invoke it after increasing md->open_count. Cc: [email protected] Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, size_t bytes, struct iov_iter *i) { struct mapped_device *md = dax_get_private(dax_dev); sector_t sector = pgoff * PAGE_SECTORS; struct dm_target *ti; long ret = 0; int srcu_idx; ti = dm_dax_get_live_target(md, sector, &srcu_idx); if (!ti) goto out; if (!ti->type->dax_copy_from_iter) { ret = copy_from_iter(addr, bytes, i); goto out; } ret = ti->type->dax_copy_from_iter(ti, pgoff, addr, bytes, i); out: dm_put_live_table(md, srcu_idx); return ret; }
static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, size_t bytes, struct iov_iter *i) { struct mapped_device *md = dax_get_private(dax_dev); sector_t sector = pgoff * PAGE_SECTORS; struct dm_target *ti; long ret = 0; int srcu_idx; ti = dm_dax_get_live_target(md, sector, &srcu_idx); if (!ti) goto out; if (!ti->type->dax_copy_from_iter) { ret = copy_from_iter(addr, bytes, i); goto out; } ret = ti->type->dax_copy_from_iter(ti, pgoff, addr, bytes, i); out: dm_put_live_table(md, srcu_idx); return ret; }
C
linux
0
CVE-2018-17476
https://www.cvedetails.com/cve/CVE-2018-17476/
CWE-20
https://github.com/chromium/chromium/commit/3d41e77125f3de8d722b6d8303599abaf2a91667
3d41e77125f3de8d722b6d8303599abaf2a91667
If a dialog is shown, drop fullscreen. BUG=875066, 817809, 792876, 812769, 813815 TEST=included Change-Id: Ic3d697fa3c4b01f5d7fea77391857177ada660db Reviewed-on: https://chromium-review.googlesource.com/1185208 Reviewed-by: Sidney San Martín <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#586418}
base::string16 LocaleWindowCaptionFromPageTitle( const base::string16& expected_title) { base::string16 page_title = WindowCaptionFromPageTitle(expected_title); #if defined(OS_WIN) std::string locale = g_browser_process->GetApplicationLocale(); if (base::i18n::GetTextDirectionForLocale(locale.c_str()) == base::i18n::RIGHT_TO_LEFT) { base::i18n::WrapStringWithLTRFormatting(&page_title); } return page_title; #else return page_title; #endif }
base::string16 LocaleWindowCaptionFromPageTitle( const base::string16& expected_title) { base::string16 page_title = WindowCaptionFromPageTitle(expected_title); #if defined(OS_WIN) std::string locale = g_browser_process->GetApplicationLocale(); if (base::i18n::GetTextDirectionForLocale(locale.c_str()) == base::i18n::RIGHT_TO_LEFT) { base::i18n::WrapStringWithLTRFormatting(&page_title); } return page_title; #else return page_title; #endif }
C
Chrome
0
CVE-2013-6634
https://www.cvedetails.com/cve/CVE-2013-6634/
CWE-287
https://github.com/chromium/chromium/commit/50370b3c98047bdc80184ff87a502edc5c597d3a
50370b3c98047bdc80184ff87a502edc5c597d3a
During redirects in the one click sign in flow, check the current URL instead of original URL to validate gaia http headers. BUG=307159 Review URL: https://codereview.chromium.org/77343002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236563 0039d316-1c4b-4281-b951-d872f2087c98
void CurrentHistoryCleaner::WebContentsDestroyed( content::WebContents* contents) { delete this; // Failure. }
void CurrentHistoryCleaner::WebContentsDestroyed( content::WebContents* contents) { delete this; // Failure. }
C
Chrome
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
bool AXLayoutObject::isSelected() const { if (!getLayoutObject() || !getNode()) return false; const AtomicString& ariaSelected = getAttribute(aria_selectedAttr); if (equalIgnoringASCIICase(ariaSelected, "true")) return true; AXObject* focusedObject = axObjectCache().focusedObject(); if (ariaRoleAttribute() == ListBoxOptionRole && focusedObject && focusedObject->activeDescendant() == this) { return true; } if (isTabItem() && isTabItemSelected()) return true; return false; }
bool AXLayoutObject::isSelected() const { if (!getLayoutObject() || !getNode()) return false; const AtomicString& ariaSelected = getAttribute(aria_selectedAttr); if (equalIgnoringCase(ariaSelected, "true")) return true; AXObject* focusedObject = axObjectCache().focusedObject(); if (ariaRoleAttribute() == ListBoxOptionRole && focusedObject && focusedObject->activeDescendant() == this) { return true; } if (isTabItem() && isTabItemSelected()) return true; return false; }
C
Chrome
1
CVE-2014-0206
https://www.cvedetails.com/cve/CVE-2014-0206/
null
https://github.com/torvalds/linux/commit/edfbbf388f293d70bf4b7c0bc38774d05e6f711a
edfbbf388f293d70bf4b7c0bc38774d05e6f711a
aio: fix kernel memory disclosure in io_getevents() introduced in v3.10 A kernel memory disclosure was introduced in aio_read_events_ring() in v3.10 by commit a31ad380bed817aa25f8830ad23e1a0480fef797. The changes made to aio_read_events_ring() failed to correctly limit the index into ctx->ring_pages[], allowing an attacked to cause the subsequent kmap() of an arbitrary page with a copy_to_user() to copy the contents into userspace. This vulnerability has been assigned CVE-2014-0206. Thanks to Mateusz and Petr for disclosing this issue. This patch applies to v3.12+. A separate backport is needed for 3.10/3.11. Signed-off-by: Benjamin LaHaise <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Petr Matousek <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: Jeff Moyer <[email protected]> Cc: [email protected]
long do_io_submit(aio_context_t ctx_id, long nr, struct iocb __user *__user *iocbpp, bool compat) { struct kioctx *ctx; long ret = 0; int i = 0; struct blk_plug plug; if (unlikely(nr < 0)) return -EINVAL; if (unlikely(nr > LONG_MAX/sizeof(*iocbpp))) nr = LONG_MAX/sizeof(*iocbpp); if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) return -EFAULT; ctx = lookup_ioctx(ctx_id); if (unlikely(!ctx)) { pr_debug("EINVAL: invalid context id\n"); return -EINVAL; } blk_start_plug(&plug); /* * AKPM: should this return a partial result if some of the IOs were * successfully submitted? */ for (i=0; i<nr; i++) { struct iocb __user *user_iocb; struct iocb tmp; if (unlikely(__get_user(user_iocb, iocbpp + i))) { ret = -EFAULT; break; } if (unlikely(copy_from_user(&tmp, user_iocb, sizeof(tmp)))) { ret = -EFAULT; break; } ret = io_submit_one(ctx, user_iocb, &tmp, compat); if (ret) break; } blk_finish_plug(&plug); percpu_ref_put(&ctx->users); return i ? i : ret; }
long do_io_submit(aio_context_t ctx_id, long nr, struct iocb __user *__user *iocbpp, bool compat) { struct kioctx *ctx; long ret = 0; int i = 0; struct blk_plug plug; if (unlikely(nr < 0)) return -EINVAL; if (unlikely(nr > LONG_MAX/sizeof(*iocbpp))) nr = LONG_MAX/sizeof(*iocbpp); if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) return -EFAULT; ctx = lookup_ioctx(ctx_id); if (unlikely(!ctx)) { pr_debug("EINVAL: invalid context id\n"); return -EINVAL; } blk_start_plug(&plug); /* * AKPM: should this return a partial result if some of the IOs were * successfully submitted? */ for (i=0; i<nr; i++) { struct iocb __user *user_iocb; struct iocb tmp; if (unlikely(__get_user(user_iocb, iocbpp + i))) { ret = -EFAULT; break; } if (unlikely(copy_from_user(&tmp, user_iocb, sizeof(tmp)))) { ret = -EFAULT; break; } ret = io_submit_one(ctx, user_iocb, &tmp, compat); if (ret) break; } blk_finish_plug(&plug); percpu_ref_put(&ctx->users); return i ? i : ret; }
C
linux
0
CVE-2017-11399
https://www.cvedetails.com/cve/CVE-2017-11399/
CWE-125
https://github.com/FFmpeg/FFmpeg/commit/ba4beaf6149f7241c8bd85fe853318c2f6837ad0
ba4beaf6149f7241c8bd85fe853318c2f6837ad0
avcodec/apedec: Fix integer overflow Fixes: out of array access Fixes: PoC.ape and others Found-by: Bingchang, Liu@VARAS of IIE Signed-off-by: Michael Niedermayer <[email protected]>
static inline int range_decode_culshift(APEContext *ctx, int shift) { range_dec_normalize(ctx); ctx->rc.help = ctx->rc.range >> shift; return ctx->rc.low / ctx->rc.help; }
static inline int range_decode_culshift(APEContext *ctx, int shift) { range_dec_normalize(ctx); ctx->rc.help = ctx->rc.range >> shift; return ctx->rc.low / ctx->rc.help; }
C
FFmpeg
0
CVE-2016-3861
https://www.cvedetails.com/cve/CVE-2016-3861/
CWE-119
https://android.googlesource.com/platform/system/core/+/ecf5fd58a8f50362ce9e8d4245a33d56f29f142b
ecf5fd58a8f50362ce9e8d4245a33d56f29f142b
libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8 Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length is causing a heap overflow. Correcting the length computation and adding bound checks to the conversion functions. Test: ran libutils_tests Bug: 29250543 Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb (cherry picked from commit c4966a363e46d2e1074d1a365e232af0dcedd6a1)
String8::String8(StaticLinkage) : mString(0) { char* data = static_cast<char*>( SharedBuffer::alloc(sizeof(char))->data()); data[0] = 0; mString = data; }
String8::String8(StaticLinkage) : mString(0) { char* data = static_cast<char*>( SharedBuffer::alloc(sizeof(char))->data()); data[0] = 0; mString = data; }
C
Android
0
CVE-2013-6432
https://www.cvedetails.com/cve/CVE-2013-6432/
null
https://github.com/torvalds/linux/commit/cf970c002d270c36202bd5b9c2804d3097a52da0
cf970c002d270c36202bd5b9c2804d3097a52da0
ping: prevent NULL pointer dereference on write to msg_name A plain read() on a socket does set msg->msg_name to NULL. So check for NULL pointer first. Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int __net_init ping_v4_proc_init_net(struct net *net) { return ping_proc_register(net, &ping_v4_seq_afinfo); }
static int __net_init ping_v4_proc_init_net(struct net *net) { return ping_proc_register(net, &ping_v4_seq_afinfo); }
C
linux
0
CVE-2016-5185
https://www.cvedetails.com/cve/CVE-2016-5185/
CWE-416
https://github.com/chromium/chromium/commit/f2d26633cbd50735ac2af30436888b71ac0abad3
f2d26633cbd50735ac2af30436888b71ac0abad3
[Autofill] Remove AutofillPopupViewViews and associated feature. Bug: 906135,831603 Change-Id: I3c982f8b3ffb4928c7c878e74e10113999106499 Reviewed-on: https://chromium-review.googlesource.com/c/1387124 Reviewed-by: Robert Kaplow <[email protected]> Reviewed-by: Vasilii Sukhanov <[email protected]> Reviewed-by: Fabio Tirelo <[email protected]> Reviewed-by: Tommy Martino <[email protected]> Commit-Queue: Mathieu Perreault <[email protected]> Cr-Commit-Position: refs/heads/master@{#621360}
bool ShouldShowCardsFromAccountOption(const FormData& form, const FormFieldData& field) { return should_show_cards_from_account_option_; }
bool ShouldShowCardsFromAccountOption(const FormData& form, const FormFieldData& field) { return should_show_cards_from_account_option_; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/a03d4448faf2c40f4ef444a88cb9aace5b98e8c4
a03d4448faf2c40f4ef444a88cb9aace5b98e8c4
Introduce background.scripts feature for extension manifests. This optimizes for the common use case where background pages just include a reference to one or more script files and no additional HTML. BUG=107791 Review URL: http://codereview.chromium.org/9150008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117110 0039d316-1c4b-4281-b951-d872f2087c98
void BackgroundContentsService::LoadBackgroundContentsFromPrefs( Profile* profile) { if (!prefs_) return; const DictionaryValue* contents = prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); if (!contents) return; ExtensionService* extensions_service = profile->GetExtensionService(); DCHECK(extensions_service); for (DictionaryValue::key_iterator it = contents->begin_keys(); it != contents->end_keys(); ++it) { const Extension* extension = extensions_service->GetExtensionById( *it, false); if (!extension) { NOTREACHED() << "No extension found for BackgroundContents - id = " << *it; continue; } LoadBackgroundContentsFromDictionary(profile, *it, contents); } }
void BackgroundContentsService::LoadBackgroundContentsFromPrefs( Profile* profile) { if (!prefs_) return; const DictionaryValue* contents = prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); if (!contents) return; ExtensionService* extensions_service = profile->GetExtensionService(); DCHECK(extensions_service); for (DictionaryValue::key_iterator it = contents->begin_keys(); it != contents->end_keys(); ++it) { const Extension* extension = extensions_service->GetExtensionById( *it, false); if (!extension) { NOTREACHED() << "No extension found for BackgroundContents - id = " << *it; continue; } LoadBackgroundContentsFromDictionary(profile, *it, contents); } }
C
Chrome
0
CVE-2013-0918
https://www.cvedetails.com/cve/CVE-2013-0918/
CWE-264
https://github.com/chromium/chromium/commit/0a57375ad73780e61e1770a9d88b0529b0dbd33b
0a57375ad73780e61e1770a9d88b0529b0dbd33b
Let the browser handle external navigations from DevTools. BUG=180555 Review URL: https://chromiumcodereview.appspot.com/12531004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186793 0039d316-1c4b-4281-b951-d872f2087c98
bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { possible_drag_event_info_.event_source = ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; possible_drag_event_info_.event_location = gfx::Point(event.globalX, event.globalY); pepper_helper_->WillHandleMouseEvent(); return mouse_lock_dispatcher_->WillHandleMouseEvent(event); }
bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { possible_drag_event_info_.event_source = ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; possible_drag_event_info_.event_location = gfx::Point(event.globalX, event.globalY); pepper_helper_->WillHandleMouseEvent(); return mouse_lock_dispatcher_->WillHandleMouseEvent(event); }
C
Chrome
0
CVE-2016-7910
https://www.cvedetails.com/cve/CVE-2016-7910/
CWE-416
https://github.com/torvalds/linux/commit/77da160530dd1dc94f6ae15a981f24e5f0021e84
77da160530dd1dc94f6ae15a981f24e5f0021e84
block: fix use-after-free in seq file I got a KASAN report of use-after-free: ================================================================== BUG: KASAN: use-after-free in klist_iter_exit+0x61/0x70 at addr ffff8800b6581508 Read of size 8 by task trinity-c1/315 ============================================================================= BUG kmalloc-32 (Not tainted): kasan: bad access detected ----------------------------------------------------------------------------- Disabling lock debugging due to kernel taint INFO: Allocated in disk_seqf_start+0x66/0x110 age=144 cpu=1 pid=315 ___slab_alloc+0x4f1/0x520 __slab_alloc.isra.58+0x56/0x80 kmem_cache_alloc_trace+0x260/0x2a0 disk_seqf_start+0x66/0x110 traverse+0x176/0x860 seq_read+0x7e3/0x11a0 proc_reg_read+0xbc/0x180 do_loop_readv_writev+0x134/0x210 do_readv_writev+0x565/0x660 vfs_readv+0x67/0xa0 do_preadv+0x126/0x170 SyS_preadv+0xc/0x10 do_syscall_64+0x1a1/0x460 return_from_SYSCALL_64+0x0/0x6a INFO: Freed in disk_seqf_stop+0x42/0x50 age=160 cpu=1 pid=315 __slab_free+0x17a/0x2c0 kfree+0x20a/0x220 disk_seqf_stop+0x42/0x50 traverse+0x3b5/0x860 seq_read+0x7e3/0x11a0 proc_reg_read+0xbc/0x180 do_loop_readv_writev+0x134/0x210 do_readv_writev+0x565/0x660 vfs_readv+0x67/0xa0 do_preadv+0x126/0x170 SyS_preadv+0xc/0x10 do_syscall_64+0x1a1/0x460 return_from_SYSCALL_64+0x0/0x6a CPU: 1 PID: 315 Comm: trinity-c1 Tainted: G B 4.7.0+ #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 ffffea0002d96000 ffff880119b9f918 ffffffff81d6ce81 ffff88011a804480 ffff8800b6581500 ffff880119b9f948 ffffffff8146c7bd ffff88011a804480 ffffea0002d96000 ffff8800b6581500 fffffffffffffff4 ffff880119b9f970 Call Trace: [<ffffffff81d6ce81>] dump_stack+0x65/0x84 [<ffffffff8146c7bd>] print_trailer+0x10d/0x1a0 [<ffffffff814704ff>] object_err+0x2f/0x40 [<ffffffff814754d1>] kasan_report_error+0x221/0x520 [<ffffffff8147590e>] __asan_report_load8_noabort+0x3e/0x40 [<ffffffff83888161>] klist_iter_exit+0x61/0x70 [<ffffffff82404389>] class_dev_iter_exit+0x9/0x10 [<ffffffff81d2e8ea>] disk_seqf_stop+0x3a/0x50 [<ffffffff8151f812>] seq_read+0x4b2/0x11a0 [<ffffffff815f8fdc>] proc_reg_read+0xbc/0x180 [<ffffffff814b24e4>] do_loop_readv_writev+0x134/0x210 [<ffffffff814b4c45>] do_readv_writev+0x565/0x660 [<ffffffff814b8a17>] vfs_readv+0x67/0xa0 [<ffffffff814b8de6>] do_preadv+0x126/0x170 [<ffffffff814b92ec>] SyS_preadv+0xc/0x10 This problem can occur in the following situation: open() - pread() - .seq_start() - iter = kmalloc() // succeeds - seqf->private = iter - .seq_stop() - kfree(seqf->private) - pread() - .seq_start() - iter = kmalloc() // fails - .seq_stop() - class_dev_iter_exit(seqf->private) // boom! old pointer As the comment in disk_seqf_stop() says, stop is called even if start failed, so we need to reinitialise the private pointer to NULL when seq iteration stops. An alternative would be to set the private pointer to NULL when the kmalloc() in disk_seqf_start() fails. Cc: [email protected] Signed-off-by: Vegard Nossum <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
static ssize_t disk_range_show(struct device *dev, struct device_attribute *attr, char *buf) { struct gendisk *disk = dev_to_disk(dev); return sprintf(buf, "%d\n", disk->minors); }
static ssize_t disk_range_show(struct device *dev, struct device_attribute *attr, char *buf) { struct gendisk *disk = dev_to_disk(dev); return sprintf(buf, "%d\n", disk->minors); }
C
linux
0
CVE-2017-12897
https://www.cvedetails.com/cve/CVE-2017-12897/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/1dcd10aceabbc03bf571ea32b892c522cbe923de
1dcd10aceabbc03bf571ea32b892c522cbe923de
CVE-2017-12897/ISO CLNS: Use ND_TTEST() for the bounds checks in isoclns_print(). This fixes a buffer over-read discovered by Kamil Frankowicz. Don't pass the remaining caplen - that's too hard to get right, and we were getting it wrong in at least one case; just use ND_TTEST(). Add a test using the capture file supplied by the reporter(s).
juniper_atm2_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { int llc_hdrlen; struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_ATM2; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */ oam_print(ndo, p, l2info.length, ATM_OAM_NOHEC); return l2info.header_len; } if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) return l2info.header_len; } if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */ isoclns_print(ndo, p + 1, l2info.length - 1); /* FIXME check if frame was recognized */ return l2info.header_len; } if(juniper_ppp_heuristic_guess(ndo, p, l2info.length) != 0) /* PPPoA vcmux encaps ? */ return l2info.header_len; if (ip_heuristic_guess(ndo, p, l2info.length) != 0) /* last try - vcmux encaps ? */ return l2info.header_len; return l2info.header_len; }
juniper_atm2_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { int llc_hdrlen; struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_ATM2; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */ oam_print(ndo, p, l2info.length, ATM_OAM_NOHEC); return l2info.header_len; } if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) return l2info.header_len; } if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */ isoclns_print(ndo, p + 1, l2info.length - 1, l2info.caplen - 1); /* FIXME check if frame was recognized */ return l2info.header_len; } if(juniper_ppp_heuristic_guess(ndo, p, l2info.length) != 0) /* PPPoA vcmux encaps ? */ return l2info.header_len; if (ip_heuristic_guess(ndo, p, l2info.length) != 0) /* last try - vcmux encaps ? */ return l2info.header_len; return l2info.header_len; }
C
tcpdump
1
CVE-2016-4565
https://www.cvedetails.com/cve/CVE-2016-4565/
CWE-264
https://github.com/torvalds/linux/commit/e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3
e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3
IB/security: Restrict use of the write() interface The drivers/infiniband stack uses write() as a replacement for bi-directional ioctl(). This is not safe. There are ways to trigger write calls that result in the return structure that is normally written to user space being shunted off to user specified kernel memory instead. For the immediate repair, detect and deny suspicious accesses to the write API. For long term, update the user space libraries and the kernel API to something that doesn't present the same security vulnerabilities (likely a structured ioctl() interface). The impacted uAPI interfaces are generally only available if hardware from drivers/infiniband is installed in the system. Reported-by: Jann Horn <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> [ Expanded check to all known write() entry points ] Cc: [email protected] Signed-off-by: Doug Ledford <[email protected]>
static void ucma_unlock_files(struct ucma_file *file1, struct ucma_file *file2) { if (file1 < file2) { mutex_unlock(&file2->mut); mutex_unlock(&file1->mut); } else { mutex_unlock(&file1->mut); mutex_unlock(&file2->mut); } }
static void ucma_unlock_files(struct ucma_file *file1, struct ucma_file *file2) { if (file1 < file2) { mutex_unlock(&file2->mut); mutex_unlock(&file1->mut); } else { mutex_unlock(&file1->mut); mutex_unlock(&file2->mut); } }
C
linux
0
CVE-2014-0791
https://www.cvedetails.com/cve/CVE-2014-0791/
CWE-189
https://github.com/sidhpurwala-huzaifa/FreeRDP/commit/e2745807c4c3e0a590c0f69a9b655dc74ebaa03e
e2745807c4c3e0a590c0f69a9b655dc74ebaa03e
Fix possible integer overflow in license_read_scope_list()
BOOL license_read_error_alert_packet(rdpLicense* license, wStream* s) { UINT32 dwErrorCode; UINT32 dwStateTransition; if (Stream_GetRemainingLength(s) < 8) return FALSE; Stream_Read_UINT32(s, dwErrorCode); /* dwErrorCode (4 bytes) */ Stream_Read_UINT32(s, dwStateTransition); /* dwStateTransition (4 bytes) */ if (!license_read_binary_blob(s, license->ErrorInfo)) /* bbErrorInfo */ return FALSE; #ifdef WITH_DEBUG_LICENSE fprintf(stderr, "dwErrorCode: %s, dwStateTransition: %s\n", error_codes[dwErrorCode], state_transitions[dwStateTransition]); #endif if (dwErrorCode == STATUS_VALID_CLIENT) { license->state = LICENSE_STATE_COMPLETED; return TRUE; } switch (dwStateTransition) { case ST_TOTAL_ABORT: license->state = LICENSE_STATE_ABORTED; break; case ST_NO_TRANSITION: license->state = LICENSE_STATE_COMPLETED; break; case ST_RESET_PHASE_TO_START: license->state = LICENSE_STATE_AWAIT; break; case ST_RESEND_LAST_MESSAGE: break; default: break; } return TRUE; }
BOOL license_read_error_alert_packet(rdpLicense* license, wStream* s) { UINT32 dwErrorCode; UINT32 dwStateTransition; if (Stream_GetRemainingLength(s) < 8) return FALSE; Stream_Read_UINT32(s, dwErrorCode); /* dwErrorCode (4 bytes) */ Stream_Read_UINT32(s, dwStateTransition); /* dwStateTransition (4 bytes) */ if (!license_read_binary_blob(s, license->ErrorInfo)) /* bbErrorInfo */ return FALSE; #ifdef WITH_DEBUG_LICENSE fprintf(stderr, "dwErrorCode: %s, dwStateTransition: %s\n", error_codes[dwErrorCode], state_transitions[dwStateTransition]); #endif if (dwErrorCode == STATUS_VALID_CLIENT) { license->state = LICENSE_STATE_COMPLETED; return TRUE; } switch (dwStateTransition) { case ST_TOTAL_ABORT: license->state = LICENSE_STATE_ABORTED; break; case ST_NO_TRANSITION: license->state = LICENSE_STATE_COMPLETED; break; case ST_RESET_PHASE_TO_START: license->state = LICENSE_STATE_AWAIT; break; case ST_RESEND_LAST_MESSAGE: break; default: break; } return TRUE; }
C
FreeRDP
0
CVE-2015-1300
https://www.cvedetails.com/cve/CVE-2015-1300/
CWE-254
https://github.com/chromium/chromium/commit/9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
Use pdf compositor service for printing when OOPIF is enabled When OOPIF is enabled (by site-per-process flag or top-document-isolation feature), use the pdf compositor service for converting PaintRecord to PDF on renderers. In the future, this will make compositing PDF from multiple renderers possible. [email protected] BUG=455764 Change-Id: I3c28f03f4358e4228239fe1a33384f85e7716e8f Reviewed-on: https://chromium-review.googlesource.com/699765 Commit-Queue: Wei Li <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Cr-Commit-Position: refs/heads/master@{#511616}
void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; if (!print_job_.get()) return; if (rfh) { auto msg = base::MakeUnique<PrintMsg_PrintingDone>(rfh->GetRoutingID(), printing_succeeded_); rfh->Send(msg.release()); } registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<PrintJob>(print_job_.get())); print_job_ = nullptr; }
void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; if (!print_job_.get()) return; if (rfh) { auto msg = base::MakeUnique<PrintMsg_PrintingDone>(rfh->GetRoutingID(), printing_succeeded_); rfh->Send(msg.release()); } registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<PrintJob>(print_job_.get())); print_job_ = nullptr; }
C
Chrome
0
CVE-2018-14469
https://www.cvedetails.com/cve/CVE-2018-14469/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/396e94ff55a80d554b1fe46bf107db1e91008d6c
396e94ff55a80d554b1fe46bf107db1e91008d6c
(for 4.9.3) CVE-2018-14469/ISAKMP: Add a missing bounds check In ikev1_n_print() check bounds before trying to fetch the replay detection status. This fixes a buffer over-read discovered by Bhargava Shastry. Add a test using the capture file supplied by the reporter(s).
ikev1_sub_print(netdissect_options *ndo, u_char np, const struct isakmp_gen *ext, const u_char *ep, uint32_t phase, uint32_t doi, uint32_t proto, int depth) { const u_char *cp; int i; struct isakmp_gen e; cp = (const u_char *)ext; while (np) { ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_TCHECK2(*ext, ntohs(e.len)); depth++; ND_PRINT((ndo,"\n")); for (i = 0; i < depth; i++) ND_PRINT((ndo," ")); ND_PRINT((ndo,"(")); cp = ike_sub0_print(ndo, np, ext, ep, phase, doi, proto, depth); ND_PRINT((ndo,")")); depth--; if (cp == NULL) { /* Zero-length subitem */ return NULL; } np = e.np; ext = (const struct isakmp_gen *)cp; } return cp; trunc: ND_PRINT((ndo," [|%s]", NPSTR(np))); return NULL; }
ikev1_sub_print(netdissect_options *ndo, u_char np, const struct isakmp_gen *ext, const u_char *ep, uint32_t phase, uint32_t doi, uint32_t proto, int depth) { const u_char *cp; int i; struct isakmp_gen e; cp = (const u_char *)ext; while (np) { ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_TCHECK2(*ext, ntohs(e.len)); depth++; ND_PRINT((ndo,"\n")); for (i = 0; i < depth; i++) ND_PRINT((ndo," ")); ND_PRINT((ndo,"(")); cp = ike_sub0_print(ndo, np, ext, ep, phase, doi, proto, depth); ND_PRINT((ndo,")")); depth--; if (cp == NULL) { /* Zero-length subitem */ return NULL; } np = e.np; ext = (const struct isakmp_gen *)cp; } return cp; trunc: ND_PRINT((ndo," [|%s]", NPSTR(np))); return NULL; }
C
tcpdump
0
CVE-2016-10066
https://www.cvedetails.com/cve/CVE-2016-10066/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
null
static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { char cache_filename[MaxTextExtent], id[MaxTextExtent], keyword[MaxTextExtent], *options; const unsigned char *p; GeometryInfo geometry_info; Image *image; int c; LinkedListInfo *profiles; MagickBooleanType status; MagickOffsetType offset; MagickStatusType flags; register ssize_t i; size_t depth, length; ssize_t count; StringInfo *profile; unsigned int signature; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) CopyMagickString(cache_filename,image->filename,MaxTextExtent); AppendImageFormat("cache",cache_filename); c=ReadBlobByte(image); if (c == EOF) { image=DestroyImage(image); return((Image *) NULL); } *id='\0'; (void) ResetMagickMemory(keyword,0,sizeof(keyword)); offset=0; do { /* Decode image header; header terminates one character beyond a ':'. */ profiles=(LinkedListInfo *) NULL; length=MaxTextExtent; options=AcquireString((char *) NULL); signature=GetMagickSignature((const StringInfo *) NULL); image->depth=8; image->compression=NoCompression; while ((isgraph(c) != MagickFalse) && (c != (int) ':')) { register char *p; if (c == (int) '{') { char *comment; /* Read comment-- any text between { }. */ length=MaxTextExtent; comment=AcquireString((char *) NULL); for (p=comment; comment != (char *) NULL; p++) { c=ReadBlobByte(image); if (c == (int) '\\') c=ReadBlobByte(image); else if ((c == EOF) || (c == (int) '}')) break; if ((size_t) (p-comment+1) >= length) { *p='\0'; length<<=1; comment=(char *) ResizeQuantumMemory(comment,length+ MaxTextExtent,sizeof(*comment)); if (comment == (char *) NULL) break; p=comment+strlen(comment); } *p=(char) c; } if (comment == (char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); *p='\0'; (void) SetImageProperty(image,"comment",comment); comment=DestroyString(comment); c=ReadBlobByte(image); } else if (isalnum(c) != MagickFalse) { /* Get the keyword. */ p=keyword; do { if (c == (int) '=') break; if ((size_t) (p-keyword) < (MaxTextExtent-1)) *p++=(char) c; c=ReadBlobByte(image); } while (c != EOF); *p='\0'; p=options; while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); if (c == (int) '=') { /* Get the keyword value. */ c=ReadBlobByte(image); while ((c != (int) '}') && (c != EOF)) { if ((size_t) (p-options+1) >= length) { *p='\0'; length<<=1; options=(char *) ResizeQuantumMemory(options,length+ MaxTextExtent,sizeof(*options)); if (options == (char *) NULL) break; p=options+strlen(options); } if (options == (char *) NULL) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') { c=ReadBlobByte(image); if (c == (int) '}') { *p++=(char) c; c=ReadBlobByte(image); } } if (*options != '{') if (isspace((int) ((unsigned char) c)) != 0) break; } } *p='\0'; if (*options == '{') (void) CopyMagickString(options,options+1,strlen(options)); /* Assign a value to the specified keyword. */ switch (*keyword) { case 'b': case 'B': { if (LocaleCompare(keyword,"background-color") == 0) { (void) QueryColorDatabase(options,&image->background_color, exception); break; } if (LocaleCompare(keyword,"blue-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.blue_primary.x=geometry_info.rho; image->chromaticity.blue_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.blue_primary.y= image->chromaticity.blue_primary.x; break; } if (LocaleCompare(keyword,"border-color") == 0) { (void) QueryColorDatabase(options,&image->border_color, exception); break; } (void) SetImageProperty(image,keyword,options); break; } case 'c': case 'C': { if (LocaleCompare(keyword,"class") == 0) { ssize_t storage_class; storage_class=ParseCommandOption(MagickClassOptions, MagickFalse,options); if (storage_class < 0) break; image->storage_class=(ClassType) storage_class; break; } if (LocaleCompare(keyword,"colors") == 0) { image->colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"colorspace") == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions, MagickFalse,options); if (colorspace < 0) break; image->colorspace=(ColorspaceType) colorspace; break; } if (LocaleCompare(keyword,"compression") == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions, MagickFalse,options); if (compression < 0) break; image->compression=(CompressionType) compression; break; } if (LocaleCompare(keyword,"columns") == 0) { image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'd': case 'D': { if (LocaleCompare(keyword,"delay") == 0) { image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"depth") == 0) { image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"dispose") == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse, options); if (dispose < 0) break; image->dispose=(DisposeType) dispose; break; } (void) SetImageProperty(image,keyword,options); break; } case 'e': case 'E': { if (LocaleCompare(keyword,"endian") == 0) { ssize_t endian; endian=ParseCommandOption(MagickEndianOptions,MagickFalse, options); if (endian < 0) break; image->endian=(EndianType) endian; break; } if (LocaleCompare(keyword,"error") == 0) { image->error.mean_error_per_pixel=StringToDouble(options, (char **) NULL); break; } (void) SetImageProperty(image,keyword,options); break; } case 'g': case 'G': { if (LocaleCompare(keyword,"gamma") == 0) { image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,"green-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.green_primary.x=geometry_info.rho; image->chromaticity.green_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.green_primary.y= image->chromaticity.green_primary.x; break; } (void) SetImageProperty(image,keyword,options); break; } case 'i': case 'I': { if (LocaleCompare(keyword,"id") == 0) { (void) CopyMagickString(id,options,MaxTextExtent); break; } if (LocaleCompare(keyword,"iterations") == 0) { image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'm': case 'M': { if (LocaleCompare(keyword,"magick-signature") == 0) { signature=(unsigned int) StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"matte") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,"matte-color") == 0) { (void) QueryColorDatabase(options,&image->matte_color, exception); break; } if (LocaleCompare(keyword,"maximum-error") == 0) { image->error.normalized_maximum_error=StringToDouble( options,(char **) NULL); break; } if (LocaleCompare(keyword,"mean-error") == 0) { image->error.normalized_mean_error=StringToDouble(options, (char **) NULL); break; } if (LocaleCompare(keyword,"montage") == 0) { (void) CloneString(&image->montage,options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'o': case 'O': { if (LocaleCompare(keyword,"opaque") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,"orientation") == 0) { ssize_t orientation; orientation=ParseCommandOption(MagickOrientationOptions, MagickFalse,options); if (orientation < 0) break; image->orientation=(OrientationType) orientation; break; } (void) SetImageProperty(image,keyword,options); break; } case 'p': case 'P': { if (LocaleCompare(keyword,"page") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); break; } if (LocaleCompare(keyword,"pixel-intensity") == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickPixelIntensityOptions, MagickFalse,options); if (intensity < 0) break; image->intensity=(PixelIntensityMethod) intensity; break; } if ((LocaleNCompare(keyword,"profile:",8) == 0) || (LocaleNCompare(keyword,"profile-",8) == 0)) { if (profiles == (LinkedListInfo *) NULL) profiles=NewLinkedList(0); (void) AppendValueToLinkedList(profiles, AcquireString(keyword+8)); profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); (void) SetImageProfile(image,keyword+8,profile); profile=DestroyStringInfo(profile); break; } (void) SetImageProperty(image,keyword,options); break; } case 'q': case 'Q': { if (LocaleCompare(keyword,"quality") == 0) { image->quality=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'r': case 'R': { if (LocaleCompare(keyword,"red-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.red_primary.x=geometry_info.rho; if ((flags & SigmaValue) != 0) image->chromaticity.red_primary.y=geometry_info.sigma; break; } if (LocaleCompare(keyword,"rendering-intent") == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions, MagickFalse,options); if (rendering_intent < 0) break; image->rendering_intent=(RenderingIntent) rendering_intent; break; } if (LocaleCompare(keyword,"resolution") == 0) { flags=ParseGeometry(options,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; break; } if (LocaleCompare(keyword,"rows") == 0) { image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 's': case 'S': { if (LocaleCompare(keyword,"scene") == 0) { image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 't': case 'T': { if (LocaleCompare(keyword,"ticks-per-second") == 0) { image->ticks_per_second=(ssize_t) StringToLong(options); break; } if (LocaleCompare(keyword,"tile-offset") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); } if (LocaleCompare(keyword,"type") == 0) { ssize_t type; type=ParseCommandOption(MagickTypeOptions,MagickFalse, options); if (type < 0) break; image->type=(ImageType) type; break; } (void) SetImageProperty(image,keyword,options); break; } case 'u': case 'U': { if (LocaleCompare(keyword,"units") == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse, options); if (units < 0) break; image->units=(ResolutionType) units; break; } (void) SetImageProperty(image,keyword,options); break; } case 'w': case 'W': { if (LocaleCompare(keyword,"white-point") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.white_point.x=geometry_info.rho; image->chromaticity.white_point.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.white_point.y= image->chromaticity.white_point.x; break; } (void) SetImageProperty(image,keyword,options); break; } default: { (void) SetImageProperty(image,keyword,options); break; } } } else c=ReadBlobByte(image); while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); } options=DestroyString(options); (void) ReadBlobByte(image); /* Verify that required image information is defined. */ if ((LocaleCompare(id,"MagickCache") != 0) || (image->storage_class == UndefinedClass) || (image->compression == UndefinedCompression) || (image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (signature != GetMagickSignature((const StringInfo *) NULL)) ThrowReaderException(CacheError,"IncompatibleAPI"); if (image->montage != (char *) NULL) { register char *p; /* Image directory. */ length=MaxTextExtent; image->directory=AcquireString((char *) NULL); p=image->directory; do { *p='\0'; if ((strlen(image->directory)+MaxTextExtent) >= length) { /* Allocate more memory for the image directory. */ length<<=1; image->directory=(char *) ResizeQuantumMemory(image->directory, length+MaxTextExtent,sizeof(*image->directory)); if (image->directory == (char *) NULL) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); p=image->directory+strlen(image->directory); } c=ReadBlobByte(image); *p++=(char) c; } while (c != (int) '\0'); } if (profiles != (LinkedListInfo *) NULL) { const char *name; const StringInfo *profile; register unsigned char *p; /* Read image profiles. */ ResetLinkedListIterator(profiles); name=(const char *) GetNextValueInLinkedList(profiles); while (name != (const char *) NULL) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { p=GetStringInfoDatum(profile); count=ReadBlob(image,GetStringInfoLength(profile),p); } name=(const char *) GetNextValueInLinkedList(profiles); } profiles=DestroyLinkedList(profiles,RelinquishMagickMemory); } depth=GetImageQuantumDepth(image,MagickFalse); if (image->storage_class == PseudoClass) { /* Create image colormap. */ if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if (image->colors != 0) { size_t packet_size; unsigned char *colormap; /* Read image colormap from file. */ packet_size=(size_t) (3UL*depth/8UL); colormap=(unsigned char *) AcquireQuantumMemory(image->colors, packet_size*sizeof(*colormap)); if (colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,packet_size*image->colors,colormap); if (count != (ssize_t) (packet_size*image->colors)) ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); p=colormap; switch (depth) { default: ThrowReaderException(CorruptImageError, "ImageDepthNotSupported"); case 8: { unsigned char pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushCharPixel(p,&pixel); image->colormap[i].red=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].green=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].blue=ScaleCharToQuantum(pixel); } break; } case 16: { unsigned short pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleShortToQuantum(pixel); } break; } case 32: { unsigned int pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleLongToQuantum(pixel); } break; } } colormap=(unsigned char *) RelinquishMagickMemory(colormap); } } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } /* Attach persistent pixel cache. */ status=PersistPixelCache(image,cache_filename,MagickTrue,&offset,exception); if (status == MagickFalse) ThrowReaderException(CacheError,"UnableToPersistPixelCache"); /* Proceed to next image. */ do { c=ReadBlobByte(image); } while ((isgraph(c) == MagickFalse) && (c != EOF)); if (c != EOF) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (c != EOF); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { char cache_filename[MaxTextExtent], id[MaxTextExtent], keyword[MaxTextExtent], *options; const unsigned char *p; GeometryInfo geometry_info; Image *image; int c; LinkedListInfo *profiles; MagickBooleanType status; MagickOffsetType offset; MagickStatusType flags; register ssize_t i; size_t depth, length; ssize_t count; StringInfo *profile; unsigned int signature; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) CopyMagickString(cache_filename,image->filename,MaxTextExtent); AppendImageFormat("cache",cache_filename); c=ReadBlobByte(image); if (c == EOF) { image=DestroyImage(image); return((Image *) NULL); } *id='\0'; (void) ResetMagickMemory(keyword,0,sizeof(keyword)); offset=0; do { /* Decode image header; header terminates one character beyond a ':'. */ profiles=(LinkedListInfo *) NULL; length=MaxTextExtent; options=AcquireString((char *) NULL); signature=GetMagickSignature((const StringInfo *) NULL); image->depth=8; image->compression=NoCompression; while ((isgraph(c) != MagickFalse) && (c != (int) ':')) { register char *p; if (c == (int) '{') { char *comment; /* Read comment-- any text between { }. */ length=MaxTextExtent; comment=AcquireString((char *) NULL); for (p=comment; comment != (char *) NULL; p++) { c=ReadBlobByte(image); if (c == (int) '\\') c=ReadBlobByte(image); else if ((c == EOF) || (c == (int) '}')) break; if ((size_t) (p-comment+1) >= length) { *p='\0'; length<<=1; comment=(char *) ResizeQuantumMemory(comment,length+ MaxTextExtent,sizeof(*comment)); if (comment == (char *) NULL) break; p=comment+strlen(comment); } *p=(char) c; } if (comment == (char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); *p='\0'; (void) SetImageProperty(image,"comment",comment); comment=DestroyString(comment); c=ReadBlobByte(image); } else if (isalnum(c) != MagickFalse) { /* Get the keyword. */ p=keyword; do { if (c == (int) '=') break; if ((size_t) (p-keyword) < (MaxTextExtent-1)) *p++=(char) c; c=ReadBlobByte(image); } while (c != EOF); *p='\0'; p=options; while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); if (c == (int) '=') { /* Get the keyword value. */ c=ReadBlobByte(image); while ((c != (int) '}') && (c != EOF)) { if ((size_t) (p-options+1) >= length) { *p='\0'; length<<=1; options=(char *) ResizeQuantumMemory(options,length+ MaxTextExtent,sizeof(*options)); if (options == (char *) NULL) break; p=options+strlen(options); } if (options == (char *) NULL) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') { c=ReadBlobByte(image); if (c == (int) '}') { *p++=(char) c; c=ReadBlobByte(image); } } if (*options != '{') if (isspace((int) ((unsigned char) c)) != 0) break; } } *p='\0'; if (*options == '{') (void) CopyMagickString(options,options+1,strlen(options)); /* Assign a value to the specified keyword. */ switch (*keyword) { case 'b': case 'B': { if (LocaleCompare(keyword,"background-color") == 0) { (void) QueryColorDatabase(options,&image->background_color, exception); break; } if (LocaleCompare(keyword,"blue-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.blue_primary.x=geometry_info.rho; image->chromaticity.blue_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.blue_primary.y= image->chromaticity.blue_primary.x; break; } if (LocaleCompare(keyword,"border-color") == 0) { (void) QueryColorDatabase(options,&image->border_color, exception); break; } (void) SetImageProperty(image,keyword,options); break; } case 'c': case 'C': { if (LocaleCompare(keyword,"class") == 0) { ssize_t storage_class; storage_class=ParseCommandOption(MagickClassOptions, MagickFalse,options); if (storage_class < 0) break; image->storage_class=(ClassType) storage_class; break; } if (LocaleCompare(keyword,"colors") == 0) { image->colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"colorspace") == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions, MagickFalse,options); if (colorspace < 0) break; image->colorspace=(ColorspaceType) colorspace; break; } if (LocaleCompare(keyword,"compression") == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions, MagickFalse,options); if (compression < 0) break; image->compression=(CompressionType) compression; break; } if (LocaleCompare(keyword,"columns") == 0) { image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'd': case 'D': { if (LocaleCompare(keyword,"delay") == 0) { image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"depth") == 0) { image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"dispose") == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse, options); if (dispose < 0) break; image->dispose=(DisposeType) dispose; break; } (void) SetImageProperty(image,keyword,options); break; } case 'e': case 'E': { if (LocaleCompare(keyword,"endian") == 0) { ssize_t endian; endian=ParseCommandOption(MagickEndianOptions,MagickFalse, options); if (endian < 0) break; image->endian=(EndianType) endian; break; } if (LocaleCompare(keyword,"error") == 0) { image->error.mean_error_per_pixel=StringToDouble(options, (char **) NULL); break; } (void) SetImageProperty(image,keyword,options); break; } case 'g': case 'G': { if (LocaleCompare(keyword,"gamma") == 0) { image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,"green-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.green_primary.x=geometry_info.rho; image->chromaticity.green_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.green_primary.y= image->chromaticity.green_primary.x; break; } (void) SetImageProperty(image,keyword,options); break; } case 'i': case 'I': { if (LocaleCompare(keyword,"id") == 0) { (void) CopyMagickString(id,options,MaxTextExtent); break; } if (LocaleCompare(keyword,"iterations") == 0) { image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'm': case 'M': { if (LocaleCompare(keyword,"magick-signature") == 0) { signature=(unsigned int) StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"matte") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,"matte-color") == 0) { (void) QueryColorDatabase(options,&image->matte_color, exception); break; } if (LocaleCompare(keyword,"maximum-error") == 0) { image->error.normalized_maximum_error=StringToDouble( options,(char **) NULL); break; } if (LocaleCompare(keyword,"mean-error") == 0) { image->error.normalized_mean_error=StringToDouble(options, (char **) NULL); break; } if (LocaleCompare(keyword,"montage") == 0) { (void) CloneString(&image->montage,options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'o': case 'O': { if (LocaleCompare(keyword,"opaque") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,"orientation") == 0) { ssize_t orientation; orientation=ParseCommandOption(MagickOrientationOptions, MagickFalse,options); if (orientation < 0) break; image->orientation=(OrientationType) orientation; break; } (void) SetImageProperty(image,keyword,options); break; } case 'p': case 'P': { if (LocaleCompare(keyword,"page") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); break; } if (LocaleCompare(keyword,"pixel-intensity") == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickPixelIntensityOptions, MagickFalse,options); if (intensity < 0) break; image->intensity=(PixelIntensityMethod) intensity; break; } if ((LocaleNCompare(keyword,"profile:",8) == 0) || (LocaleNCompare(keyword,"profile-",8) == 0)) { if (profiles == (LinkedListInfo *) NULL) profiles=NewLinkedList(0); (void) AppendValueToLinkedList(profiles, AcquireString(keyword+8)); profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); (void) SetImageProfile(image,keyword+8,profile); profile=DestroyStringInfo(profile); break; } (void) SetImageProperty(image,keyword,options); break; } case 'q': case 'Q': { if (LocaleCompare(keyword,"quality") == 0) { image->quality=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'r': case 'R': { if (LocaleCompare(keyword,"red-primary") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.red_primary.x=geometry_info.rho; if ((flags & SigmaValue) != 0) image->chromaticity.red_primary.y=geometry_info.sigma; break; } if (LocaleCompare(keyword,"rendering-intent") == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions, MagickFalse,options); if (rendering_intent < 0) break; image->rendering_intent=(RenderingIntent) rendering_intent; break; } if (LocaleCompare(keyword,"resolution") == 0) { flags=ParseGeometry(options,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; break; } if (LocaleCompare(keyword,"rows") == 0) { image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 's': case 'S': { if (LocaleCompare(keyword,"scene") == 0) { image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 't': case 'T': { if (LocaleCompare(keyword,"ticks-per-second") == 0) { image->ticks_per_second=(ssize_t) StringToLong(options); break; } if (LocaleCompare(keyword,"tile-offset") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); } if (LocaleCompare(keyword,"type") == 0) { ssize_t type; type=ParseCommandOption(MagickTypeOptions,MagickFalse, options); if (type < 0) break; image->type=(ImageType) type; break; } (void) SetImageProperty(image,keyword,options); break; } case 'u': case 'U': { if (LocaleCompare(keyword,"units") == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse, options); if (units < 0) break; image->units=(ResolutionType) units; break; } (void) SetImageProperty(image,keyword,options); break; } case 'w': case 'W': { if (LocaleCompare(keyword,"white-point") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.white_point.x=geometry_info.rho; image->chromaticity.white_point.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.white_point.y= image->chromaticity.white_point.x; break; } (void) SetImageProperty(image,keyword,options); break; } default: { (void) SetImageProperty(image,keyword,options); break; } } } else c=ReadBlobByte(image); while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); } options=DestroyString(options); (void) ReadBlobByte(image); /* Verify that required image information is defined. */ if ((LocaleCompare(id,"MagickCache") != 0) || (image->storage_class == UndefinedClass) || (image->compression == UndefinedCompression) || (image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (signature != GetMagickSignature((const StringInfo *) NULL)) ThrowReaderException(CacheError,"IncompatibleAPI"); if (image->montage != (char *) NULL) { register char *p; /* Image directory. */ length=MaxTextExtent; image->directory=AcquireString((char *) NULL); p=image->directory; do { *p='\0'; if ((strlen(image->directory)+MaxTextExtent) >= length) { /* Allocate more memory for the image directory. */ length<<=1; image->directory=(char *) ResizeQuantumMemory(image->directory, length+MaxTextExtent,sizeof(*image->directory)); if (image->directory == (char *) NULL) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); p=image->directory+strlen(image->directory); } c=ReadBlobByte(image); *p++=(char) c; } while (c != (int) '\0'); } if (profiles != (LinkedListInfo *) NULL) { const char *name; const StringInfo *profile; register unsigned char *p; /* Read image profiles. */ ResetLinkedListIterator(profiles); name=(const char *) GetNextValueInLinkedList(profiles); while (name != (const char *) NULL) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { p=GetStringInfoDatum(profile); count=ReadBlob(image,GetStringInfoLength(profile),p); } name=(const char *) GetNextValueInLinkedList(profiles); } profiles=DestroyLinkedList(profiles,RelinquishMagickMemory); } depth=GetImageQuantumDepth(image,MagickFalse); if (image->storage_class == PseudoClass) { /* Create image colormap. */ if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if (image->colors != 0) { size_t packet_size; unsigned char *colormap; /* Read image colormap from file. */ packet_size=(size_t) (3UL*depth/8UL); colormap=(unsigned char *) AcquireQuantumMemory(image->colors, packet_size*sizeof(*colormap)); if (colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,packet_size*image->colors,colormap); if (count != (ssize_t) (packet_size*image->colors)) ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); p=colormap; switch (depth) { default: ThrowReaderException(CorruptImageError, "ImageDepthNotSupported"); case 8: { unsigned char pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushCharPixel(p,&pixel); image->colormap[i].red=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].green=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].blue=ScaleCharToQuantum(pixel); } break; } case 16: { unsigned short pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleShortToQuantum(pixel); } break; } case 32: { unsigned int pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleLongToQuantum(pixel); } break; } } colormap=(unsigned char *) RelinquishMagickMemory(colormap); } } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; /* Attach persistent pixel cache. */ status=PersistPixelCache(image,cache_filename,MagickTrue,&offset,exception); if (status == MagickFalse) ThrowReaderException(CacheError,"UnableToPersistPixelCache"); /* Proceed to next image. */ do { c=ReadBlobByte(image); } while ((isgraph(c) == MagickFalse) && (c != EOF)); if (c != EOF) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (c != EOF); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
C
ImageMagick
1
CVE-2014-1700
https://www.cvedetails.com/cve/CVE-2014-1700/
CWE-399
https://github.com/chromium/chromium/commit/d926098e2e2be270c80a5ba25ab8a611b80b8556
d926098e2e2be270c80a5ba25ab8a611b80b8556
Connect WebUSB client interface to the devices app This provides a basic WebUSB client interface in content/renderer. Most of the interface is unimplemented, but this CL hooks up navigator.usb.getDevices() to the browser's Mojo devices app to enumerate available USB devices. BUG=492204 Review URL: https://codereview.chromium.org/1293253002 Cr-Commit-Position: refs/heads/master@{#344881}
void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { ContextMenuParams params = ContextMenuParamsBuilder::Build(data); params.source_type = GetRenderWidget()->context_menu_source_type(); GetRenderWidget()->OnShowHostContextMenu(&params); if (GetRenderWidget()->has_host_context_menu_location()) { params.x = GetRenderWidget()->host_context_menu_location().x(); params.y = GetRenderWidget()->host_context_menu_location().y(); } if (params.src_url.spec().size() > GetMaxURLChars()) params.src_url = GURL(); context_menu_node_ = data.node; #if defined(OS_ANDROID) gfx::Rect start_rect; gfx::Rect end_rect; GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); #endif Send(new FrameHostMsg_ContextMenu(routing_id_, params)); }
void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { ContextMenuParams params = ContextMenuParamsBuilder::Build(data); params.source_type = GetRenderWidget()->context_menu_source_type(); GetRenderWidget()->OnShowHostContextMenu(&params); if (GetRenderWidget()->has_host_context_menu_location()) { params.x = GetRenderWidget()->host_context_menu_location().x(); params.y = GetRenderWidget()->host_context_menu_location().y(); } if (params.src_url.spec().size() > GetMaxURLChars()) params.src_url = GURL(); context_menu_node_ = data.node; #if defined(OS_ANDROID) gfx::Rect start_rect; gfx::Rect end_rect; GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); #endif Send(new FrameHostMsg_ContextMenu(routing_id_, params)); }
C
Chrome
0
CVE-2011-1800
https://www.cvedetails.com/cve/CVE-2011-1800/
CWE-189
https://github.com/chromium/chromium/commit/1777aa6484af15014b8691082a8c3075418786f5
1777aa6484af15014b8691082a8c3075418786f5
[Qt][WK2] Allow transparent WebViews https://bugs.webkit.org/show_bug.cgi?id=80608 Reviewed by Tor Arne Vestbø. Added support for transparentBackground in QQuickWebViewExperimental. This uses the existing drawsTransparentBackground property in WebKit2. Also, changed LayerTreeHostQt to set the contentsOpaque flag when the root layer changes, otherwise the change doesn't take effect. A new API test was added. * UIProcess/API/qt/qquickwebview.cpp: (QQuickWebViewPrivate::setTransparentBackground): (QQuickWebViewPrivate::transparentBackground): (QQuickWebViewExperimental::transparentBackground): (QQuickWebViewExperimental::setTransparentBackground): * UIProcess/API/qt/qquickwebview_p.h: * UIProcess/API/qt/qquickwebview_p_p.h: (QQuickWebViewPrivate): * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: (tst_QQuickWebView): (tst_QQuickWebView::transparentWebViews): * WebProcess/WebPage/qt/LayerTreeHostQt.cpp: (WebKit::LayerTreeHostQt::LayerTreeHostQt): (WebKit::LayerTreeHostQt::setRootCompositingLayer): git-svn-id: svn://svn.chromium.org/blink/trunk@110254 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void QQuickWebView::focusOutEvent(QFocusEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleFocusOutEvent(event); }
void QQuickWebView::focusOutEvent(QFocusEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleFocusOutEvent(event); }
C
Chrome
0
CVE-2017-9060
https://www.cvedetails.com/cve/CVE-2017-9060/
CWE-772
https://git.qemu.org/?p=qemu.git;a=commit;h=dd248ed7e204ee8a1873914e02b8b526e8f1b80d
dd248ed7e204ee8a1873914e02b8b526e8f1b80d
null
static void virtio_gpu_transfer_to_host_2d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_simple_resource *res; int h; uint32_t src_offset, dst_offset, stride; int bpp; pixman_format_code_t format; struct virtio_gpu_transfer_to_host_2d t2d; VIRTIO_GPU_FILL_CMD(t2d); trace_virtio_gpu_cmd_res_xfer_toh_2d(t2d.resource_id); res = virtio_gpu_find_resource(g, t2d.resource_id); if (!res || !res->iov) { qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal resource specified %d\n", __func__, t2d.resource_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; return; } if (t2d.r.x > res->width || t2d.r.y > res->height || t2d.r.width > res->width || t2d.r.height > res->height || t2d.r.x + t2d.r.width > res->width || t2d.r.y + t2d.r.height > res->height) { qemu_log_mask(LOG_GUEST_ERROR, "%s: transfer bounds outside resource" " bounds for resource %d: %d %d %d %d vs %d %d\n", __func__, t2d.resource_id, t2d.r.x, t2d.r.y, t2d.r.width, t2d.r.height, res->width, res->height); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } format = pixman_image_get_format(res->image); bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8; stride = pixman_image_get_stride(res->image); if (t2d.offset || t2d.r.x || t2d.r.y || t2d.r.width != pixman_image_get_width(res->image)) { void *img_data = pixman_image_get_data(res->image); for (h = 0; h < t2d.r.height; h++) { src_offset = t2d.offset + stride * h; dst_offset = (t2d.r.y + h) * stride + (t2d.r.x * bpp); iov_to_buf(res->iov, res->iov_cnt, src_offset, (uint8_t *)img_data + dst_offset, t2d.r.width * bpp); } } else { iov_to_buf(res->iov, res->iov_cnt, 0, pixman_image_get_data(res->image), pixman_image_get_stride(res->image) * pixman_image_get_height(res->image)); } }
static void virtio_gpu_transfer_to_host_2d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_simple_resource *res; int h; uint32_t src_offset, dst_offset, stride; int bpp; pixman_format_code_t format; struct virtio_gpu_transfer_to_host_2d t2d; VIRTIO_GPU_FILL_CMD(t2d); trace_virtio_gpu_cmd_res_xfer_toh_2d(t2d.resource_id); res = virtio_gpu_find_resource(g, t2d.resource_id); if (!res || !res->iov) { qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal resource specified %d\n", __func__, t2d.resource_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; return; } if (t2d.r.x > res->width || t2d.r.y > res->height || t2d.r.width > res->width || t2d.r.height > res->height || t2d.r.x + t2d.r.width > res->width || t2d.r.y + t2d.r.height > res->height) { qemu_log_mask(LOG_GUEST_ERROR, "%s: transfer bounds outside resource" " bounds for resource %d: %d %d %d %d vs %d %d\n", __func__, t2d.resource_id, t2d.r.x, t2d.r.y, t2d.r.width, t2d.r.height, res->width, res->height); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } format = pixman_image_get_format(res->image); bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8; stride = pixman_image_get_stride(res->image); if (t2d.offset || t2d.r.x || t2d.r.y || t2d.r.width != pixman_image_get_width(res->image)) { void *img_data = pixman_image_get_data(res->image); for (h = 0; h < t2d.r.height; h++) { src_offset = t2d.offset + stride * h; dst_offset = (t2d.r.y + h) * stride + (t2d.r.x * bpp); iov_to_buf(res->iov, res->iov_cnt, src_offset, (uint8_t *)img_data + dst_offset, t2d.r.width * bpp); } } else { iov_to_buf(res->iov, res->iov_cnt, 0, pixman_image_get_data(res->image), pixman_image_get_stride(res->image) * pixman_image_get_height(res->image)); } }
C
qemu
0
CVE-2015-8957
https://www.cvedetails.com/cve/CVE-2015-8957/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/78f82d9d1c2944725a279acd573a22168dc6e22a
78f82d9d1c2944725a279acd573a22168dc6e22a
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26838
static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define RMT_EQUAL_RGB 1 #define RMT_NONE 0 #define RMT_RAW 2 #define RT_STANDARD 1 #define RT_ENCODED 2 #define RT_FORMAT_RGB 3 typedef struct _SUNInfo { unsigned int magic, width, height, depth, length, type, maptype, maplength; } SUNInfo; Image *image; int bit; MagickBooleanType status; MagickSizeType number_pixels; register Quantum *q; register ssize_t i, x; register unsigned char *p; size_t bytes_per_line, extent, length; ssize_t count, y; SUNInfo sun_info; unsigned char *sun_data, *sun_pixels; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read SUN raster header. */ (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info)); sun_info.magic=ReadBlobMSBLong(image); do { /* Verify SUN identifier. */ if (sun_info.magic != 0x59a66a95) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); sun_info.width=ReadBlobMSBLong(image); sun_info.height=ReadBlobMSBLong(image); sun_info.depth=ReadBlobMSBLong(image); sun_info.length=ReadBlobMSBLong(image); sun_info.type=ReadBlobMSBLong(image); sun_info.maptype=ReadBlobMSBLong(image); sun_info.maplength=ReadBlobMSBLong(image); extent=sun_info.height*sun_info.width; if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) && (sun_info.type != RT_FORMAT_RGB)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.depth == 0) || (sun_info.depth > 32)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) && (sun_info.maptype != RMT_RAW)) ThrowReaderException(CoderError,"ColormapTypeNotSupported"); image->columns=sun_info.width; image->rows=sun_info.height; image->depth=sun_info.depth <= 8 ? sun_info.depth : MAGICKCORE_QUANTUM_DEPTH; if (sun_info.depth < 24) { size_t one; image->storage_class=PseudoClass; image->colors=sun_info.maplength; one=1; if (sun_info.maptype == RMT_NONE) image->colors=one << sun_info.depth; if (sun_info.maptype == RMT_EQUAL_RGB) image->colors=sun_info.maplength/3; } switch (sun_info.maptype) { case RMT_NONE: { if (sun_info.depth < 24) { /* Create linear color ramp. */ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } break; } case RMT_EQUAL_RGB: { unsigned char *sun_colormap; /* Read SUN raster colormap. */ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors, sizeof(*sun_colormap)); if (sun_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].red=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].green=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap); break; } case RMT_RAW: { unsigned char *sun_colormap; /* Read SUN raster colormap. */ sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength, sizeof(*sun_colormap)); if (sun_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,sun_info.maplength,sun_colormap); if (count != (ssize_t) sun_info.maplength) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap); break; } default: ThrowReaderException(CoderError,"ColormapTypeNotSupported"); } image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait : UndefinedPixelTrait; image->columns=sun_info.width; image->rows=sun_info.height; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) != sun_info.length || !sun_info.length) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); number_pixels=(MagickSizeType) image->columns*image->rows; if ((sun_info.type != RT_ENCODED) && (sun_info.depth >= 8) && ((number_pixels*((sun_info.depth+7)/8)) > sun_info.length)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); bytes_per_line=sun_info.width*sun_info.depth; sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax( sun_info.length,bytes_per_line*sun_info.width),sizeof(*sun_data)); if (sun_data == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=(ssize_t) ReadBlob(image,sun_info.length,sun_data); if (count != (ssize_t) sun_info.length) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); sun_pixels=sun_data; bytes_per_line=0; if (sun_info.type == RT_ENCODED) { size_t height; /* Read run-length encoded raster pixels. */ height=sun_info.height; if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) || ((bytes_per_line/sun_info.depth) != sun_info.width)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); bytes_per_line+=15; bytes_per_line<<=1; if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); bytes_per_line>>=4; sun_pixels=(unsigned char *) AcquireQuantumMemory(height, bytes_per_line*sizeof(*sun_pixels)); if (sun_pixels == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line* height); sun_data=(unsigned char *) RelinquishMagickMemory(sun_data); } /* Convert SUN raster image to pixel packets. */ p=sun_pixels; if (sun_info.depth == 1) for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=7; bit >= 0; bit--) { SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01), q); q+=GetPixelChannels(image); } p++; } if ((image->columns % 8) != 0) { for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--) { SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),q); q+=GetPixelChannels(image); } p++; } if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } else if (image->storage_class == PseudoClass) { if (bytes_per_line == 0) bytes_per_line=image->columns; length=image->rows*(image->columns+image->columns % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length))) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelIndex(image,*p++,q); q+=GetPixelChannels(image); } if ((image->columns % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } } else { size_t bytes_per_pixel; bytes_per_pixel=3; if (image->alpha_trait != UndefinedPixelTrait) bytes_per_pixel++; if (bytes_per_line == 0) bytes_per_line=bytes_per_pixel*image->columns; length=image->rows*(bytes_per_line+image->columns % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length))) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum(*p++),q); if (sun_info.type == RT_STANDARD) { SetPixelBlue(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelRed(image,ScaleCharToQuantum(*p++),q); } else { SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelBlue(image,ScaleCharToQuantum(*p++),q); } if (image->colors != 0) { SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelRed(image,q)].red),q); SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelGreen(image,q)].green),q); SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelBlue(image,q)].blue),q); } q+=GetPixelChannels(image); } if (((bytes_per_pixel*image->columns) % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } } if (image->storage_class == PseudoClass) (void) SyncImage(image,exception); sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; sun_info.magic=ReadBlobMSBLong(image); if (sun_info.magic == 0x59a66a95) { /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (sun_info.magic == 0x59a66a95); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define RMT_EQUAL_RGB 1 #define RMT_NONE 0 #define RMT_RAW 2 #define RT_STANDARD 1 #define RT_ENCODED 2 #define RT_FORMAT_RGB 3 typedef struct _SUNInfo { unsigned int magic, width, height, depth, length, type, maptype, maplength; } SUNInfo; Image *image; int bit; MagickBooleanType status; MagickSizeType number_pixels; register Quantum *q; register ssize_t i, x; register unsigned char *p; size_t bytes_per_line, extent, length; ssize_t count, y; SUNInfo sun_info; unsigned char *sun_data, *sun_pixels; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read SUN raster header. */ (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info)); sun_info.magic=ReadBlobMSBLong(image); do { /* Verify SUN identifier. */ if (sun_info.magic != 0x59a66a95) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); sun_info.width=ReadBlobMSBLong(image); sun_info.height=ReadBlobMSBLong(image); sun_info.depth=ReadBlobMSBLong(image); sun_info.length=ReadBlobMSBLong(image); sun_info.type=ReadBlobMSBLong(image); sun_info.maptype=ReadBlobMSBLong(image); sun_info.maplength=ReadBlobMSBLong(image); extent=sun_info.height*sun_info.width; if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) && (sun_info.type != RT_FORMAT_RGB)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.depth == 0) || (sun_info.depth > 32)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) && (sun_info.maptype != RMT_RAW)) ThrowReaderException(CoderError,"ColormapTypeNotSupported"); image->columns=sun_info.width; image->rows=sun_info.height; image->depth=sun_info.depth <= 8 ? sun_info.depth : MAGICKCORE_QUANTUM_DEPTH; if (sun_info.depth < 24) { size_t one; image->storage_class=PseudoClass; image->colors=sun_info.maplength; one=1; if (sun_info.maptype == RMT_NONE) image->colors=one << sun_info.depth; if (sun_info.maptype == RMT_EQUAL_RGB) image->colors=sun_info.maplength/3; } switch (sun_info.maptype) { case RMT_NONE: { if (sun_info.depth < 24) { /* Create linear color ramp. */ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } break; } case RMT_EQUAL_RGB: { unsigned char *sun_colormap; /* Read SUN raster colormap. */ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors, sizeof(*sun_colormap)); if (sun_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].red=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].green=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); count=ReadBlob(image,image->colors,sun_colormap); if (count != (ssize_t) image->colors) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum( sun_colormap[i]); sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap); break; } case RMT_RAW: { unsigned char *sun_colormap; /* Read SUN raster colormap. */ sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength, sizeof(*sun_colormap)); if (sun_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,sun_info.maplength,sun_colormap); if (count != (ssize_t) sun_info.maplength) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap); break; } default: ThrowReaderException(CoderError,"ColormapTypeNotSupported"); } image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait : UndefinedPixelTrait; image->columns=sun_info.width; image->rows=sun_info.height; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) != sun_info.length || !sun_info.length) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); number_pixels=(MagickSizeType) image->columns*image->rows; if ((sun_info.type != RT_ENCODED) && (sun_info.depth >= 8) && ((number_pixels*((sun_info.depth+7)/8)) > sun_info.length)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); sun_data=(unsigned char *) AcquireQuantumMemory((size_t) sun_info.length, sizeof(*sun_data)); if (sun_data == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=(ssize_t) ReadBlob(image,sun_info.length,sun_data); if (count != (ssize_t) sun_info.length) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); sun_pixels=sun_data; bytes_per_line=0; if (sun_info.type == RT_ENCODED) { size_t height; /* Read run-length encoded raster pixels. */ height=sun_info.height; bytes_per_line=sun_info.width*sun_info.depth; if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) || ((bytes_per_line/sun_info.depth) != sun_info.width)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); bytes_per_line+=15; bytes_per_line<<=1; if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); bytes_per_line>>=4; sun_pixels=(unsigned char *) AcquireQuantumMemory(height, bytes_per_line*sizeof(*sun_pixels)); if (sun_pixels == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line* height); sun_data=(unsigned char *) RelinquishMagickMemory(sun_data); } /* Convert SUN raster image to pixel packets. */ p=sun_pixels; if (sun_info.depth == 1) for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=7; bit >= 0; bit--) { SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01), q); q+=GetPixelChannels(image); } p++; } if ((image->columns % 8) != 0) { for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--) { SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),q); q+=GetPixelChannels(image); } p++; } if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } else if (image->storage_class == PseudoClass) { if (bytes_per_line == 0) bytes_per_line=image->columns; length=image->rows*(image->columns+image->columns % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length))) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelIndex(image,*p++,q); q+=GetPixelChannels(image); } if ((image->columns % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } } else { size_t bytes_per_pixel; bytes_per_pixel=3; if (image->alpha_trait != UndefinedPixelTrait) bytes_per_pixel++; if (bytes_per_line == 0) bytes_per_line=bytes_per_pixel*image->columns; length=image->rows*(bytes_per_line+image->columns % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length))) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum(*p++),q); if (sun_info.type == RT_STANDARD) { SetPixelBlue(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelRed(image,ScaleCharToQuantum(*p++),q); } else { SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelBlue(image,ScaleCharToQuantum(*p++),q); } if (image->colors != 0) { SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelRed(image,q)].red),q); SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelGreen(image,q)].green),q); SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t) GetPixelBlue(image,q)].blue),q); } q+=GetPixelChannels(image); } if (((bytes_per_pixel*image->columns) % 2) != 0) p++; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } } if (image->storage_class == PseudoClass) (void) SyncImage(image,exception); sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; sun_info.magic=ReadBlobMSBLong(image); if (sun_info.magic == 0x59a66a95) { /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (sun_info.magic == 0x59a66a95); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
C
ImageMagick
1
CVE-2016-2476
https://www.cvedetails.com/cve/CVE-2016-2476/
CWE-119
https://android.googlesource.com/platform/frameworks/av/+/295c883fe3105b19bcd0f9e07d54c6b589fc5bff
295c883fe3105b19bcd0f9e07d54c6b589fc5bff
DO NOT MERGE Verify OMX buffer sizes prior to access Bug: 27207275 Change-Id: I4412825d1ee233d993af0a67708bea54304ff62d
OMX_ERRORTYPE SoftMPEG4Encoder::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamVideoBitrate: { OMX_VIDEO_PARAM_BITRATETYPE *bitRate = (OMX_VIDEO_PARAM_BITRATETYPE *) params; if (!isValidOMXParam(bitRate)) { return OMX_ErrorBadParameter; } if (bitRate->nPortIndex != 1) { return OMX_ErrorUndefined; } bitRate->eControlRate = OMX_Video_ControlRateVariable; bitRate->nTargetBitrate = mBitrate; return OMX_ErrorNone; } case OMX_IndexParamVideoH263: { OMX_VIDEO_PARAM_H263TYPE *h263type = (OMX_VIDEO_PARAM_H263TYPE *)params; if (!isValidOMXParam(h263type)) { return OMX_ErrorBadParameter; } if (h263type->nPortIndex != 1) { return OMX_ErrorUndefined; } h263type->nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP); h263type->eProfile = OMX_VIDEO_H263ProfileBaseline; h263type->eLevel = OMX_VIDEO_H263Level45; h263type->bPLUSPTYPEAllowed = OMX_FALSE; h263type->bForceRoundingTypeToZero = OMX_FALSE; h263type->nPictureHeaderRepetition = 0; h263type->nGOBHeaderInterval = 0; return OMX_ErrorNone; } case OMX_IndexParamVideoMpeg4: { OMX_VIDEO_PARAM_MPEG4TYPE *mpeg4type = (OMX_VIDEO_PARAM_MPEG4TYPE *)params; if (!isValidOMXParam(mpeg4type)) { return OMX_ErrorBadParameter; } if (mpeg4type->nPortIndex != 1) { return OMX_ErrorUndefined; } mpeg4type->eProfile = OMX_VIDEO_MPEG4ProfileCore; mpeg4type->eLevel = OMX_VIDEO_MPEG4Level2; mpeg4type->nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP); mpeg4type->nBFrames = 0; mpeg4type->nIDCVLCThreshold = 0; mpeg4type->bACPred = OMX_TRUE; mpeg4type->nMaxPacketSize = 256; mpeg4type->nTimeIncRes = 1000; mpeg4type->nHeaderExtension = 0; mpeg4type->bReversibleVLC = OMX_FALSE; return OMX_ErrorNone; } default: return SoftVideoEncoderOMXComponent::internalGetParameter(index, params); } }
OMX_ERRORTYPE SoftMPEG4Encoder::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamVideoBitrate: { OMX_VIDEO_PARAM_BITRATETYPE *bitRate = (OMX_VIDEO_PARAM_BITRATETYPE *) params; if (bitRate->nPortIndex != 1) { return OMX_ErrorUndefined; } bitRate->eControlRate = OMX_Video_ControlRateVariable; bitRate->nTargetBitrate = mBitrate; return OMX_ErrorNone; } case OMX_IndexParamVideoH263: { OMX_VIDEO_PARAM_H263TYPE *h263type = (OMX_VIDEO_PARAM_H263TYPE *)params; if (h263type->nPortIndex != 1) { return OMX_ErrorUndefined; } h263type->nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP); h263type->eProfile = OMX_VIDEO_H263ProfileBaseline; h263type->eLevel = OMX_VIDEO_H263Level45; h263type->bPLUSPTYPEAllowed = OMX_FALSE; h263type->bForceRoundingTypeToZero = OMX_FALSE; h263type->nPictureHeaderRepetition = 0; h263type->nGOBHeaderInterval = 0; return OMX_ErrorNone; } case OMX_IndexParamVideoMpeg4: { OMX_VIDEO_PARAM_MPEG4TYPE *mpeg4type = (OMX_VIDEO_PARAM_MPEG4TYPE *)params; if (mpeg4type->nPortIndex != 1) { return OMX_ErrorUndefined; } mpeg4type->eProfile = OMX_VIDEO_MPEG4ProfileCore; mpeg4type->eLevel = OMX_VIDEO_MPEG4Level2; mpeg4type->nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP); mpeg4type->nBFrames = 0; mpeg4type->nIDCVLCThreshold = 0; mpeg4type->bACPred = OMX_TRUE; mpeg4type->nMaxPacketSize = 256; mpeg4type->nTimeIncRes = 1000; mpeg4type->nHeaderExtension = 0; mpeg4type->bReversibleVLC = OMX_FALSE; return OMX_ErrorNone; } default: return SoftVideoEncoderOMXComponent::internalGetParameter(index, params); } }
C
Android
1