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-2011-3055 | https://www.cvedetails.com/cve/CVE-2011-3055/ | null | https://github.com/chromium/chromium/commit/e9372a1bfd3588a80fcf49aa07321f0971dd6091 | e9372a1bfd3588a80fcf49aa07321f0971dd6091 | [V8] Pass Isolate to throwNotEnoughArgumentsError()
https://bugs.webkit.org/show_bug.cgi?id=86983
Reviewed by Adam Barth.
The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to throwNotEnoughArgumentsError().
No tests. No change in behavior.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateArgumentsCountCheck):
(GenerateEventConstructorCallback):
* bindings/scripts/test/V8/V8Float64Array.cpp:
(WebCore::Float64ArrayV8Internal::fooCallback):
* bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
(WebCore::TestActiveDOMObjectV8Internal::excitingFunctionCallback):
(WebCore::TestActiveDOMObjectV8Internal::postMessageCallback):
* bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
(WebCore::TestCustomNamedGetterV8Internal::anotherFunctionCallback):
* bindings/scripts/test/V8/V8TestEventConstructor.cpp:
(WebCore::V8TestEventConstructor::constructorCallback):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore::TestEventTargetV8Internal::itemCallback):
(WebCore::TestEventTargetV8Internal::dispatchEventCallback):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::TestInterfaceV8Internal::supplementalMethod2Callback):
(WebCore::V8TestInterface::constructorCallback):
* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
(WebCore::TestMediaQueryListListenerV8Internal::methodCallback):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructorConstructorCallback):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::voidMethodWithArgsCallback):
(WebCore::TestObjV8Internal::intMethodWithArgsCallback):
(WebCore::TestObjV8Internal::objMethodWithArgsCallback):
(WebCore::TestObjV8Internal::methodWithSequenceArgCallback):
(WebCore::TestObjV8Internal::methodReturningSequenceCallback):
(WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback):
(WebCore::TestObjV8Internal::serializedValueCallback):
(WebCore::TestObjV8Internal::idbKeyCallback):
(WebCore::TestObjV8Internal::optionsObjectCallback):
(WebCore::TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback):
(WebCore::TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):
(WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
(WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
(WebCore::TestObjV8Internal::overloadedMethod1Callback):
(WebCore::TestObjV8Internal::overloadedMethod2Callback):
(WebCore::TestObjV8Internal::overloadedMethod3Callback):
(WebCore::TestObjV8Internal::overloadedMethod4Callback):
(WebCore::TestObjV8Internal::overloadedMethod5Callback):
(WebCore::TestObjV8Internal::overloadedMethod6Callback):
(WebCore::TestObjV8Internal::overloadedMethod7Callback):
(WebCore::TestObjV8Internal::overloadedMethod11Callback):
(WebCore::TestObjV8Internal::overloadedMethod12Callback):
(WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback):
(WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback):
(WebCore::TestObjV8Internal::convert1Callback):
(WebCore::TestObjV8Internal::convert2Callback):
(WebCore::TestObjV8Internal::convert3Callback):
(WebCore::TestObjV8Internal::convert4Callback):
(WebCore::TestObjV8Internal::convert5Callback):
(WebCore::TestObjV8Internal::strictFunctionCallback):
(WebCore::V8TestObj::constructorCallback):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
(WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
* bindings/v8/ScriptController.cpp:
(WebCore::setValueAndClosePopupCallback):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::throwNotEnoughArgumentsError):
* bindings/v8/V8Proxy.h:
(V8Proxy):
* bindings/v8/custom/V8AudioContextCustom.cpp:
(WebCore::V8AudioContext::constructorCallback):
* bindings/v8/custom/V8DataViewCustom.cpp:
(WebCore::V8DataView::getInt8Callback):
(WebCore::V8DataView::getUint8Callback):
(WebCore::V8DataView::setInt8Callback):
(WebCore::V8DataView::setUint8Callback):
* bindings/v8/custom/V8DirectoryEntryCustom.cpp:
(WebCore::V8DirectoryEntry::getDirectoryCallback):
(WebCore::V8DirectoryEntry::getFileCallback):
* bindings/v8/custom/V8IntentConstructor.cpp:
(WebCore::V8Intent::constructorCallback):
* bindings/v8/custom/V8SVGLengthCustom.cpp:
(WebCore::V8SVGLength::convertToSpecifiedUnitsCallback):
* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
(WebCore::getObjectParameter):
(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
(WebCore::V8WebGLRenderingContext::getExtensionCallback):
(WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
(WebCore::V8WebGLRenderingContext::getParameterCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
(WebCore::vertexAttribAndUniformHelperf):
(WebCore::uniformHelperi):
(WebCore::uniformMatrixHelper):
* bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
(WebCore::V8WebKitMutationObserver::constructorCallback):
(WebCore::V8WebKitMutationObserver::observeCallback):
* bindings/v8/custom/V8WebSocketCustom.cpp:
(WebCore::V8WebSocket::constructorCallback):
(WebCore::V8WebSocket::sendCallback):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::openCallback):
git-svn-id: svn://svn.chromium.org/blink/trunk@117736 bbb929c8-8fbe-4397-9dbb-9b2b20218538 | void ScriptController::clearWindowShell(bool)
{
m_proxy->clearForNavigation();
}
| void ScriptController::clearWindowShell(bool)
{
m_proxy->clearForNavigation();
}
| C | Chrome | 0 |
CVE-2011-3906 | https://www.cvedetails.com/cve/CVE-2011-3906/ | CWE-119 | https://github.com/chromium/chromium/commit/60c9d8a39e4aa78dd51c236bd1b2c4f17c9d27fe | 60c9d8a39e4aa78dd51c236bd1b2c4f17c9d27fe | Text Autosizing: Counteract funky window sizing on Android.
https://bugs.webkit.org/show_bug.cgi?id=98809
Reviewed by Adam Barth.
In Chrome for Android, the window sizes provided to WebCore are
currently in physical screen pixels instead of
device-scale-adjusted units. For example window width on a
Galaxy Nexus is 720 instead of 360. Text autosizing expects
device-independent pixels. When Chrome for Android cuts over to
the new coordinate space, it will be tied to the setting
applyPageScaleFactorInCompositor.
No new tests.
* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::processSubtree):
git-svn-id: svn://svn.chromium.org/blink/trunk@130866 bbb929c8-8fbe-4397-9dbb-9b2b20218538 | bool TextAutosizer::isAutosizingContainer(const RenderObject* renderer)
{
return renderer->isRenderBlock() && !renderer->isInline() && !renderer->isListItem();
}
| bool TextAutosizer::isAutosizingContainer(const RenderObject* renderer)
{
return renderer->isRenderBlock() && !renderer->isInline() && !renderer->isListItem();
}
| C | Chrome | 0 |
CVE-2015-8215 | https://www.cvedetails.com/cve/CVE-2015-8215/ | CWE-20 | https://github.com/torvalds/linux/commit/77751427a1ff25b27d47a4c36b12c3c8667855ac | 77751427a1ff25b27d47a4c36b12c3c8667855ac | ipv6: addrconf: validate new MTU before applying it
Currently we don't check if the new MTU is valid or not and this allows
one to configure a smaller than minimum allowed by RFCs or even bigger
than interface own MTU, which is a problem as it may lead to packet
drops.
If you have a daemon like NetworkManager running, this may be exploited
by remote attackers by forging RA packets with an invalid MTU, possibly
leading to a DoS. (NetworkManager currently only validates for values
too small, but not for too big ones.)
The fix is just to make sure the new value is valid. That is, between
IPV6_MIN_MTU and interface's MTU.
Note that similar check is already performed at
ndisc_router_discovery(), for when kernel itself parses the RA.
Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: Sabrina Dubroca <[email protected]>
Signed-off-by: David S. Miller <[email protected]> | static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
{
unsigned long rand_num;
struct inet6_dev *idev = ifp->idev;
if (ifp->flags & IFA_F_OPTIMISTIC)
rand_num = 0;
else
rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
ifp->dad_probes = idev->cnf.dad_transmits;
addrconf_mod_dad_work(ifp, rand_num);
}
| static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
{
unsigned long rand_num;
struct inet6_dev *idev = ifp->idev;
if (ifp->flags & IFA_F_OPTIMISTIC)
rand_num = 0;
else
rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
ifp->dad_probes = idev->cnf.dad_transmits;
addrconf_mod_dad_work(ifp, rand_num);
}
| C | linux | 0 |
CVE-2017-9059 | https://www.cvedetails.com/cve/CVE-2017-9059/ | CWE-404 | https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1 | c70422f760c120480fee4de6c38804c72aa26bc1 | Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux
Pull nfsd updates from Bruce Fields:
"Another RDMA update from Chuck Lever, and a bunch of miscellaneous
bugfixes"
* tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits)
nfsd: Fix up the "supattr_exclcreat" attributes
nfsd: encoders mustn't use unitialized values in error cases
nfsd: fix undefined behavior in nfsd4_layout_verify
lockd: fix lockd shutdown race
NFSv4: Fix callback server shutdown
SUNRPC: Refactor svc_set_num_threads()
NFSv4.x/callback: Create the callback service through svc_create_pooled
lockd: remove redundant check on block
svcrdma: Clean out old XDR encoders
svcrdma: Remove the req_map cache
svcrdma: Remove unused RDMA Write completion handler
svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt
svcrdma: Clean up RPC-over-RDMA backchannel reply processing
svcrdma: Report Write/Reply chunk overruns
svcrdma: Clean up RDMA_ERROR path
svcrdma: Use rdma_rw API in RPC reply path
svcrdma: Introduce local rdma_rw API helpers
svcrdma: Clean up svc_rdma_get_inv_rkey()
svcrdma: Add helper to save pages under I/O
svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT
... | nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
{
struct xdr_stream *xdr = &resp->xdr;
__be32 *p;
if (!nfserr) {
p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE);
if (!p)
return nfserr_resource;
p = xdr_encode_opaque_fixed(p, commit->co_verf.data,
NFS4_VERIFIER_SIZE);
}
return nfserr;
}
| nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
{
struct xdr_stream *xdr = &resp->xdr;
__be32 *p;
if (!nfserr) {
p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE);
if (!p)
return nfserr_resource;
p = xdr_encode_opaque_fixed(p, commit->co_verf.data,
NFS4_VERIFIER_SIZE);
}
return nfserr;
}
| C | linux | 0 |
null | null | null | https://github.com/chromium/chromium/commit/6834289784ed45b5524de0fb7ef43ae283b0d6d3 | 6834289784ed45b5524de0fb7ef43ae283b0d6d3 | Output silence if the MediaElementAudioSourceNode has a different origin
See http://webaudio.github.io/web-audio-api/#security-with-mediaelementaudiosourcenode-and-cross-origin-resources
Two new tests added for the same origin and a cross origin source.
BUG=313939
Review URL: https://codereview.chromium.org/520433002
git-svn-id: svn://svn.chromium.org/blink/trunk@189527 bbb929c8-8fbe-4397-9dbb-9b2b20218538 | void AudioContext::derefUnfinishedSourceNodes()
{
ASSERT(isMainThread());
for (unsigned i = 0; i < m_referencedNodes.size(); ++i)
m_referencedNodes.at(i)->breakConnection();
m_referencedNodes.clear();
}
| void AudioContext::derefUnfinishedSourceNodes()
{
ASSERT(isMainThread());
for (unsigned i = 0; i < m_referencedNodes.size(); ++i)
m_referencedNodes.at(i)->breakConnection();
m_referencedNodes.clear();
}
| C | Chrome | 0 |
CVE-2018-14568 | https://www.cvedetails.com/cve/CVE-2018-14568/ | null | https://github.com/OISF/suricata/pull/3428/commits/843d0b7a10bb45627f94764a6c5d468a24143345 | 843d0b7a10bb45627f94764a6c5d468a24143345 | stream: support RST getting lost/ignored
In case of a valid RST on a SYN, the state is switched to 'TCP_CLOSED'.
However, the target of the RST may not have received it, or may not
have accepted it. Also, the RST may have been injected, so the supposed
sender may not actually be aware of the RST that was sent in it's name.
In this case the previous behavior was to switch the state to CLOSED and
accept no further TCP updates or stream reassembly.
This patch changes this. It still switches the state to CLOSED, as this
is by far the most likely to be correct. However, it will reconsider
the state if the receiver continues to talk.
To do this on each state change the previous state will be recorded in
TcpSession::pstate. If a non-RST packet is received after a RST, this
TcpSession::pstate is used to try to continue the conversation.
If the (supposed) sender of the RST is also continueing the conversation
as normal, it's highly likely it didn't send the RST. In this case
a stream event is generated.
Ticket: #2501
Reported-By: Kirill Shipulin | TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
{
SCEnter();
StreamTcpThread *stt = SCMalloc(sizeof(StreamTcpThread));
if (unlikely(stt == NULL))
SCReturnInt(TM_ECODE_FAILED);
memset(stt, 0, sizeof(StreamTcpThread));
stt->ssn_pool_id = -1;
*data = (void *)stt;
stt->counter_tcp_sessions = StatsRegisterCounter("tcp.sessions", tv);
stt->counter_tcp_ssn_memcap = StatsRegisterCounter("tcp.ssn_memcap_drop", tv);
stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", tv);
stt->counter_tcp_pseudo_failed = StatsRegisterCounter("tcp.pseudo_failed", tv);
stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", tv);
stt->counter_tcp_no_flow = StatsRegisterCounter("tcp.no_flow", tv);
stt->counter_tcp_syn = StatsRegisterCounter("tcp.syn", tv);
stt->counter_tcp_synack = StatsRegisterCounter("tcp.synack", tv);
stt->counter_tcp_rst = StatsRegisterCounter("tcp.rst", tv);
stt->counter_tcp_midstream_pickups = StatsRegisterCounter("tcp.midstream_pickups", tv);
/* init reassembly ctx */
stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv);
if (stt->ra_ctx == NULL)
SCReturnInt(TM_ECODE_FAILED);
stt->ra_ctx->counter_tcp_segment_memcap = StatsRegisterCounter("tcp.segment_memcap_drop", tv);
stt->ra_ctx->counter_tcp_stream_depth = StatsRegisterCounter("tcp.stream_depth_reached", tv);
stt->ra_ctx->counter_tcp_reass_gap = StatsRegisterCounter("tcp.reassembly_gap", tv);
stt->ra_ctx->counter_tcp_reass_overlap = StatsRegisterCounter("tcp.overlap", tv);
stt->ra_ctx->counter_tcp_reass_overlap_diff_data = StatsRegisterCounter("tcp.overlap_diff_data", tv);
stt->ra_ctx->counter_tcp_reass_data_normal_fail = StatsRegisterCounter("tcp.insert_data_normal_fail", tv);
stt->ra_ctx->counter_tcp_reass_data_overlap_fail = StatsRegisterCounter("tcp.insert_data_overlap_fail", tv);
stt->ra_ctx->counter_tcp_reass_list_fail = StatsRegisterCounter("tcp.insert_list_fail", tv);
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);
SCMutexLock(&ssn_pool_mutex);
if (ssn_pool == NULL) {
ssn_pool = PoolThreadInit(1, /* thread */
0, /* unlimited */
stream_config.prealloc_sessions,
sizeof(TcpSession),
StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL,
StreamTcpSessionPoolCleanup, NULL);
stt->ssn_pool_id = 0;
SCLogDebug("pool size %d, thread ssn_pool_id %d", PoolThreadSize(ssn_pool), stt->ssn_pool_id);
} else {
/* grow ssn_pool until we have a element for our thread id */
stt->ssn_pool_id = PoolThreadGrow(ssn_pool,
0, /* unlimited */
stream_config.prealloc_sessions,
sizeof(TcpSession),
StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL,
StreamTcpSessionPoolCleanup, NULL);
SCLogDebug("pool size %d, thread ssn_pool_id %d", PoolThreadSize(ssn_pool), stt->ssn_pool_id);
}
SCMutexUnlock(&ssn_pool_mutex);
if (stt->ssn_pool_id < 0 || ssn_pool == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "failed to setup/expand stream session pool. Expand stream.memcap?");
SCReturnInt(TM_ECODE_FAILED);
}
SCReturnInt(TM_ECODE_OK);
}
| TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
{
SCEnter();
StreamTcpThread *stt = SCMalloc(sizeof(StreamTcpThread));
if (unlikely(stt == NULL))
SCReturnInt(TM_ECODE_FAILED);
memset(stt, 0, sizeof(StreamTcpThread));
stt->ssn_pool_id = -1;
*data = (void *)stt;
stt->counter_tcp_sessions = StatsRegisterCounter("tcp.sessions", tv);
stt->counter_tcp_ssn_memcap = StatsRegisterCounter("tcp.ssn_memcap_drop", tv);
stt->counter_tcp_pseudo = StatsRegisterCounter("tcp.pseudo", tv);
stt->counter_tcp_pseudo_failed = StatsRegisterCounter("tcp.pseudo_failed", tv);
stt->counter_tcp_invalid_checksum = StatsRegisterCounter("tcp.invalid_checksum", tv);
stt->counter_tcp_no_flow = StatsRegisterCounter("tcp.no_flow", tv);
stt->counter_tcp_syn = StatsRegisterCounter("tcp.syn", tv);
stt->counter_tcp_synack = StatsRegisterCounter("tcp.synack", tv);
stt->counter_tcp_rst = StatsRegisterCounter("tcp.rst", tv);
stt->counter_tcp_midstream_pickups = StatsRegisterCounter("tcp.midstream_pickups", tv);
/* init reassembly ctx */
stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv);
if (stt->ra_ctx == NULL)
SCReturnInt(TM_ECODE_FAILED);
stt->ra_ctx->counter_tcp_segment_memcap = StatsRegisterCounter("tcp.segment_memcap_drop", tv);
stt->ra_ctx->counter_tcp_stream_depth = StatsRegisterCounter("tcp.stream_depth_reached", tv);
stt->ra_ctx->counter_tcp_reass_gap = StatsRegisterCounter("tcp.reassembly_gap", tv);
stt->ra_ctx->counter_tcp_reass_overlap = StatsRegisterCounter("tcp.overlap", tv);
stt->ra_ctx->counter_tcp_reass_overlap_diff_data = StatsRegisterCounter("tcp.overlap_diff_data", tv);
stt->ra_ctx->counter_tcp_reass_data_normal_fail = StatsRegisterCounter("tcp.insert_data_normal_fail", tv);
stt->ra_ctx->counter_tcp_reass_data_overlap_fail = StatsRegisterCounter("tcp.insert_data_overlap_fail", tv);
stt->ra_ctx->counter_tcp_reass_list_fail = StatsRegisterCounter("tcp.insert_list_fail", tv);
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);
SCMutexLock(&ssn_pool_mutex);
if (ssn_pool == NULL) {
ssn_pool = PoolThreadInit(1, /* thread */
0, /* unlimited */
stream_config.prealloc_sessions,
sizeof(TcpSession),
StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL,
StreamTcpSessionPoolCleanup, NULL);
stt->ssn_pool_id = 0;
SCLogDebug("pool size %d, thread ssn_pool_id %d", PoolThreadSize(ssn_pool), stt->ssn_pool_id);
} else {
/* grow ssn_pool until we have a element for our thread id */
stt->ssn_pool_id = PoolThreadGrow(ssn_pool,
0, /* unlimited */
stream_config.prealloc_sessions,
sizeof(TcpSession),
StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL,
StreamTcpSessionPoolCleanup, NULL);
SCLogDebug("pool size %d, thread ssn_pool_id %d", PoolThreadSize(ssn_pool), stt->ssn_pool_id);
}
SCMutexUnlock(&ssn_pool_mutex);
if (stt->ssn_pool_id < 0 || ssn_pool == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "failed to setup/expand stream session pool. Expand stream.memcap?");
SCReturnInt(TM_ECODE_FAILED);
}
SCReturnInt(TM_ECODE_OK);
}
| C | suricata | 0 |
null | null | null | https://github.com/chromium/chromium/commit/aac449e7154720b895ff1e7f3497c2ce95ae1a5a | aac449e7154720b895ff1e7f3497c2ce95ae1a5a | POSIX: make sure that we never pass directory descriptors into the sandbox.
BUG=43304
http://codereview.chromium.org/2733011/show
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49446 0039d316-1c4b-4281-b951-d872f2087c98 | void Channel::ChannelImpl::OnFileCanWriteWithoutBlocking(int fd) {
if (!ProcessOutgoingMessages()) {
Close();
listener_->OnChannelError();
}
}
| void Channel::ChannelImpl::OnFileCanWriteWithoutBlocking(int fd) {
if (!ProcessOutgoingMessages()) {
Close();
listener_->OnChannelError();
}
}
| 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 TestingAutomationProvider::ClickAppModalDialogButton(int button,
bool* success) {
*success = false;
NativeAppModalDialog* native_dialog =
AppModalDialogQueue::GetInstance()->active_dialog()->native_dialog();
if (native_dialog &&
(native_dialog->GetAppModalDialogButtons() & button) == button) {
if ((button & ui::DIALOG_BUTTON_OK) == ui::DIALOG_BUTTON_OK) {
native_dialog->AcceptAppModalDialog();
*success = true;
}
if ((button & ui::DIALOG_BUTTON_CANCEL) == ui::DIALOG_BUTTON_CANCEL) {
DCHECK(!*success) << "invalid param, OK and CANCEL specified";
native_dialog->CancelAppModalDialog();
*success = true;
}
}
}
| void TestingAutomationProvider::ClickAppModalDialogButton(int button,
bool* success) {
*success = false;
NativeAppModalDialog* native_dialog =
AppModalDialogQueue::GetInstance()->active_dialog()->native_dialog();
if (native_dialog &&
(native_dialog->GetAppModalDialogButtons() & button) == button) {
if ((button & ui::DIALOG_BUTTON_OK) == ui::DIALOG_BUTTON_OK) {
native_dialog->AcceptAppModalDialog();
*success = true;
}
if ((button & ui::DIALOG_BUTTON_CANCEL) == ui::DIALOG_BUTTON_CANCEL) {
DCHECK(!*success) << "invalid param, OK and CANCEL specified";
native_dialog->CancelAppModalDialog();
*success = true;
}
}
}
| C | Chrome | 0 |
CVE-2016-5165 | https://www.cvedetails.com/cve/CVE-2016-5165/ | CWE-79 | https://github.com/chromium/chromium/commit/19b8593007150b9a78da7d13f6e5f8feb10881a7 | 19b8593007150b9a78da7d13f6e5f8feb10881a7 | Add CPU metrics provider and Add CPU/GPU provider for UKM.
Bug: 907674
Change-Id: I61b88aeac8d2a7ff81d812fa5a267f48203ec7e2
Reviewed-on: https://chromium-review.googlesource.com/c/1381376
Commit-Queue: Nik Bhagat <[email protected]>
Reviewed-by: Robert Kaplow <[email protected]>
Cr-Commit-Position: refs/heads/master@{#618037} | MetricsLogTest() {}
| MetricsLogTest() {}
| C | Chrome | 0 |
CVE-2016-1639 | https://www.cvedetails.com/cve/CVE-2016-1639/ | null | https://github.com/chromium/chromium/commit/c66b1fc49870c514b1c1e8b53498153176d7ec2b | c66b1fc49870c514b1c1e8b53498153176d7ec2b | cros: Check initial auth type when showing views login.
Bug: 859611
Change-Id: I0298db9bbf4aed6bd40600aef2e1c5794e8cd058
Reviewed-on: https://chromium-review.googlesource.com/1123056
Reviewed-by: Xiaoyin Hu <[email protected]>
Commit-Queue: Jacob Dufault <[email protected]>
Cr-Commit-Position: refs/heads/master@{#572224} | void LoginDisplayHostWebUI::OnLoginPromptVisible() {
if (!login_prompt_visible_time_.is_null())
return;
login_prompt_visible_time_ = base::TimeTicks::Now();
TryToPlayOobeStartupSound();
}
| void LoginDisplayHostWebUI::OnLoginPromptVisible() {
if (!login_prompt_visible_time_.is_null())
return;
login_prompt_visible_time_ = base::TimeTicks::Now();
TryToPlayOobeStartupSound();
}
| C | Chrome | 0 |
CVE-2013-4483 | https://www.cvedetails.com/cve/CVE-2013-4483/ | CWE-189 | https://github.com/torvalds/linux/commit/6062a8dc0517bce23e3c2f7d2fea5e22411269a3 | 6062a8dc0517bce23e3c2f7d2fea5e22411269a3 | ipc,sem: fine grained locking for semtimedop
Introduce finer grained locking for semtimedop, to handle the common case
of a program wanting to manipulate one semaphore from an array with
multiple semaphores.
If the call is a semop manipulating just one semaphore in an array with
multiple semaphores, only take the lock for that semaphore itself.
If the call needs to manipulate multiple semaphores, or another caller is
in a transaction that manipulates multiple semaphores, the sem_array lock
is taken, as well as all the locks for the individual semaphores.
On a 24 CPU system, performance numbers with the semop-multi
test with N threads and N semaphores, look like this:
vanilla Davidlohr's Davidlohr's + Davidlohr's +
threads patches rwlock patches v3 patches
10 610652 726325 1783589 2142206
20 341570 365699 1520453 1977878
30 288102 307037 1498167 2037995
40 290714 305955 1612665 2256484
50 288620 312890 1733453 2650292
60 289987 306043 1649360 2388008
70 291298 306347 1723167 2717486
80 290948 305662 1729545 2763582
90 290996 306680 1736021 2757524
100 292243 306700 1773700 3059159
[[email protected]: do not call sem_lock when bogus sma]
[[email protected]: make refcounter atomic]
Signed-off-by: Rik van Riel <[email protected]>
Suggested-by: Linus Torvalds <[email protected]>
Acked-by: Davidlohr Bueso <[email protected]>
Cc: Chegu Vinod <[email protected]>
Cc: Jason Low <[email protected]>
Reviewed-by: Michel Lespinasse <[email protected]>
Cc: Peter Hurley <[email protected]>
Cc: Stanislav Kinsbursky <[email protected]>
Tested-by: Emmanuel Benisty <[email protected]>
Tested-by: Sedat Dilek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]> | SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
{
struct ipc_namespace *ns;
struct ipc_ops msg_ops;
struct ipc_params msg_params;
ns = current->nsproxy->ipc_ns;
msg_ops.getnew = newque;
msg_ops.associate = msg_security;
msg_ops.more_checks = NULL;
msg_params.key = key;
msg_params.flg = msgflg;
return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
}
| SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
{
struct ipc_namespace *ns;
struct ipc_ops msg_ops;
struct ipc_params msg_params;
ns = current->nsproxy->ipc_ns;
msg_ops.getnew = newque;
msg_ops.associate = msg_security;
msg_ops.more_checks = NULL;
msg_params.key = key;
msg_params.flg = msgflg;
return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
}
| C | linux | 0 |
CVE-2011-3234 | https://www.cvedetails.com/cve/CVE-2011-3234/ | CWE-119 | https://github.com/chromium/chromium/commit/52dac009556881941c60d378e34867cdb2fd00a0 | 52dac009556881941c60d378e34867cdb2fd00a0 | Coverity: Add a missing NULL check.
BUG=none
TEST=none
CID=16813
Review URL: http://codereview.chromium.org/7216034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89991 0039d316-1c4b-4281-b951-d872f2087c98 | void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension,
bool visible) {
if (GetBrowserActionVisibility(extension) == visible)
return;
UpdateExtensionPref(extension->id(), kBrowserActionVisible,
Value::CreateBooleanValue(visible));
NotificationService::current()->Notify(
NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED,
Source<ExtensionPrefs>(this),
Details<const Extension>(extension));
}
| void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension,
bool visible) {
if (GetBrowserActionVisibility(extension) == visible)
return;
UpdateExtensionPref(extension->id(), kBrowserActionVisible,
Value::CreateBooleanValue(visible));
NotificationService::current()->Notify(
NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED,
Source<ExtensionPrefs>(this),
Details<const Extension>(extension));
}
| 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} | ChildProcessSecurityPolicyImpl* ChildProcessSecurityPolicyImpl::GetInstance() {
return base::Singleton<ChildProcessSecurityPolicyImpl>::get();
}
| ChildProcessSecurityPolicyImpl* ChildProcessSecurityPolicyImpl::GetInstance() {
return base::Singleton<ChildProcessSecurityPolicyImpl>::get();
}
| C | Chrome | 0 |
CVE-2017-5993 | https://www.cvedetails.com/cve/CVE-2017-5993/ | CWE-772 | https://cgit.freedesktop.org/virglrenderer/commit/?id=6eb13f7a2dcf391ec9e19b4c2a79e68305f63c22 | 6eb13f7a2dcf391ec9e19b4c2a79e68305f63c22 | null | static GLuint blit_build_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, int tgsi_tex_target)
{
GLuint fs_id;
char shader_buf[4096];
int is_shad;
const char *twm;
switch (tgsi_tex_target) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_BUFFER:
twm = ".x";
break;
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_2D_MSAA:
default:
twm = ".xy";
break;
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_2D_ARRAY_MSAA:
twm = ".xyz";
break;
case TGSI_TEXTURE_SHADOWCUBE:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
case TGSI_TEXTURE_CUBE_ARRAY:
twm = "";
break;
}
snprintf(shader_buf, 4096, FS_TEXFETCH_DS, vrend_shader_samplertypeconv(tgsi_tex_target, &is_shad), twm);
fs_id = glCreateShader(GL_FRAGMENT_SHADER);
if (!build_and_check(fs_id, shader_buf)) {
glDeleteShader(fs_id);
return 0;
}
return fs_id;
}
| static GLuint blit_build_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, int tgsi_tex_target)
{
GLuint fs_id;
char shader_buf[4096];
int is_shad;
const char *twm;
switch (tgsi_tex_target) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_BUFFER:
twm = ".x";
break;
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_2D_MSAA:
default:
twm = ".xy";
break;
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_2D_ARRAY_MSAA:
twm = ".xyz";
break;
case TGSI_TEXTURE_SHADOWCUBE:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
case TGSI_TEXTURE_CUBE_ARRAY:
twm = "";
break;
}
snprintf(shader_buf, 4096, FS_TEXFETCH_DS, vrend_shader_samplertypeconv(tgsi_tex_target, &is_shad), twm);
fs_id = glCreateShader(GL_FRAGMENT_SHADER);
if (!build_and_check(fs_id, shader_buf)) {
glDeleteShader(fs_id);
return 0;
}
return fs_id;
}
| C | virglrenderer | 0 |
CVE-2012-0036 | https://www.cvedetails.com/cve/CVE-2012-0036/ | CWE-89 | https://github.com/bagder/curl/commit/75ca568fa1c19de4c5358fed246686de8467c238 | 75ca568fa1c19de4c5358fed246686de8467c238 | URL sanitize: reject URLs containing bad data
Protocols (IMAP, POP3 and SMTP) that use the path part of a URL in a
decoded manner now use the new Curl_urldecode() function to reject URLs
with embedded control codes (anything that is or decodes to a byte value
less than 32).
URLs containing such codes could easily otherwise be used to do harm and
allow users to do unintended actions with otherwise innocent tools and
applications. Like for example using a URL like
pop3://pop3.example.com/1%0d%0aDELE%201 when the app wants a URL to get
a mail and instead this would delete one.
This flaw is considered a security vulnerability: CVE-2012-0036
Security advisory at: http://curl.haxx.se/docs/adv_20120124.html
Reported by: Dan Fandrich | char *curl_easy_unescape(CURL *handle, const char *string, int length,
CURLcode Curl_urldecode(struct SessionHandle *data,
const char *string, size_t length,
char **ostring, size_t *olen,
bool reject_ctrl)
{
size_t alloc = (length?length:strlen(string))+1;
char *ns = malloc(alloc);
unsigned char in;
size_t strindex=0;
unsigned long hex;
CURLcode res;
if(!ns)
return CURLE_OUT_OF_MEMORY;
while(--alloc > 0) {
in = *string;
if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {
/* this is two hexadecimal digits following a '%' */
char hexstr[3];
char *ptr;
hexstr[0] = string[1];
hexstr[1] = string[2];
hexstr[2] = 0;
hex = strtoul(hexstr, &ptr, 16);
in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */
res = Curl_convert_from_network(data, &in, 1);
if(res) {
/* Curl_convert_from_network calls failf if unsuccessful */
free(ns);
return res;
}
string+=2;
alloc-=2;
}
if(reject_ctrl && (in < 0x20)) {
free(ns);
return CURLE_URL_MALFORMAT;
}
ns[strindex++] = in;
string++;
}
ns[strindex]=0; /* terminate it */
if(olen)
/* store output size */
*olen = strindex;
if(ostring)
/* store output string */
*ostring = ns;
return CURLE_OK;
}
/*
* Unescapes the given URL escaped string of given length. Returns a
* pointer to a malloced string with length given in *olen.
* If length == 0, the length is assumed to be strlen(string).
* If olen == NULL, no output length is stored.
*/
char *curl_easy_unescape(CURL *handle, const char *string, int length,
int *olen)
{
char *str = NULL;
size_t inputlen = length;
size_t outputlen;
CURLcode res = Curl_urldecode(handle, string, inputlen, &str, &outputlen,
FALSE);
if(res)
return NULL;
if(olen)
*olen = curlx_uztosi(outputlen);
return str;
}
| char *curl_easy_unescape(CURL *handle, const char *string, int length,
int *olen)
{
int alloc = (length?length:(int)strlen(string))+1;
char *ns = malloc(alloc);
unsigned char in;
int strindex=0;
unsigned long hex;
CURLcode res;
if(!ns)
return NULL;
while(--alloc > 0) {
in = *string;
if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {
/* this is two hexadecimal digits following a '%' */
char hexstr[3];
char *ptr;
hexstr[0] = string[1];
hexstr[1] = string[2];
hexstr[2] = 0;
hex = strtoul(hexstr, &ptr, 16);
in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */
res = Curl_convert_from_network(handle, &in, 1);
if(res) {
/* Curl_convert_from_network calls failf if unsuccessful */
free(ns);
return NULL;
}
string+=2;
alloc-=2;
}
ns[strindex++] = in;
string++;
}
ns[strindex]=0; /* terminate it */
if(olen)
/* store output size */
*olen = strindex;
return ns;
}
| C | curl | 1 |
CVE-2014-2706 | https://www.cvedetails.com/cve/CVE-2014-2706/ | CWE-362 | https://github.com/torvalds/linux/commit/1d147bfa64293b2723c4fec50922168658e613ba | 1d147bfa64293b2723c4fec50922168658e613ba | mac80211: fix AP powersave TX vs. wakeup race
There is a race between the TX path and the STA wakeup: while
a station is sleeping, mac80211 buffers frames until it wakes
up, then the frames are transmitted. However, the RX and TX
path are concurrent, so the packet indicating wakeup can be
processed while a packet is being transmitted.
This can lead to a situation where the buffered frames list
is emptied on the one side, while a frame is being added on
the other side, as the station is still seen as sleeping in
the TX path.
As a result, the newly added frame will not be send anytime
soon. It might be sent much later (and out of order) when the
station goes to sleep and wakes up the next time.
Additionally, it can lead to the crash below.
Fix all this by synchronising both paths with a new lock.
Both path are not fastpath since they handle PS situations.
In a later patch we'll remove the extra skb queue locks to
reduce locking overhead.
BUG: unable to handle kernel
NULL pointer dereference at 000000b0
IP: [<ff6f1791>] ieee80211_report_used_skb+0x11/0x3e0 [mac80211]
*pde = 00000000
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
EIP: 0060:[<ff6f1791>] EFLAGS: 00210282 CPU: 1
EIP is at ieee80211_report_used_skb+0x11/0x3e0 [mac80211]
EAX: e5900da0 EBX: 00000000 ECX: 00000001 EDX: 00000000
ESI: e41d00c0 EDI: e5900da0 EBP: ebe458e4 ESP: ebe458b0
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 8005003b CR2: 000000b0 CR3: 25a78000 CR4: 000407d0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process iperf (pid: 3934, ti=ebe44000 task=e757c0b0 task.ti=ebe44000)
iwlwifi 0000:02:00.0: I iwl_pcie_enqueue_hcmd Sending command LQ_CMD (#4e), seq: 0x0903, 92 bytes at 3[3]:9
Stack:
e403b32c ebe458c4 00200002 00200286 e403b338 ebe458cc c10960bb e5900da0
ff76a6ec ebe458d8 00000000 e41d00c0 e5900da0 ebe458f0 ff6f1b75 e403b210
ebe4598c ff723dc1 00000000 ff76a6ec e597c978 e403b758 00000002 00000002
Call Trace:
[<ff6f1b75>] ieee80211_free_txskb+0x15/0x20 [mac80211]
[<ff723dc1>] invoke_tx_handlers+0x1661/0x1780 [mac80211]
[<ff7248a5>] ieee80211_tx+0x75/0x100 [mac80211]
[<ff7249bf>] ieee80211_xmit+0x8f/0xc0 [mac80211]
[<ff72550e>] ieee80211_subif_start_xmit+0x4fe/0xe20 [mac80211]
[<c149ef70>] dev_hard_start_xmit+0x450/0x950
[<c14b9aa9>] sch_direct_xmit+0xa9/0x250
[<c14b9c9b>] __qdisc_run+0x4b/0x150
[<c149f732>] dev_queue_xmit+0x2c2/0xca0
Cc: [email protected]
Reported-by: Yaara Rozenblum <[email protected]>
Signed-off-by: Emmanuel Grumbach <[email protected]>
Reviewed-by: Stanislaw Gruszka <[email protected]>
[reword commit log, use a separate lock]
Signed-off-by: Johannes Berg <[email protected]> | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
const u8 *addr)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
lockdep_is_held(&local->sta_mtx));
while (sta) {
if (sta->sdata == sdata &&
ether_addr_equal(sta->sta.addr, addr))
break;
sta = rcu_dereference_check(sta->hnext,
lockdep_is_held(&local->sta_mtx));
}
return sta;
}
| struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
const u8 *addr)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
lockdep_is_held(&local->sta_mtx));
while (sta) {
if (sta->sdata == sdata &&
ether_addr_equal(sta->sta.addr, addr))
break;
sta = rcu_dereference_check(sta->hnext,
lockdep_is_held(&local->sta_mtx));
}
return sta;
}
| C | linux | 0 |
CVE-2016-9294 | https://www.cvedetails.com/cve/CVE-2016-9294/ | CWE-476 | http://git.ghostscript.com/?p=mujs.git;a=commit;h=5008105780c0b0182ea6eda83ad5598f225be3ee | 5008105780c0b0182ea6eda83ad5598f225be3ee | null | static void labelto(JF, int inst, int addr)
{
if (addr != (js_Instruction)addr)
js_syntaxerror(J, "jump address integer overflow");
F->code[inst] = addr;
}
| static void labelto(JF, int inst, int addr)
{
if (addr != (js_Instruction)addr)
js_syntaxerror(J, "jump address integer overflow");
F->code[inst] = addr;
}
| C | ghostscript | 0 |
CVE-2014-3690 | https://www.cvedetails.com/cve/CVE-2014-3690/ | CWE-399 | https://github.com/torvalds/linux/commit/d974baa398f34393db76be45f7d4d04fbdbb4a0a | d974baa398f34393db76be45f7d4d04fbdbb4a0a | x86,kvm,vmx: Preserve CR4 across VM entry
CR4 isn't constant; at least the TSD and PCE bits can vary.
TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks
like it's correct.
This adds a branch and a read from cr4 to each vm entry. Because it is
extremely likely that consecutive entries into the same vcpu will have
the same host cr4 value, this fixes up the vmcs instead of restoring cr4
after the fact. A subsequent patch will add a kernel-wide cr4 shadow,
reducing the overhead in the common case to just two memory reads and a
branch.
Signed-off-by: Andy Lutomirski <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Petr Matousek <[email protected]>
Cc: Gleb Natapov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]> | static int handle_vmclear(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
gpa_t vmptr;
struct vmcs12 *vmcs12;
struct page *page;
if (!nested_vmx_check_permission(vcpu))
return 1;
if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMCLEAR, &vmptr))
return 1;
if (vmptr == vmx->nested.current_vmptr)
nested_release_vmcs12(vmx);
page = nested_get_page(vcpu, vmptr);
if (page == NULL) {
/*
* For accurate processor emulation, VMCLEAR beyond available
* physical memory should do nothing at all. However, it is
* possible that a nested vmx bug, not a guest hypervisor bug,
* resulted in this case, so let's shut down before doing any
* more damage:
*/
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
return 1;
}
vmcs12 = kmap(page);
vmcs12->launch_state = 0;
kunmap(page);
nested_release_page(page);
nested_free_vmcs02(vmx, vmptr);
skip_emulated_instruction(vcpu);
nested_vmx_succeed(vcpu);
return 1;
}
| static int handle_vmclear(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
gpa_t vmptr;
struct vmcs12 *vmcs12;
struct page *page;
if (!nested_vmx_check_permission(vcpu))
return 1;
if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMCLEAR, &vmptr))
return 1;
if (vmptr == vmx->nested.current_vmptr)
nested_release_vmcs12(vmx);
page = nested_get_page(vcpu, vmptr);
if (page == NULL) {
/*
* For accurate processor emulation, VMCLEAR beyond available
* physical memory should do nothing at all. However, it is
* possible that a nested vmx bug, not a guest hypervisor bug,
* resulted in this case, so let's shut down before doing any
* more damage:
*/
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
return 1;
}
vmcs12 = kmap(page);
vmcs12->launch_state = 0;
kunmap(page);
nested_release_page(page);
nested_free_vmcs02(vmx, vmptr);
skip_emulated_instruction(vcpu);
nested_vmx_succeed(vcpu);
return 1;
}
| C | linux | 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 int spl_object_storage_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
zend_object *zo1 = (zend_object *)zend_object_store_get_object(o1 TSRMLS_CC);
zend_object *zo2 = (zend_object *)zend_object_store_get_object(o2 TSRMLS_CC);
if (zo1->ce != spl_ce_SplObjectStorage || zo2->ce != spl_ce_SplObjectStorage) {
return 1;
}
return zend_hash_compare(&((spl_SplObjectStorage *)zo1)->storage, &((spl_SplObjectStorage *)zo2)->storage, (compare_func_t) spl_object_storage_compare_info, 0 TSRMLS_CC);
}
/* }}} */
| static int spl_object_storage_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
zend_object *zo1 = (zend_object *)zend_object_store_get_object(o1 TSRMLS_CC);
zend_object *zo2 = (zend_object *)zend_object_store_get_object(o2 TSRMLS_CC);
if (zo1->ce != spl_ce_SplObjectStorage || zo2->ce != spl_ce_SplObjectStorage) {
return 1;
}
return zend_hash_compare(&((spl_SplObjectStorage *)zo1)->storage, &((spl_SplObjectStorage *)zo2)->storage, (compare_func_t) spl_object_storage_compare_info, 0 TSRMLS_CC);
}
/* }}} */
| C | php | 0 |
CVE-2012-1179 | https://www.cvedetails.com/cve/CVE-2012-1179/ | CWE-264 | https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850 | 4a1d704194a441bf83c636004a479e01360ec850 | mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode
commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream.
In some cases it may happen that pmd_none_or_clear_bad() is called with
the mmap_sem hold in read mode. In those cases the huge page faults can
allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a
false positive from pmd_bad() that will not like to see a pmd
materializing as trans huge.
It's not khugepaged causing the problem, khugepaged holds the mmap_sem
in write mode (and all those sites must hold the mmap_sem in read mode
to prevent pagetables to go away from under them, during code review it
seems vm86 mode on 32bit kernels requires that too unless it's
restricted to 1 thread per process or UP builds). The race is only with
the huge pagefaults that can convert a pmd_none() into a
pmd_trans_huge().
Effectively all these pmd_none_or_clear_bad() sites running with
mmap_sem in read mode are somewhat speculative with the page faults, and
the result is always undefined when they run simultaneously. This is
probably why it wasn't common to run into this. For example if the
madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page
fault, the hugepage will not be zapped, if the page fault runs first it
will be zapped.
Altering pmd_bad() not to error out if it finds hugepmds won't be enough
to fix this, because zap_pmd_range would then proceed to call
zap_pte_range (which would be incorrect if the pmd become a
pmd_trans_huge()).
The simplest way to fix this is to read the pmd in the local stack
(regardless of what we read, no need of actual CPU barriers, only
compiler barrier needed), and be sure it is not changing under the code
that computes its value. Even if the real pmd is changing under the
value we hold on the stack, we don't care. If we actually end up in
zap_pte_range it means the pmd was not none already and it was not huge,
and it can't become huge from under us (khugepaged locking explained
above).
All we need is to enforce that there is no way anymore that in a code
path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad
can run into a hugepmd. The overhead of a barrier() is just a compiler
tweak and should not be measurable (I only added it for THP builds). I
don't exclude different compiler versions may have prevented the race
too by caching the value of *pmd on the stack (that hasn't been
verified, but it wouldn't be impossible considering
pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines
and there's no external function called in between pmd_trans_huge and
pmd_none_or_clear_bad).
if (pmd_trans_huge(*pmd)) {
if (next-addr != HPAGE_PMD_SIZE) {
VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem));
split_huge_page_pmd(vma->vm_mm, pmd);
} else if (zap_huge_pmd(tlb, vma, pmd, addr))
continue;
/* fall through */
}
if (pmd_none_or_clear_bad(pmd))
Because this race condition could be exercised without special
privileges this was reported in CVE-2012-1179.
The race was identified and fully explained by Ulrich who debugged it.
I'm quoting his accurate explanation below, for reference.
====== start quote =======
mapcount 0 page_mapcount 1
kernel BUG at mm/huge_memory.c:1384!
At some point prior to the panic, a "bad pmd ..." message similar to the
following is logged on the console:
mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7).
The "bad pmd ..." message is logged by pmd_clear_bad() before it clears
the page's PMD table entry.
143 void pmd_clear_bad(pmd_t *pmd)
144 {
-> 145 pmd_ERROR(*pmd);
146 pmd_clear(pmd);
147 }
After the PMD table entry has been cleared, there is an inconsistency
between the actual number of PMD table entries that are mapping the page
and the page's map count (_mapcount field in struct page). When the page
is subsequently reclaimed, __split_huge_page() detects this inconsistency.
1381 if (mapcount != page_mapcount(page))
1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n",
1383 mapcount, page_mapcount(page));
-> 1384 BUG_ON(mapcount != page_mapcount(page));
The root cause of the problem is a race of two threads in a multithreaded
process. Thread B incurs a page fault on a virtual address that has never
been accessed (PMD entry is zero) while Thread A is executing an madvise()
system call on a virtual address within the same 2 MB (huge page) range.
virtual address space
.---------------------.
| |
| |
.-|---------------------|
| | |
| | |<-- B(fault)
| | |
2 MB | |/////////////////////|-.
huge < |/////////////////////| > A(range)
page | |/////////////////////|-'
| | |
| | |
'-|---------------------|
| |
| |
'---------------------'
- Thread A is executing an madvise(..., MADV_DONTNEED) system call
on the virtual address range "A(range)" shown in the picture.
sys_madvise
// Acquire the semaphore in shared mode.
down_read(¤t->mm->mmap_sem)
...
madvise_vma
switch (behavior)
case MADV_DONTNEED:
madvise_dontneed
zap_page_range
unmap_vmas
unmap_page_range
zap_pud_range
zap_pmd_range
//
// Assume that this huge page has never been accessed.
// I.e. content of the PMD entry is zero (not mapped).
//
if (pmd_trans_huge(*pmd)) {
// We don't get here due to the above assumption.
}
//
// Assume that Thread B incurred a page fault and
.---------> // sneaks in here as shown below.
| //
| if (pmd_none_or_clear_bad(pmd))
| {
| if (unlikely(pmd_bad(*pmd)))
| pmd_clear_bad
| {
| pmd_ERROR
| // Log "bad pmd ..." message here.
| pmd_clear
| // Clear the page's PMD entry.
| // Thread B incremented the map count
| // in page_add_new_anon_rmap(), but
| // now the page is no longer mapped
| // by a PMD entry (-> inconsistency).
| }
| }
|
v
- Thread B is handling a page fault on virtual address "B(fault)" shown
in the picture.
...
do_page_fault
__do_page_fault
// Acquire the semaphore in shared mode.
down_read_trylock(&mm->mmap_sem)
...
handle_mm_fault
if (pmd_none(*pmd) && transparent_hugepage_enabled(vma))
// We get here due to the above assumption (PMD entry is zero).
do_huge_pmd_anonymous_page
alloc_hugepage_vma
// Allocate a new transparent huge page here.
...
__do_huge_pmd_anonymous_page
...
spin_lock(&mm->page_table_lock)
...
page_add_new_anon_rmap
// Here we increment the page's map count (starts at -1).
atomic_set(&page->_mapcount, 0)
set_pmd_at
// Here we set the page's PMD entry which will be cleared
// when Thread A calls pmd_clear_bad().
...
spin_unlock(&mm->page_table_lock)
The mmap_sem does not prevent the race because both threads are acquiring
it in shared mode (down_read). Thread B holds the page_table_lock while
the page's map count and PMD table entry are updated. However, Thread A
does not synchronize on that lock.
====== end quote =======
[[email protected]: checkpatch fixes]
Reported-by: Ulrich Obergfell <[email protected]>
Signed-off-by: Andrea Arcangeli <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Dave Jones <[email protected]>
Acked-by: Larry Woodman <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Cc: Mark Salter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]> | void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
{
__sync_task_rss_stat(task, mm);
}
| void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
{
__sync_task_rss_stat(task, mm);
}
| C | linux | 0 |
CVE-2019-12973 | https://www.cvedetails.com/cve/CVE-2019-12973/ | CWE-400 | https://github.com/uclouvain/openjpeg/commit/8ee335227bbcaf1614124046aa25e53d67b11ec3 | 8ee335227bbcaf1614124046aa25e53d67b11ec3 | convertbmp: detect invalid file dimensions early
width/length dimensions read from bmp headers are not necessarily
valid. For instance they may have been maliciously set to very large
values with the intention to cause DoS (large memory allocation, stack
overflow). In these cases we want to detect the invalid size as early
as possible.
This commit introduces a counter which verifies that the number of
written bytes corresponds to the advertized width/length.
Fixes #1059 (CVE-2018-6616). | static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData,
OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)
{
OPJ_UINT32 x, y, written;
OPJ_UINT8 *pix;
const OPJ_UINT8 *beyond;
beyond = pData + stride * height;
pix = pData;
x = y = written = 0U;
while (y < height) {
int c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
if (c) {
int j, c1_int;
OPJ_UINT8 c1;
c1_int = getc(IN);
if (c1_int == EOF) {
return OPJ_FALSE;
}
c1 = (OPJ_UINT8)c1_int;
for (j = 0; (j < c) && (x < width) &&
((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
*pix = c1;
written++;
}
} else {
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
if (c == 0x00) { /* EOL */
x = 0;
++y;
pix = pData + y * stride + x;
} else if (c == 0x01) { /* EOP */
break;
} else if (c == 0x02) { /* MOVE by dxdy */
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
x += (OPJ_UINT32)c;
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
y += (OPJ_UINT32)c;
pix = pData + y * stride + x;
} else { /* 03 .. 255 */
int j;
for (j = 0; (j < c) && (x < width) &&
((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
int c1_int;
OPJ_UINT8 c1;
c1_int = getc(IN);
if (c1_int == EOF) {
return OPJ_FALSE;
}
c1 = (OPJ_UINT8)c1_int;
*pix = c1;
written++;
}
if ((OPJ_UINT32)c & 1U) { /* skip padding byte */
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
}
}
}
}/* while() */
if (written != width * height) {
fprintf(stderr, "warning, image's actual size does not match advertized one\n");
return OPJ_FALSE;
}
return OPJ_TRUE;
}
| static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData,
OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)
{
OPJ_UINT32 x, y;
OPJ_UINT8 *pix;
const OPJ_UINT8 *beyond;
beyond = pData + stride * height;
pix = pData;
x = y = 0U;
while (y < height) {
int c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
if (c) {
int j, c1_int;
OPJ_UINT8 c1;
c1_int = getc(IN);
if (c1_int == EOF) {
return OPJ_FALSE;
}
c1 = (OPJ_UINT8)c1_int;
for (j = 0; (j < c) && (x < width) &&
((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
*pix = c1;
}
} else {
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
if (c == 0x00) { /* EOL */
x = 0;
++y;
pix = pData + y * stride + x;
} else if (c == 0x01) { /* EOP */
break;
} else if (c == 0x02) { /* MOVE by dxdy */
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
x += (OPJ_UINT32)c;
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
y += (OPJ_UINT32)c;
pix = pData + y * stride + x;
} else { /* 03 .. 255 */
int j;
for (j = 0; (j < c) && (x < width) &&
((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
int c1_int;
OPJ_UINT8 c1;
c1_int = getc(IN);
if (c1_int == EOF) {
return OPJ_FALSE;
}
c1 = (OPJ_UINT8)c1_int;
*pix = c1;
}
if ((OPJ_UINT32)c & 1U) { /* skip padding byte */
c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
}
}
}
}/* while() */
return OPJ_TRUE;
}
| C | openjpeg | 1 |
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::RestoreDatabase(WebEmSession & session, const request& req, std::string & redirect_uri)
{
redirect_uri = "/index.html";
if (session.rights != 2)
{
session.reply_status = reply::forbidden;
return; //Only admin user allowed
}
std::string dbasefile = request::findValue(&req, "dbasefile");
if (dbasefile.empty()) {
return;
}
m_mainworker.StopDomoticzHardware();
m_sql.RestoreDatabase(dbasefile);
m_mainworker.AddAllDomoticzHardware();
}
| void CWebServer::RestoreDatabase(WebEmSession & session, const request& req, std::string & redirect_uri)
{
redirect_uri = "/index.html";
if (session.rights != 2)
{
session.reply_status = reply::forbidden;
return; //Only admin user allowed
}
std::string dbasefile = request::findValue(&req, "dbasefile");
if (dbasefile.empty()) {
return;
}
m_mainworker.StopDomoticzHardware();
m_sql.RestoreDatabase(dbasefile);
m_mainworker.AddAllDomoticzHardware();
}
| C | domoticz | 0 |
CVE-2013-2909 | https://www.cvedetails.com/cve/CVE-2013-2909/ | CWE-399 | https://github.com/chromium/chromium/commit/248a92c21c20c14b5983680c50e1d8b73fc79a2f | 248a92c21c20c14b5983680c50e1d8b73fc79a2f | Update containtingIsolate to go back all the way to top isolate from current root, rather than stopping at the first isolate it finds. This works because the current root is always updated with each isolate run.
BUG=279277
Review URL: https://chromiumcodereview.appspot.com/23972003
git-svn-id: svn://svn.chromium.org/blink/trunk@157268 bbb929c8-8fbe-4397-9dbb-9b2b20218538 | void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; }
| void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; }
| 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 ResetWheelAndTouchEventHandlerProperties(LocalFrame& frame) {
auto& chrome_client = frame.GetPage()->GetChromeClient();
chrome_client.SetEventListenerProperties(
&frame, cc::EventListenerClass::kTouchStartOrMove,
cc::EventListenerProperties::kNone);
chrome_client.SetEventListenerProperties(&frame,
cc::EventListenerClass::kMouseWheel,
cc::EventListenerProperties::kNone);
chrome_client.SetEventListenerProperties(
&frame, cc::EventListenerClass::kTouchEndOrCancel,
cc::EventListenerProperties::kNone);
}
| void ResetWheelAndTouchEventHandlerProperties(LocalFrame& frame) {
auto& chrome_client = frame.GetPage()->GetChromeClient();
chrome_client.SetEventListenerProperties(
&frame, cc::EventListenerClass::kTouchStartOrMove,
cc::EventListenerProperties::kNone);
chrome_client.SetEventListenerProperties(&frame,
cc::EventListenerClass::kMouseWheel,
cc::EventListenerProperties::kNone);
chrome_client.SetEventListenerProperties(
&frame, cc::EventListenerClass::kTouchEndOrCancel,
cc::EventListenerProperties::kNone);
}
| C | Chrome | 0 |
CVE-2014-8160 | https://www.cvedetails.com/cve/CVE-2014-8160/ | CWE-254 | https://github.com/torvalds/linux/commit/db29a9508a9246e77087c5531e45b2c88ec6988b | db29a9508a9246e77087c5531e45b2c88ec6988b | netfilter: conntrack: disable generic tracking for known protocols
Given following iptables ruleset:
-P FORWARD DROP
-A FORWARD -m sctp --dport 9 -j ACCEPT
-A FORWARD -p tcp --dport 80 -j ACCEPT
-A FORWARD -p tcp -m conntrack -m state ESTABLISHED,RELATED -j ACCEPT
One would assume that this allows SCTP on port 9 and TCP on port 80.
Unfortunately, if the SCTP conntrack module is not loaded, this allows
*all* SCTP communication, to pass though, i.e. -p sctp -j ACCEPT,
which we think is a security issue.
This is because on the first SCTP packet on port 9, we create a dummy
"generic l4" conntrack entry without any port information (since
conntrack doesn't know how to extract this information).
All subsequent packets that are unknown will then be in established
state since they will fallback to proto_generic and will match the
'generic' entry.
Our originally proposed version [1] completely disabled generic protocol
tracking, but Jozsef suggests to not track protocols for which a more
suitable helper is available, hence we now mitigate the issue for in
tree known ct protocol helpers only, so that at least NAT and direction
information will still be preserved for others.
[1] http://www.spinics.net/lists/netfilter-devel/msg33430.html
Joint work with Daniel Borkmann.
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Jozsef Kadlecsik <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]> | static int generic_packet(struct nf_conn *ct,
const struct sk_buff *skb,
unsigned int dataoff,
enum ip_conntrack_info ctinfo,
u_int8_t pf,
unsigned int hooknum,
unsigned int *timeout)
{
nf_ct_refresh_acct(ct, ctinfo, skb, *timeout);
return NF_ACCEPT;
}
| static int generic_packet(struct nf_conn *ct,
const struct sk_buff *skb,
unsigned int dataoff,
enum ip_conntrack_info ctinfo,
u_int8_t pf,
unsigned int hooknum,
unsigned int *timeout)
{
nf_ct_refresh_acct(ct, ctinfo, skb, *timeout);
return NF_ACCEPT;
}
| C | linux | 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 | const char* Chapters::Display::GetCountry() const
| const char* Chapters::Display::GetCountry() const
{
return m_country;
}
| C | Android | 1 |
CVE-2017-18248 | https://www.cvedetails.com/cve/CVE-2017-18248/ | CWE-20 | https://github.com/apple/cups/commit/49fa4983f25b64ec29d548ffa3b9782426007df3 | 49fa4983f25b64ec29d548ffa3b9782426007df3 | DBUS notifications could crash the scheduler (Issue #5143)
- scheduler/ipp.c: Make sure requesting-user-name string is valid UTF-8. | add_printer(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - URI of printer */
{
http_status_t status; /* Policy status */
int i; /* Looping var */
char scheme[HTTP_MAX_URI], /* Method portion of URI */
username[HTTP_MAX_URI], /* Username portion of URI */
host[HTTP_MAX_URI], /* Host portion of URI */
resource[HTTP_MAX_URI]; /* Resource portion of URI */
int port; /* Port portion of URI */
cupsd_printer_t *printer; /* Printer/class */
ipp_attribute_t *attr; /* Printer attribute */
cups_file_t *fp; /* Script/PPD file */
char line[1024]; /* Line from file... */
char srcfile[1024], /* Source Script/PPD file */
dstfile[1024]; /* Destination Script/PPD file */
int modify; /* Non-zero if we are modifying */
int changed_driver, /* Changed the PPD? */
need_restart_job, /* Need to restart job? */
set_device_uri, /* Did we set the device URI? */
set_port_monitor; /* Did we set the port monitor? */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer(%p[%d], %s)", con,
con->number, uri->values[0].string.text);
/*
* Do we have a valid URI?
*/
httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
if (strncmp(resource, "/printers/", 10) || strlen(resource) == 10)
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri must be of the form "
"\"ipp://HOSTNAME/printers/PRINTERNAME\"."));
return;
}
/*
* Do we have a valid printer name?
*/
if (!validate_name(resource + 10))
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri \"%s\" contains invalid characters."),
uri->values[0].string.text);
return;
}
/*
* See if the printer already exists; if not, create a new printer...
*/
if ((printer = cupsdFindPrinter(resource + 10)) == NULL)
{
/*
* Printer doesn't exist; see if we have a class of the same name...
*/
if ((printer = cupsdFindClass(resource + 10)) != NULL)
{
/*
* Yes, return an error...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("A class named \"%s\" already exists."),
resource + 10);
return;
}
/*
* No, check the default policy then add the printer...
*/
if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK)
{
send_http_error(con, status, NULL);
return;
}
printer = cupsdAddPrinter(resource + 10);
modify = 0;
}
else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con,
NULL)) != HTTP_OK)
{
send_http_error(con, status, printer);
return;
}
else
modify = 1;
/*
* Look for attributes and copy them over as needed...
*/
changed_driver = 0;
need_restart_job = 0;
if ((attr = ippFindAttribute(con->request, "printer-is-temporary", IPP_TAG_BOOLEAN)) != NULL)
printer->temporary = ippGetBoolean(attr, 0);
if ((attr = ippFindAttribute(con->request, "printer-location",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-geo-location", IPP_TAG_URI)) != NULL && !strncmp(attr->values[0].string.text, "geo:", 4))
cupsdSetString(&printer->geo_location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organization", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organization, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organizational-unit", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organizational_unit, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-info",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->info, attr->values[0].string.text);
set_device_uri = 0;
if ((attr = ippFindAttribute(con->request, "device-uri",
IPP_TAG_URI)) != NULL)
{
/*
* Do we have a valid device URI?
*/
http_uri_status_t uri_status; /* URI separation status */
char old_device_uri[1024];
/* Old device URI */
need_restart_job = 1;
uri_status = httpSeparateURI(HTTP_URI_CODING_ALL,
attr->values[0].string.text,
scheme, sizeof(scheme),
username, sizeof(username),
host, sizeof(host), &port,
resource, sizeof(resource));
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s device-uri: %s", printer->name, httpURIStatusString(uri_status));
if (uri_status < HTTP_URI_OK)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (!strcmp(scheme, "file"))
{
/*
* See if the administrator has enabled file devices...
*/
if (!FileDevice && strcmp(resource, "/dev/null"))
{
/*
* File devices are disabled and the URL is not file:/dev/null...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("File device URIs have been disabled. "
"To enable, see the FileDevice directive in "
"\"%s/cups-files.conf\"."),
ServerRoot);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
else
{
/*
* See if the backend exists and is executable...
*/
snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin, scheme);
if (access(srcfile, X_OK))
{
/*
* Could not find device in list!
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Bad device-uri scheme \"%s\"."), scheme);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
if (printer->sanitized_device_uri)
strlcpy(old_device_uri, printer->sanitized_device_uri,
sizeof(old_device_uri));
else
old_device_uri[0] = '\0';
cupsdSetDeviceURI(printer, attr->values[0].string.text);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s device-uri to \"%s\" (was \"%s\".)",
printer->name, printer->sanitized_device_uri,
old_device_uri);
set_device_uri = 1;
}
set_port_monitor = 0;
if ((attr = ippFindAttribute(con->request, "port-monitor",
IPP_TAG_NAME)) != NULL)
{
ipp_attribute_t *supported; /* port-monitor-supported attribute */
need_restart_job = 1;
supported = ippFindAttribute(printer->ppd_attrs, "port-monitor-supported",
IPP_TAG_NAME);
if (supported)
{
for (i = 0; i < supported->num_values; i ++)
if (!strcmp(supported->values[i].string.text,
attr->values[0].string.text))
break;
}
if (!supported || i >= supported->num_values)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, attr->values[0].string.text,
printer->port_monitor ? printer->port_monitor : "none");
if (strcmp(attr->values[0].string.text, "none"))
cupsdSetString(&printer->port_monitor, attr->values[0].string.text);
else
cupsdClearString(&printer->port_monitor);
set_port_monitor = 1;
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs",
IPP_TAG_BOOLEAN)) != NULL &&
attr->values[0].boolean != printer->accepting)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-accepting-jobs to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->accepting);
printer->accepting = attr->values[0].boolean;
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"%s accepting jobs.",
printer->accepting ? "Now" : "No longer");
}
if ((attr = ippFindAttribute(con->request, "printer-is-shared", IPP_TAG_BOOLEAN)) != NULL)
{
if (ippGetBoolean(attr, 0) &&
printer->num_auth_info_required == 1 &&
!strcmp(printer->auth_info_required[0], "negotiate"))
{
send_ipp_status(con, IPP_BAD_REQUEST,
_("Cannot share a remote Kerberized printer."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->type & CUPS_PRINTER_REMOTE)
{
/*
* Cannot re-share remote printers.
*/
send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->shared && !ippGetBoolean(attr, 0))
cupsdDeregisterPrinter(printer, 1);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-shared to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->shared);
printer->shared = ippGetBoolean(attr, 0);
if (printer->shared && printer->temporary)
printer->temporary = 0;
}
if ((attr = ippFindAttribute(con->request, "printer-state",
IPP_TAG_ENUM)) != NULL)
{
if (attr->values[0].integer != IPP_PRINTER_IDLE &&
attr->values[0].integer != IPP_PRINTER_STOPPED)
{
send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d."),
attr->values[0].integer);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-state to %d (was %d.)",
printer->name, attr->values[0].integer, printer->state);
if (attr->values[0].integer == IPP_PRINTER_STOPPED)
cupsdStopPrinter(printer, 0);
else
{
need_restart_job = 1;
cupsdSetPrinterState(printer, (ipp_pstate_t)(attr->values[0].integer), 0);
}
}
if ((attr = ippFindAttribute(con->request, "printer-state-message",
IPP_TAG_TEXT)) != NULL)
{
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
printer->state_message);
}
if ((attr = ippFindAttribute(con->request, "printer-state-reasons",
IPP_TAG_KEYWORD)) != NULL)
{
if (attr->num_values >
(int)(sizeof(printer->reasons) / sizeof(printer->reasons[0])))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Too many printer-state-reasons values (%d > %d)."),
attr->num_values,
(int)(sizeof(printer->reasons) /
sizeof(printer->reasons[0])));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
for (i = 0; i < printer->num_reasons; i ++)
_cupsStrFree(printer->reasons[i]);
printer->num_reasons = 0;
for (i = 0; i < attr->num_values; i ++)
{
if (!strcmp(attr->values[i].string.text, "none"))
continue;
printer->reasons[printer->num_reasons] =
_cupsStrRetain(attr->values[i].string.text);
printer->num_reasons ++;
if (!strcmp(attr->values[i].string.text, "paused") &&
printer->state != IPP_PRINTER_STOPPED)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-state to %d (was %d.)",
printer->name, IPP_PRINTER_STOPPED, printer->state);
cupsdStopPrinter(printer, 0);
}
}
if (PrintcapFormat == PRINTCAP_PLIST)
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"Printer \"%s\" state changed.", printer->name);
}
if (!set_printer_defaults(con, printer))
{
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if ((attr = ippFindAttribute(con->request, "auth-info-required",
IPP_TAG_KEYWORD)) != NULL)
cupsdSetAuthInfoRequired(printer, NULL, attr);
/*
* See if we have all required attributes...
*/
if (!printer->device_uri)
cupsdSetString(&printer->device_uri, "file:///dev/null");
/*
* See if we have a PPD file attached to the request...
*/
if (con->filename)
{
need_restart_job = 1;
changed_driver = 1;
strlcpy(srcfile, con->filename, sizeof(srcfile));
if ((fp = cupsFileOpen(srcfile, "rb")))
{
/*
* Yes; get the first line from it...
*/
line[0] = '\0';
cupsFileGets(fp, line, sizeof(line));
cupsFileClose(fp);
/*
* Then see what kind of file it is...
*/
if (strncmp(line, "*PPD-Adobe", 10))
{
send_ipp_status(con, IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED, _("Bad PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
/*
* The new file is a PPD file, so move the file over to the ppd
* directory...
*/
if (copy_file(srcfile, dstfile, ConfigFilePerm))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file - %s"), strerror(errno));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
else if ((attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL)
{
const char *ppd_name = ippGetString(attr, 0, NULL);
/* ppd-name value */
need_restart_job = 1;
changed_driver = 1;
if (!strcmp(ppd_name, "raw"))
{
/*
* Raw driver, remove any existing PPD file.
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
unlink(dstfile);
}
else if (strstr(ppd_name, "../"))
{
send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
else
{
/*
* PPD model file...
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
if (copy_model(con, ppd_name, dstfile))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
if (changed_driver)
{
/*
* If we changed the PPD, then remove the printer's cache file and clear the
* printer-state-reasons...
*/
char cache_name[1024]; /* Cache filename for printer attrs */
snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, printer->name);
unlink(cache_name);
cupsdSetPrinterReasons(printer, "none");
/*
* (Re)register color profiles...
*/
cupsdRegisterColor(printer);
}
/*
* If we set the device URI but not the port monitor, check which port
* monitor to use by default...
*/
if (set_device_uri && !set_port_monitor)
{
ppd_file_t *ppd; /* PPD file */
ppd_attr_t *ppdattr; /* cupsPortMonitor attribute */
httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
snprintf(srcfile, sizeof(srcfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
if ((ppd = _ppdOpenFile(srcfile, _PPD_LOCALIZATION_NONE)) != NULL)
{
for (ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL);
ppdattr;
ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL))
if (!strcmp(scheme, ppdattr->spec))
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, ppdattr->value,
printer->port_monitor ? printer->port_monitor
: "none");
if (strcmp(ppdattr->value, "none"))
cupsdSetString(&printer->port_monitor, ppdattr->value);
else
cupsdClearString(&printer->port_monitor);
break;
}
ppdClose(ppd);
}
}
printer->config_time = time(NULL);
/*
* Update the printer attributes and return...
*/
cupsdSetPrinterAttrs(printer);
if (!printer->temporary)
cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
if (need_restart_job && printer->job)
{
/*
* Restart the current job...
*/
cupsdSetJobState(printer->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
"Job restarted because the printer was modified.");
}
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
if (modify)
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
printer, NULL, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
}
else
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
}
con->response->request.status.status_code = IPP_OK;
}
| add_printer(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - URI of printer */
{
http_status_t status; /* Policy status */
int i; /* Looping var */
char scheme[HTTP_MAX_URI], /* Method portion of URI */
username[HTTP_MAX_URI], /* Username portion of URI */
host[HTTP_MAX_URI], /* Host portion of URI */
resource[HTTP_MAX_URI]; /* Resource portion of URI */
int port; /* Port portion of URI */
cupsd_printer_t *printer; /* Printer/class */
ipp_attribute_t *attr; /* Printer attribute */
cups_file_t *fp; /* Script/PPD file */
char line[1024]; /* Line from file... */
char srcfile[1024], /* Source Script/PPD file */
dstfile[1024]; /* Destination Script/PPD file */
int modify; /* Non-zero if we are modifying */
int changed_driver, /* Changed the PPD? */
need_restart_job, /* Need to restart job? */
set_device_uri, /* Did we set the device URI? */
set_port_monitor; /* Did we set the port monitor? */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer(%p[%d], %s)", con,
con->number, uri->values[0].string.text);
/*
* Do we have a valid URI?
*/
httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
if (strncmp(resource, "/printers/", 10) || strlen(resource) == 10)
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri must be of the form "
"\"ipp://HOSTNAME/printers/PRINTERNAME\"."));
return;
}
/*
* Do we have a valid printer name?
*/
if (!validate_name(resource + 10))
{
/*
* No, return an error...
*/
send_ipp_status(con, IPP_BAD_REQUEST,
_("The printer-uri \"%s\" contains invalid characters."),
uri->values[0].string.text);
return;
}
/*
* See if the printer already exists; if not, create a new printer...
*/
if ((printer = cupsdFindPrinter(resource + 10)) == NULL)
{
/*
* Printer doesn't exist; see if we have a class of the same name...
*/
if ((printer = cupsdFindClass(resource + 10)) != NULL)
{
/*
* Yes, return an error...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("A class named \"%s\" already exists."),
resource + 10);
return;
}
/*
* No, check the default policy then add the printer...
*/
if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK)
{
send_http_error(con, status, NULL);
return;
}
printer = cupsdAddPrinter(resource + 10);
modify = 0;
}
else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con,
NULL)) != HTTP_OK)
{
send_http_error(con, status, printer);
return;
}
else
modify = 1;
/*
* Look for attributes and copy them over as needed...
*/
changed_driver = 0;
need_restart_job = 0;
if ((attr = ippFindAttribute(con->request, "printer-is-temporary", IPP_TAG_BOOLEAN)) != NULL)
printer->temporary = ippGetBoolean(attr, 0);
if ((attr = ippFindAttribute(con->request, "printer-location",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-geo-location", IPP_TAG_URI)) != NULL && !strncmp(attr->values[0].string.text, "geo:", 4))
cupsdSetString(&printer->geo_location, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organization", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organization, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-organizational-unit", IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->organizational_unit, attr->values[0].string.text);
if ((attr = ippFindAttribute(con->request, "printer-info",
IPP_TAG_TEXT)) != NULL)
cupsdSetString(&printer->info, attr->values[0].string.text);
set_device_uri = 0;
if ((attr = ippFindAttribute(con->request, "device-uri",
IPP_TAG_URI)) != NULL)
{
/*
* Do we have a valid device URI?
*/
http_uri_status_t uri_status; /* URI separation status */
char old_device_uri[1024];
/* Old device URI */
need_restart_job = 1;
uri_status = httpSeparateURI(HTTP_URI_CODING_ALL,
attr->values[0].string.text,
scheme, sizeof(scheme),
username, sizeof(username),
host, sizeof(host), &port,
resource, sizeof(resource));
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s device-uri: %s", printer->name, httpURIStatusString(uri_status));
if (uri_status < HTTP_URI_OK)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (!strcmp(scheme, "file"))
{
/*
* See if the administrator has enabled file devices...
*/
if (!FileDevice && strcmp(resource, "/dev/null"))
{
/*
* File devices are disabled and the URL is not file:/dev/null...
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("File device URIs have been disabled. "
"To enable, see the FileDevice directive in "
"\"%s/cups-files.conf\"."),
ServerRoot);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
else
{
/*
* See if the backend exists and is executable...
*/
snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin, scheme);
if (access(srcfile, X_OK))
{
/*
* Could not find device in list!
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Bad device-uri scheme \"%s\"."), scheme);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
}
if (printer->sanitized_device_uri)
strlcpy(old_device_uri, printer->sanitized_device_uri,
sizeof(old_device_uri));
else
old_device_uri[0] = '\0';
cupsdSetDeviceURI(printer, attr->values[0].string.text);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s device-uri to \"%s\" (was \"%s\".)",
printer->name, printer->sanitized_device_uri,
old_device_uri);
set_device_uri = 1;
}
set_port_monitor = 0;
if ((attr = ippFindAttribute(con->request, "port-monitor",
IPP_TAG_NAME)) != NULL)
{
ipp_attribute_t *supported; /* port-monitor-supported attribute */
need_restart_job = 1;
supported = ippFindAttribute(printer->ppd_attrs, "port-monitor-supported",
IPP_TAG_NAME);
if (supported)
{
for (i = 0; i < supported->num_values; i ++)
if (!strcmp(supported->values[i].string.text,
attr->values[0].string.text))
break;
}
if (!supported || i >= supported->num_values)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"."),
attr->values[0].string.text);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, attr->values[0].string.text,
printer->port_monitor ? printer->port_monitor : "none");
if (strcmp(attr->values[0].string.text, "none"))
cupsdSetString(&printer->port_monitor, attr->values[0].string.text);
else
cupsdClearString(&printer->port_monitor);
set_port_monitor = 1;
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs",
IPP_TAG_BOOLEAN)) != NULL &&
attr->values[0].boolean != printer->accepting)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-accepting-jobs to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->accepting);
printer->accepting = attr->values[0].boolean;
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"%s accepting jobs.",
printer->accepting ? "Now" : "No longer");
}
if ((attr = ippFindAttribute(con->request, "printer-is-shared", IPP_TAG_BOOLEAN)) != NULL)
{
if (ippGetBoolean(attr, 0) &&
printer->num_auth_info_required == 1 &&
!strcmp(printer->auth_info_required[0], "negotiate"))
{
send_ipp_status(con, IPP_BAD_REQUEST,
_("Cannot share a remote Kerberized printer."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->type & CUPS_PRINTER_REMOTE)
{
/*
* Cannot re-share remote printers.
*/
send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if (printer->shared && !ippGetBoolean(attr, 0))
cupsdDeregisterPrinter(printer, 1);
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-is-shared to %d (was %d.)",
printer->name, attr->values[0].boolean, printer->shared);
printer->shared = ippGetBoolean(attr, 0);
if (printer->shared && printer->temporary)
printer->temporary = 0;
}
if ((attr = ippFindAttribute(con->request, "printer-state",
IPP_TAG_ENUM)) != NULL)
{
if (attr->values[0].integer != IPP_PRINTER_IDLE &&
attr->values[0].integer != IPP_PRINTER_STOPPED)
{
send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d."),
attr->values[0].integer);
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-state to %d (was %d.)",
printer->name, attr->values[0].integer, printer->state);
if (attr->values[0].integer == IPP_PRINTER_STOPPED)
cupsdStopPrinter(printer, 0);
else
{
need_restart_job = 1;
cupsdSetPrinterState(printer, (ipp_pstate_t)(attr->values[0].integer), 0);
}
}
if ((attr = ippFindAttribute(con->request, "printer-state-message",
IPP_TAG_TEXT)) != NULL)
{
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
printer->state_message);
}
if ((attr = ippFindAttribute(con->request, "printer-state-reasons",
IPP_TAG_KEYWORD)) != NULL)
{
if (attr->num_values >
(int)(sizeof(printer->reasons) / sizeof(printer->reasons[0])))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("Too many printer-state-reasons values (%d > %d)."),
attr->num_values,
(int)(sizeof(printer->reasons) /
sizeof(printer->reasons[0])));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
for (i = 0; i < printer->num_reasons; i ++)
_cupsStrFree(printer->reasons[i]);
printer->num_reasons = 0;
for (i = 0; i < attr->num_values; i ++)
{
if (!strcmp(attr->values[i].string.text, "none"))
continue;
printer->reasons[printer->num_reasons] =
_cupsStrRetain(attr->values[i].string.text);
printer->num_reasons ++;
if (!strcmp(attr->values[i].string.text, "paused") &&
printer->state != IPP_PRINTER_STOPPED)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s printer-state to %d (was %d.)",
printer->name, IPP_PRINTER_STOPPED, printer->state);
cupsdStopPrinter(printer, 0);
}
}
if (PrintcapFormat == PRINTCAP_PLIST)
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"Printer \"%s\" state changed.", printer->name);
}
if (!set_printer_defaults(con, printer))
{
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
if ((attr = ippFindAttribute(con->request, "auth-info-required",
IPP_TAG_KEYWORD)) != NULL)
cupsdSetAuthInfoRequired(printer, NULL, attr);
/*
* See if we have all required attributes...
*/
if (!printer->device_uri)
cupsdSetString(&printer->device_uri, "file:///dev/null");
/*
* See if we have a PPD file attached to the request...
*/
if (con->filename)
{
need_restart_job = 1;
changed_driver = 1;
strlcpy(srcfile, con->filename, sizeof(srcfile));
if ((fp = cupsFileOpen(srcfile, "rb")))
{
/*
* Yes; get the first line from it...
*/
line[0] = '\0';
cupsFileGets(fp, line, sizeof(line));
cupsFileClose(fp);
/*
* Then see what kind of file it is...
*/
if (strncmp(line, "*PPD-Adobe", 10))
{
send_ipp_status(con, IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED, _("Bad PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
/*
* The new file is a PPD file, so move the file over to the ppd
* directory...
*/
if (copy_file(srcfile, dstfile, ConfigFilePerm))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file - %s"), strerror(errno));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
else if ((attr = ippFindAttribute(con->request, "ppd-name", IPP_TAG_NAME)) != NULL)
{
const char *ppd_name = ippGetString(attr, 0, NULL);
/* ppd-name value */
need_restart_job = 1;
changed_driver = 1;
if (!strcmp(ppd_name, "raw"))
{
/*
* Raw driver, remove any existing PPD file.
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
unlink(dstfile);
}
else if (strstr(ppd_name, "../"))
{
send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
else
{
/*
* PPD model file...
*/
snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot, printer->name);
if (copy_model(con, ppd_name, dstfile))
{
send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
if (!modify)
cupsdDeletePrinter(printer, 0);
return;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "Copied PPD file successfully");
}
}
if (changed_driver)
{
/*
* If we changed the PPD, then remove the printer's cache file and clear the
* printer-state-reasons...
*/
char cache_name[1024]; /* Cache filename for printer attrs */
snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, printer->name);
unlink(cache_name);
cupsdSetPrinterReasons(printer, "none");
/*
* (Re)register color profiles...
*/
cupsdRegisterColor(printer);
}
/*
* If we set the device URI but not the port monitor, check which port
* monitor to use by default...
*/
if (set_device_uri && !set_port_monitor)
{
ppd_file_t *ppd; /* PPD file */
ppd_attr_t *ppdattr; /* cupsPortMonitor attribute */
httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
snprintf(srcfile, sizeof(srcfile), "%s/ppd/%s.ppd", ServerRoot,
printer->name);
if ((ppd = _ppdOpenFile(srcfile, _PPD_LOCALIZATION_NONE)) != NULL)
{
for (ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL);
ppdattr;
ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL))
if (!strcmp(scheme, ppdattr->spec))
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Setting %s port-monitor to \"%s\" (was \"%s\".)",
printer->name, ppdattr->value,
printer->port_monitor ? printer->port_monitor
: "none");
if (strcmp(ppdattr->value, "none"))
cupsdSetString(&printer->port_monitor, ppdattr->value);
else
cupsdClearString(&printer->port_monitor);
break;
}
ppdClose(ppd);
}
}
printer->config_time = time(NULL);
/*
* Update the printer attributes and return...
*/
cupsdSetPrinterAttrs(printer);
if (!printer->temporary)
cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
if (need_restart_job && printer->job)
{
/*
* Restart the current job...
*/
cupsdSetJobState(printer->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
"Job restarted because the printer was modified.");
}
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
if (modify)
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
printer, NULL, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
}
else
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
cupsdLogMessage(CUPSD_LOG_INFO, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
}
con->response->request.status.status_code = IPP_OK;
}
| C | cups | 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::componentComplete()
{
Q_D(QQuickWebView);
QQuickItem::componentComplete();
d->onComponentComplete();
d->updateViewportSize();
}
| void QQuickWebView::componentComplete()
{
Q_D(QQuickWebView);
QQuickItem::componentComplete();
d->onComponentComplete();
d->updateViewportSize();
}
| C | Chrome | 0 |
CVE-2016-5155 | https://www.cvedetails.com/cve/CVE-2016-5155/ | CWE-254 | https://github.com/chromium/chromium/commit/32a9879fc01c24f9216bb2975200ab8a4afac80c | 32a9879fc01c24f9216bb2975200ab8a4afac80c | Prefer SyncService over ProfileSyncService in foreign_session_helper
SyncService is the interface, ProfileSyncService is the concrete
implementation. Generally no clients should need to use the conrete
implementation - for one, testing will be much easier once everyone
uses the interface only.
Bug: 924508
Change-Id: Ia210665f8f02512053d1a60d627dea0f22758387
Reviewed-on: https://chromium-review.googlesource.com/c/1461119
Auto-Submit: Marc Treib <[email protected]>
Commit-Queue: Yaron Friedman <[email protected]>
Reviewed-by: Yaron Friedman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#630662} | bool ShouldSkipSession(const SyncedSession& session) {
for (const auto& window_pair : session.windows) {
const sessions::SessionWindow& window = window_pair.second->wrapped_window;
if (!ShouldSkipWindow(window))
return false;
}
return true;
}
| bool ShouldSkipSession(const SyncedSession& session) {
for (const auto& window_pair : session.windows) {
const sessions::SessionWindow& window = window_pair.second->wrapped_window;
if (!ShouldSkipWindow(window))
return false;
}
return true;
}
| C | Chrome | 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} | HeadlessWebContents::Builder::MojoService::MojoService(
const std::string& service_name,
const ServiceFactoryCallback& service_factory)
: service_name(service_name), service_factory(service_factory) {}
| HeadlessWebContents::Builder::MojoService::MojoService(
const std::string& service_name,
const ServiceFactoryCallback& service_factory)
: service_name(service_name), service_factory(service_factory) {}
| C | Chrome | 0 |
CVE-2018-6198 | https://www.cvedetails.com/cve/CVE-2018-6198/ | CWE-59 | https://github.com/tats/w3m/commit/18dcbadf2771cdb0c18509b14e4e73505b242753 | 18dcbadf2771cdb0c18509b14e4e73505b242753 | Make temporary directory safely when ~/.w3m is unwritable | dispincsrch(int ch, Str buf, Lineprop *prop)
{
static Buffer sbuf;
static Line *currentLine;
static int pos;
char *str;
int do_next_search = FALSE;
if (ch == 0 && buf == NULL) {
SAVE_BUFPOSITION(&sbuf); /* search starting point */
currentLine = sbuf.currentLine;
pos = sbuf.pos;
return -1;
}
str = buf->ptr;
switch (ch) {
case 022: /* C-r */
searchRoutine = backwardSearch;
do_next_search = TRUE;
break;
case 023: /* C-s */
searchRoutine = forwardSearch;
do_next_search = TRUE;
break;
#ifdef USE_MIGEMO
case 034:
migemo_active = -migemo_active;
goto done;
#endif
default:
if (ch >= 0)
return ch; /* use InputKeymap */
}
if (do_next_search) {
if (*str) {
if (searchRoutine == forwardSearch)
Currentbuf->pos += 1;
SAVE_BUFPOSITION(&sbuf);
if (srchcore(str, searchRoutine) == SR_NOTFOUND
&& searchRoutine == forwardSearch) {
Currentbuf->pos -= 1;
SAVE_BUFPOSITION(&sbuf);
}
arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_FORCE_REDRAW);
clear_mark(Currentbuf->currentLine);
return -1;
}
else
return 020; /* _prev completion for C-s C-s */
}
else if (*str) {
RESTORE_BUFPOSITION(&sbuf);
arrangeCursor(Currentbuf);
srchcore(str, searchRoutine);
arrangeCursor(Currentbuf);
currentLine = Currentbuf->currentLine;
pos = Currentbuf->pos;
}
displayBuffer(Currentbuf, B_FORCE_REDRAW);
clear_mark(Currentbuf->currentLine);
#ifdef USE_MIGEMO
done:
while (*str++ != '\0') {
if (migemo_active > 0)
*prop++ |= PE_UNDER;
else
*prop++ &= ~PE_UNDER;
}
#endif
return -1;
}
| dispincsrch(int ch, Str buf, Lineprop *prop)
{
static Buffer sbuf;
static Line *currentLine;
static int pos;
char *str;
int do_next_search = FALSE;
if (ch == 0 && buf == NULL) {
SAVE_BUFPOSITION(&sbuf); /* search starting point */
currentLine = sbuf.currentLine;
pos = sbuf.pos;
return -1;
}
str = buf->ptr;
switch (ch) {
case 022: /* C-r */
searchRoutine = backwardSearch;
do_next_search = TRUE;
break;
case 023: /* C-s */
searchRoutine = forwardSearch;
do_next_search = TRUE;
break;
#ifdef USE_MIGEMO
case 034:
migemo_active = -migemo_active;
goto done;
#endif
default:
if (ch >= 0)
return ch; /* use InputKeymap */
}
if (do_next_search) {
if (*str) {
if (searchRoutine == forwardSearch)
Currentbuf->pos += 1;
SAVE_BUFPOSITION(&sbuf);
if (srchcore(str, searchRoutine) == SR_NOTFOUND
&& searchRoutine == forwardSearch) {
Currentbuf->pos -= 1;
SAVE_BUFPOSITION(&sbuf);
}
arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_FORCE_REDRAW);
clear_mark(Currentbuf->currentLine);
return -1;
}
else
return 020; /* _prev completion for C-s C-s */
}
else if (*str) {
RESTORE_BUFPOSITION(&sbuf);
arrangeCursor(Currentbuf);
srchcore(str, searchRoutine);
arrangeCursor(Currentbuf);
currentLine = Currentbuf->currentLine;
pos = Currentbuf->pos;
}
displayBuffer(Currentbuf, B_FORCE_REDRAW);
clear_mark(Currentbuf->currentLine);
#ifdef USE_MIGEMO
done:
while (*str++ != '\0') {
if (migemo_active > 0)
*prop++ |= PE_UNDER;
else
*prop++ &= ~PE_UNDER;
}
#endif
return -1;
}
| C | w3m | 0 |
CVE-2016-5200 | https://www.cvedetails.com/cve/CVE-2016-5200/ | CWE-119 | https://github.com/chromium/chromium/commit/2f19869af13bbfdcfd682a55c0d2c61c6e102475 | 2f19869af13bbfdcfd682a55c0d2c61c6e102475 | chrome/browser/ui/webauthn: long domains may cause a line break.
As requested by UX in [1], allow long host names to split a title into
two lines. This allows us to show more of the name before eliding,
although sufficiently long names will still trigger elision.
Screenshot at
https://drive.google.com/open?id=1_V6t2CeZDAVazy3Px-OET2LnB__aEW1r.
[1] https://docs.google.com/presentation/d/1TtxkPUchyVZulqgdMcfui-68B0W-DWaFFVJEffGIbLA/edit#slide=id.g5913c4105f_1_12
Change-Id: I70f6541e0db3e9942239304de43b487a7561ca34
Bug: 870892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601812
Auto-Submit: Adam Langley <[email protected]>
Commit-Queue: Nina Satragno <[email protected]>
Reviewed-by: Nina Satragno <[email protected]>
Cr-Commit-Position: refs/heads/master@{#658114} | bool AuthenticatorNotRegisteredErrorModel::IsBackButtonVisible() const {
return false;
}
| bool AuthenticatorNotRegisteredErrorModel::IsBackButtonVisible() const {
return false;
}
| C | Chrome | 0 |
CVE-2011-2861 | https://www.cvedetails.com/cve/CVE-2011-2861/ | CWE-20 | https://github.com/chromium/chromium/commit/8262245d384be025f13e2a5b3a03b7e5c98374ce | 8262245d384be025f13e2a5b3a03b7e5c98374ce | DevTools: move DevToolsAgent/Client into content.
BUG=84078
TEST=
Review URL: http://codereview.chromium.org/7461019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93596 0039d316-1c4b-4281-b951-d872f2087c98 | bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
return !extension_dispatcher_->is_extension_process();
}
| bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
return !extension_dispatcher_->is_extension_process();
}
| C | Chrome | 0 |
CVE-2015-3331 | https://www.cvedetails.com/cve/CVE-2015-3331/ | CWE-119 | https://github.com/torvalds/linux/commit/ccfe8c3f7e52ae83155cb038753f4c75b774ca8a | ccfe8c3f7e52ae83155cb038753f4c75b774ca8a | crypto: aesni - fix memory usage in GCM decryption
The kernel crypto API logic requires the caller to provide the
length of (ciphertext || authentication tag) as cryptlen for the
AEAD decryption operation. Thus, the cipher implementation must
calculate the size of the plaintext output itself and cannot simply use
cryptlen.
The RFC4106 GCM decryption operation tries to overwrite cryptlen memory
in req->dst. As the destination buffer for decryption only needs to hold
the plaintext memory but cryptlen references the input buffer holding
(ciphertext || authentication tag), the assumption of the destination
buffer length in RFC4106 GCM operation leads to a too large size. This
patch simply uses the already calculated plaintext size.
In addition, this patch fixes the offset calculation of the AAD buffer
pointer: as mentioned before, cryptlen already includes the size of the
tag. Thus, the tag does not need to be added. With the addition, the AAD
will be written beyond the already allocated buffer.
Note, this fixes a kernel crash that can be triggered from user space
via AF_ALG(aead) -- simply use the libkcapi test application
from [1] and update it to use rfc4106-gcm-aes.
Using [1], the changes were tested using CAVS vectors to demonstrate
that the crypto operation still delivers the right results.
[1] http://www.chronox.de/libkcapi.html
CC: Tadeusz Struk <[email protected]>
Cc: [email protected]
Signed-off-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]> | static int ablk_ctr_init(struct crypto_tfm *tfm)
{
return ablk_init_common(tfm, "__driver-ctr-aes-aesni");
}
| static int ablk_ctr_init(struct crypto_tfm *tfm)
{
return ablk_init_common(tfm, "__driver-ctr-aes-aesni");
}
| C | linux | 0 |
CVE-2015-1335 | https://www.cvedetails.com/cve/CVE-2015-1335/ | CWE-59 | https://github.com/lxc/lxc/commit/592fd47a6245508b79fe6ac819fe6d3b2c1289be | 592fd47a6245508b79fe6ac819fe6d3b2c1289be | CVE-2015-1335: Protect container mounts against symlinks
When a container starts up, lxc sets up the container's inital fstree
by doing a bunch of mounting, guided by the container configuration
file. The container config is owned by the admin or user on the host,
so we do not try to guard against bad entries. However, since the
mount target is in the container, it's possible that the container admin
could divert the mount with symbolic links. This could bypass proper
container startup (i.e. confinement of a root-owned container by the
restrictive apparmor policy, by diverting the required write to
/proc/self/attr/current), or bypass the (path-based) apparmor policy
by diverting, say, /proc to /mnt in the container.
To prevent this,
1. do not allow mounts to paths containing symbolic links
2. do not allow bind mounts from relative paths containing symbolic
links.
Details:
Define safe_mount which ensures that the container has not inserted any
symbolic links into any mount targets for mounts to be done during
container setup.
The host's mount path may contain symbolic links. As it is under the
control of the administrator, that's ok. So safe_mount begins the check
for symbolic links after the rootfs->mount, by opening that directory.
It opens each directory along the path using openat() relative to the
parent directory using O_NOFOLLOW. When the target is reached, it
mounts onto /proc/self/fd/<targetfd>.
Use safe_mount() in mount_entry(), when mounting container proc,
and when needed. In particular, safe_mount() need not be used in
any case where:
1. the mount is done in the container's namespace
2. the mount is for the container's rootfs
3. the mount is relative to a tmpfs or proc/sysfs which we have
just safe_mount()ed ourselves
Since we were using proc/net as a temporary placeholder for /proc/sys/net
during container startup, and proc/net is a symbolic link, use proc/tty
instead.
Update the lxc.container.conf manpage with details about the new
restrictions.
Finally, add a testcase to test some symbolic link possibilities.
Reported-by: Roman Fiedler
Signed-off-by: Serge Hallyn <[email protected]>
Acked-by: Stéphane Graber <[email protected]> | static int setup_network(struct lxc_list *network)
{
struct lxc_list *iterator;
struct lxc_netdev *netdev;
lxc_list_for_each(iterator, network) {
netdev = iterator->elem;
if (setup_netdev(netdev)) {
ERROR("failed to setup netdev");
return -1;
}
}
if (!lxc_list_empty(network))
INFO("network has been setup");
return 0;
}
| static int setup_network(struct lxc_list *network)
{
struct lxc_list *iterator;
struct lxc_netdev *netdev;
lxc_list_for_each(iterator, network) {
netdev = iterator->elem;
if (setup_netdev(netdev)) {
ERROR("failed to setup netdev");
return -1;
}
}
if (!lxc_list_empty(network))
INFO("network has been setup");
return 0;
}
| C | lxc | 0 |
CVE-2013-2884 | https://www.cvedetails.com/cve/CVE-2013-2884/ | CWE-399 | https://github.com/chromium/chromium/commit/4ac8bc08e3306f38a5ab3e551aef6ad43753579c | 4ac8bc08e3306f38a5ab3e551aef6ad43753579c | Set Attr.ownerDocument in Element#setAttributeNode()
Attr objects can move across documents by setAttributeNode().
So It needs to reset ownerDocument through TreeScopeAdoptr::adoptIfNeeded().
BUG=248950
TEST=set-attribute-node-from-iframe.html
Review URL: https://chromiumcodereview.appspot.com/17583003
git-svn-id: svn://svn.chromium.org/blink/trunk@152938 bbb929c8-8fbe-4397-9dbb-9b2b20218538 | NamedNodeMap* Element::attributes() const
{
ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareData();
if (NamedNodeMap* attributeMap = rareData->attributeMap())
return attributeMap;
rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this)));
return rareData->attributeMap();
}
| NamedNodeMap* Element::attributes() const
{
ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareData();
if (NamedNodeMap* attributeMap = rareData->attributeMap())
return attributeMap;
rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this)));
return rareData->attributeMap();
}
| C | Chrome | 0 |
CVE-2019-12981 | https://www.cvedetails.com/cve/CVE-2019-12981/ | CWE-119 | https://github.com/libming/libming/pull/179/commits/3dc0338e4a36a3092720ebaa5b908ba3dca467d9 | 3dc0338e4a36a3092720ebaa5b908ba3dca467d9 | SWFShape_setLeftFillStyle: prevent fill overflow | void SWFShape_useVersion(SWFShape shape, int version)
{
if(shape->useVersion >= version)
return;
if(version > SWF_SHAPE4)
return;
shape->useVersion = version;
}
| void SWFShape_useVersion(SWFShape shape, int version)
{
if(shape->useVersion >= version)
return;
if(version > SWF_SHAPE4)
return;
shape->useVersion = version;
}
| C | libming | 0 |
CVE-2019-5827 | https://www.cvedetails.com/cve/CVE-2019-5827/ | CWE-190 | https://github.com/chromium/chromium/commit/517ac71c9ee27f856f9becde8abea7d1604af9d4 | 517ac71c9ee27f856f9becde8abea7d1604af9d4 | sqlite: backport bugfixes for dbfuzz2
Bug: 952406
Change-Id: Icbec429742048d6674828726c96d8e265c41b595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1568152
Reviewed-by: Chris Mumford <[email protected]>
Commit-Queue: Darwin Huang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#651030} | static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
BtShared *pBt = p->pBt;
MemPage *pRoot;
Pgno pgnoRoot;
int rc;
int ptfFlags; /* Page-type flage for the root page of new table */
assert( sqlite3BtreeHoldsMutex(p) );
assert( pBt->inTransaction==TRANS_WRITE );
assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
#ifdef SQLITE_OMIT_AUTOVACUUM
rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
if( rc ){
return rc;
}
#else
if( pBt->autoVacuum ){
Pgno pgnoMove; /* Move a page here to make room for the root-page */
MemPage *pPageMove; /* The page to move to. */
/* Creating a new table may probably require moving an existing database
** to make room for the new tables root page. In case this page turns
** out to be an overflow page, delete all overflow page-map caches
** held by open cursors.
*/
invalidateAllOverflowCache(pBt);
/* Read the value of meta[3] from the database to determine where the
** root page of the new table should go. meta[3] is the largest root-page
** created so far, so the new root-page is (meta[3]+1).
*/
sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);
pgnoRoot++;
/* The new root-page may not be allocated on a pointer-map page, or the
** PENDING_BYTE page.
*/
while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
pgnoRoot==PENDING_BYTE_PAGE(pBt) ){
pgnoRoot++;
}
assert( pgnoRoot>=3 || CORRUPT_DB );
testcase( pgnoRoot<3 );
/* Allocate a page. The page that currently resides at pgnoRoot will
** be moved to the allocated page (unless the allocated page happens
** to reside at pgnoRoot).
*/
rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT);
if( rc!=SQLITE_OK ){
return rc;
}
if( pgnoMove!=pgnoRoot ){
/* pgnoRoot is the page that will be used for the root-page of
** the new table (assuming an error did not occur). But we were
** allocated pgnoMove. If required (i.e. if it was not allocated
** by extending the file), the current page at position pgnoMove
** is already journaled.
*/
u8 eType = 0;
Pgno iPtrPage = 0;
/* Save the positions of any open cursors. This is required in
** case they are holding a reference to an xFetch reference
** corresponding to page pgnoRoot. */
rc = saveAllCursors(pBt, 0, 0);
releasePage(pPageMove);
if( rc!=SQLITE_OK ){
return rc;
}
/* Move the page currently at pgnoRoot to pgnoMove. */
rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
if( rc!=SQLITE_OK ){
return rc;
}
rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
rc = SQLITE_CORRUPT_BKPT;
}
if( rc!=SQLITE_OK ){
releasePage(pRoot);
return rc;
}
assert( eType!=PTRMAP_ROOTPAGE );
assert( eType!=PTRMAP_FREEPAGE );
rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);
releasePage(pRoot);
/* Obtain the page at pgnoRoot */
if( rc!=SQLITE_OK ){
return rc;
}
rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
if( rc!=SQLITE_OK ){
return rc;
}
rc = sqlite3PagerWrite(pRoot->pDbPage);
if( rc!=SQLITE_OK ){
releasePage(pRoot);
return rc;
}
}else{
pRoot = pPageMove;
}
/* Update the pointer-map and meta-data with the new root-page number. */
ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc);
if( rc ){
releasePage(pRoot);
return rc;
}
/* When the new root page was allocated, page 1 was made writable in
** order either to increase the database filesize, or to decrement the
** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail.
*/
assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) );
rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);
if( NEVER(rc) ){
releasePage(pRoot);
return rc;
}
}else{
rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
if( rc ) return rc;
}
#endif
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
if( createTabFlags & BTREE_INTKEY ){
ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF;
}else{
ptfFlags = PTF_ZERODATA | PTF_LEAF;
}
zeroPage(pRoot, ptfFlags);
sqlite3PagerUnref(pRoot->pDbPage);
assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );
*piTable = (int)pgnoRoot;
return SQLITE_OK;
}
| static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
BtShared *pBt = p->pBt;
MemPage *pRoot;
Pgno pgnoRoot;
int rc;
int ptfFlags; /* Page-type flage for the root page of new table */
assert( sqlite3BtreeHoldsMutex(p) );
assert( pBt->inTransaction==TRANS_WRITE );
assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
#ifdef SQLITE_OMIT_AUTOVACUUM
rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
if( rc ){
return rc;
}
#else
if( pBt->autoVacuum ){
Pgno pgnoMove; /* Move a page here to make room for the root-page */
MemPage *pPageMove; /* The page to move to. */
/* Creating a new table may probably require moving an existing database
** to make room for the new tables root page. In case this page turns
** out to be an overflow page, delete all overflow page-map caches
** held by open cursors.
*/
invalidateAllOverflowCache(pBt);
/* Read the value of meta[3] from the database to determine where the
** root page of the new table should go. meta[3] is the largest root-page
** created so far, so the new root-page is (meta[3]+1).
*/
sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);
pgnoRoot++;
/* The new root-page may not be allocated on a pointer-map page, or the
** PENDING_BYTE page.
*/
while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
pgnoRoot==PENDING_BYTE_PAGE(pBt) ){
pgnoRoot++;
}
assert( pgnoRoot>=3 || CORRUPT_DB );
testcase( pgnoRoot<3 );
/* Allocate a page. The page that currently resides at pgnoRoot will
** be moved to the allocated page (unless the allocated page happens
** to reside at pgnoRoot).
*/
rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT);
if( rc!=SQLITE_OK ){
return rc;
}
if( pgnoMove!=pgnoRoot ){
/* pgnoRoot is the page that will be used for the root-page of
** the new table (assuming an error did not occur). But we were
** allocated pgnoMove. If required (i.e. if it was not allocated
** by extending the file), the current page at position pgnoMove
** is already journaled.
*/
u8 eType = 0;
Pgno iPtrPage = 0;
/* Save the positions of any open cursors. This is required in
** case they are holding a reference to an xFetch reference
** corresponding to page pgnoRoot. */
rc = saveAllCursors(pBt, 0, 0);
releasePage(pPageMove);
if( rc!=SQLITE_OK ){
return rc;
}
/* Move the page currently at pgnoRoot to pgnoMove. */
rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
if( rc!=SQLITE_OK ){
return rc;
}
rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
rc = SQLITE_CORRUPT_BKPT;
}
if( rc!=SQLITE_OK ){
releasePage(pRoot);
return rc;
}
assert( eType!=PTRMAP_ROOTPAGE );
assert( eType!=PTRMAP_FREEPAGE );
rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);
releasePage(pRoot);
/* Obtain the page at pgnoRoot */
if( rc!=SQLITE_OK ){
return rc;
}
rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
if( rc!=SQLITE_OK ){
return rc;
}
rc = sqlite3PagerWrite(pRoot->pDbPage);
if( rc!=SQLITE_OK ){
releasePage(pRoot);
return rc;
}
}else{
pRoot = pPageMove;
}
/* Update the pointer-map and meta-data with the new root-page number. */
ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc);
if( rc ){
releasePage(pRoot);
return rc;
}
/* When the new root page was allocated, page 1 was made writable in
** order either to increase the database filesize, or to decrement the
** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail.
*/
assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) );
rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);
if( NEVER(rc) ){
releasePage(pRoot);
return rc;
}
}else{
rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
if( rc ) return rc;
}
#endif
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
if( createTabFlags & BTREE_INTKEY ){
ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF;
}else{
ptfFlags = PTF_ZERODATA | PTF_LEAF;
}
zeroPage(pRoot, ptfFlags);
sqlite3PagerUnref(pRoot->pDbPage);
assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );
*piTable = (int)pgnoRoot;
return SQLITE_OK;
}
| C | Chrome | 0 |
CVE-2015-8867 | https://www.cvedetails.com/cve/CVE-2015-8867/ | CWE-310 | https://git.php.net/?p=php-src.git;a=commit;h=16023f3e3b9c06cf677c3c980e8d574e4c162827 | 16023f3e3b9c06cf677c3c980e8d574e4c162827 | null | PHP_FUNCTION(openssl_public_decrypt)
{
zval **key, *crypted;
EVP_PKEY *pkey;
int cryptedlen;
unsigned char *cryptedbuf = NULL;
unsigned char *crypttemp;
int successful = 0;
long keyresource = -1;
long padding = RSA_PKCS1_PADDING;
char * data;
int data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szZ|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
return;
}
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC);
if (pkey == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key parameter is not a valid public key");
RETURN_FALSE;
}
cryptedlen = EVP_PKEY_size(pkey);
crypttemp = emalloc(cryptedlen + 1);
switch (pkey->type) {
case EVP_PKEY_RSA:
case EVP_PKEY_RSA2:
cryptedlen = RSA_public_decrypt(data_len,
(unsigned char *)data,
crypttemp,
pkey->pkey.rsa,
padding);
if (cryptedlen != -1) {
cryptedbuf = emalloc(cryptedlen + 1);
memcpy(cryptedbuf, crypttemp, cryptedlen);
successful = 1;
}
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
}
efree(crypttemp);
if (successful) {
zval_dtor(crypted);
cryptedbuf[cryptedlen] = '\0';
ZVAL_STRINGL(crypted, (char *)cryptedbuf, cryptedlen, 0);
cryptedbuf = NULL;
RETVAL_TRUE;
}
if (cryptedbuf) {
efree(cryptedbuf);
}
if (keyresource == -1) {
EVP_PKEY_free(pkey);
}
}
| PHP_FUNCTION(openssl_public_decrypt)
{
zval **key, *crypted;
EVP_PKEY *pkey;
int cryptedlen;
unsigned char *cryptedbuf = NULL;
unsigned char *crypttemp;
int successful = 0;
long keyresource = -1;
long padding = RSA_PKCS1_PADDING;
char * data;
int data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szZ|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
return;
}
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC);
if (pkey == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key parameter is not a valid public key");
RETURN_FALSE;
}
cryptedlen = EVP_PKEY_size(pkey);
crypttemp = emalloc(cryptedlen + 1);
switch (pkey->type) {
case EVP_PKEY_RSA:
case EVP_PKEY_RSA2:
cryptedlen = RSA_public_decrypt(data_len,
(unsigned char *)data,
crypttemp,
pkey->pkey.rsa,
padding);
if (cryptedlen != -1) {
cryptedbuf = emalloc(cryptedlen + 1);
memcpy(cryptedbuf, crypttemp, cryptedlen);
successful = 1;
}
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
}
efree(crypttemp);
if (successful) {
zval_dtor(crypted);
cryptedbuf[cryptedlen] = '\0';
ZVAL_STRINGL(crypted, (char *)cryptedbuf, cryptedlen, 0);
cryptedbuf = NULL;
RETVAL_TRUE;
}
if (cryptedbuf) {
efree(cryptedbuf);
}
if (keyresource == -1) {
EVP_PKEY_free(pkey);
}
}
| C | php | 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]> | xt_unregister_targets(struct xt_target *target, unsigned int n)
{
while (n-- > 0)
xt_unregister_target(&target[n]);
}
| xt_unregister_targets(struct xt_target *target, unsigned int n)
{
while (n-- > 0)
xt_unregister_target(&target[n]);
}
| C | linux | 0 |
CVE-2017-0820 | https://www.cvedetails.com/cve/CVE-2017-0820/ | null | https://android.googlesource.com/platform/frameworks/av/+/8a3a2f6ea7defe1a81bb32b3c9f3537f84749b9d | 8a3a2f6ea7defe1a81bb32b3c9f3537f84749b9d | Skip track if verification fails
Bug: 62187433
Test: ran poc, CTS
Change-Id: Ib9b0b6de88d046d8149e9ea5073d6c40ffec7b0c
(cherry picked from commit ef8c7830d838d877e6b37b75b47294b064c79397)
| status_t MPEG4Source::init() {
if (mFirstMoofOffset != 0) {
off64_t offset = mFirstMoofOffset;
return parseChunk(&offset);
}
return OK;
}
| status_t MPEG4Source::init() {
if (mFirstMoofOffset != 0) {
off64_t offset = mFirstMoofOffset;
return parseChunk(&offset);
}
return OK;
}
| C | Android | 0 |
CVE-2012-5534 | https://www.cvedetails.com/cve/CVE-2012-5534/ | CWE-20 | https://git.savannah.gnu.org/gitweb/?p=weechat.git;a=commitdiff_plain;h=efb795c74fe954b9544074aafcebb1be4452b03a | efb795c74fe954b9544074aafcebb1be4452b03a | null | hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
gnutls_retr2_st *answer)
#else
gnutls_retr_st *answer)
#endif
{
struct t_hook *ptr_hook;
int rc;
rc = -1;
ptr_hook = weechat_hooks[HOOK_TYPE_CONNECT];
while (ptr_hook)
{
/* looking for the right hook using to the gnutls session pointer */
if (!ptr_hook->deleted
&& HOOK_CONNECT(ptr_hook, gnutls_sess)
&& (*(HOOK_CONNECT(ptr_hook, gnutls_sess)) == tls_session))
{
rc = (int) (HOOK_CONNECT(ptr_hook, gnutls_cb))
(ptr_hook->callback_data, tls_session, req_ca, nreq,
pk_algos, pk_algos_len, answer,
WEECHAT_HOOK_CONNECT_GNUTLS_CB_SET_CERT);
break;
}
ptr_hook = ptr_hook->next_hook;
}
return rc;
}
| hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
gnutls_retr2_st *answer)
#else
gnutls_retr_st *answer)
#endif
{
struct t_hook *ptr_hook;
int rc;
rc = -1;
ptr_hook = weechat_hooks[HOOK_TYPE_CONNECT];
while (ptr_hook)
{
/* looking for the right hook using to the gnutls session pointer */
if (!ptr_hook->deleted
&& HOOK_CONNECT(ptr_hook, gnutls_sess)
&& (*(HOOK_CONNECT(ptr_hook, gnutls_sess)) == tls_session))
{
rc = (int) (HOOK_CONNECT(ptr_hook, gnutls_cb))
(ptr_hook->callback_data, tls_session, req_ca, nreq,
pk_algos, pk_algos_len, answer,
WEECHAT_HOOK_CONNECT_GNUTLS_CB_SET_CERT);
break;
}
ptr_hook = ptr_hook->next_hook;
}
return rc;
}
| C | savannah | 0 |
CVE-2016-9191 | https://www.cvedetails.com/cve/CVE-2016-9191/ | CWE-20 | https://github.com/torvalds/linux/commit/93362fa47fe98b62e4a34ab408c4a418432e7939 | 93362fa47fe98b62e4a34ab408c4a418432e7939 | sysctl: Drop reference added by grab_header in proc_sys_readdir
Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference
added by grab_header when return from !dir_emit_dots path.
It can cause any path called unregister_sysctl_table will
wait forever.
The calltrace of CVE-2016-9191:
[ 5535.960522] Call Trace:
[ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0
[ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0
[ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130
[ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130
[ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80
[ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0
[ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0
[ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0
[ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0
[ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40
[ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450
[ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0
[ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0
[ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210
[ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450
[ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60
[ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10
[ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450
[ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220
[ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60
[ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220
[ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710
[ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710
[ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0
[ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710
[ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120
[ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40
[ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230
One cgroup maintainer mentioned that "cgroup is trying to offline
a cpuset css, which takes place under cgroup_mutex. The offlining
ends up trying to drain active usages of a sysctl table which apprently
is not happening."
The real reason is that proc_sys_readdir doesn't drop reference added
by grab_header when return from !dir_emit_dots path. So this cpuset
offline path will wait here forever.
See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13
Fixes: f0c3b5093add ("[readdir] convert procfs")
Cc: [email protected]
Reported-by: CAI Qian <[email protected]>
Tested-by: Yang Shukui <[email protected]>
Signed-off-by: Zhou Chengming <[email protected]>
Acked-by: Al Viro <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]> | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table)
{
return __register_sysctl_paths(&sysctl_table_root.default_set,
path, table);
}
| struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table)
{
return __register_sysctl_paths(&sysctl_table_root.default_set,
path, table);
}
| C | linux | 0 |
CVE-2012-0045 | https://www.cvedetails.com/cve/CVE-2012-0045/ | null | https://github.com/torvalds/linux/commit/c2226fc9e87ba3da060e47333657cd6616652b84 | c2226fc9e87ba3da060e47333657cd6616652b84 | KVM: x86: fix missing checks in syscall emulation
On hosts without this patch, 32bit guests will crash (and 64bit guests
may behave in a wrong way) for example by simply executing following
nasm-demo-application:
[bits 32]
global _start
SECTION .text
_start: syscall
(I tested it with winxp and linux - both always crashed)
Disassembly of section .text:
00000000 <_start>:
0: 0f 05 syscall
The reason seems a missing "invalid opcode"-trap (int6) for the
syscall opcode "0f05", which is not available on Intel CPUs
within non-longmodes, as also on some AMD CPUs within legacy-mode.
(depending on CPU vendor, MSR_EFER and cpuid)
Because previous mentioned OSs may not engage corresponding
syscall target-registers (STAR, LSTAR, CSTAR), they remain
NULL and (non trapping) syscalls are leading to multiple
faults and finally crashs.
Depending on the architecture (AMD or Intel) pretended by
guests, various checks according to vendor's documentation
are implemented to overcome the current issue and behave
like the CPUs physical counterparts.
[mtosatti: cleanup/beautify code]
Signed-off-by: Stephan Baerwolf <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]> | static int check_svme(struct x86_emulate_ctxt *ctxt)
{
u64 efer;
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if (!(efer & EFER_SVME))
return emulate_ud(ctxt);
return X86EMUL_CONTINUE;
}
| static int check_svme(struct x86_emulate_ctxt *ctxt)
{
u64 efer;
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if (!(efer & EFER_SVME))
return emulate_ud(ctxt);
return X86EMUL_CONTINUE;
}
| C | linux | 0 |
null | null | null | https://github.com/chromium/chromium/commit/8a50f99c25fb70ff43aaa82b6f9569db383f0ca8 | 8a50f99c25fb70ff43aaa82b6f9569db383f0ca8 | [Sync] Rework unit tests for ChromeInvalidationClient
In particular, add unit tests that would have caught bug 139424.
Dep-inject InvalidationClient into ChromeInvalidationClient.
Use the function name 'UpdateRegisteredIds' consistently.
Replace some mocks with fakes.
BUG=139424
Review URL: https://chromiumcodereview.appspot.com/10827133
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150665 0039d316-1c4b-4281-b951-d872f2087c98 | ChromeInvalidationClientTest()
: kBookmarksId_(kChromeSyncSourceId, "BOOKMARK"),
kPreferencesId_(kChromeSyncSourceId, "PREFERENCE"),
kExtensionsId_(kChromeSyncSourceId, "EXTENSION"),
| ChromeInvalidationClientTest()
: fake_push_client_(new notifier::FakePushClient()),
client_(scoped_ptr<notifier::PushClient>(fake_push_client_)),
kBookmarksId_(kChromeSyncSourceId, "BOOKMARK"),
kPreferencesId_(kChromeSyncSourceId, "PREFERENCE"),
kExtensionsId_(kChromeSyncSourceId, "EXTENSION"),
kAppsId_(kChromeSyncSourceId, "APP") {}
| C | Chrome | 1 |
CVE-2015-8126 | https://www.cvedetails.com/cve/CVE-2015-8126/ | CWE-119 | https://github.com/chromium/chromium/commit/7f3d85b096f66870a15b37c2f40b219b2e292693 | 7f3d85b096f66870a15b37c2f40b219b2e292693 | third_party/libpng: update to 1.2.54
[email protected]
BUG=560291
Review URL: https://codereview.chromium.org/1467263003
Cr-Commit-Position: refs/heads/master@{#362298} | png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{
#endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
#endif
#endif
int i;
png_debug(1, "in png_create_read_struct");
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
#else
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
#endif
if (png_ptr == NULL)
return (NULL);
/* Added at libpng-1.2.6 */
#ifdef PNG_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
/* Added at libpng-1.2.43 and 1.4.0 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
#else
if (setjmp(png_ptr->jmpbuf))
#endif
{
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
return (NULL);
}
#ifdef USE_FAR_KEYWORD
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#endif
#endif /* PNG_SETJMP_SUPPORTED */
#ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
#endif
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver != NULL)
{
int found_dots = 0;
i = -1;
do
{
i++;
if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (user_png_ver[i] == '.')
found_dots++;
} while (found_dots < 2 && user_png_ver[i] != 0 &&
PNG_LIBPNG_VER_STRING[i] != 0);
}
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version.
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[80];
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_ptr->flags = 0;
#endif
png_error(png_ptr,
"Incompatible libpng version in application and library");
}
}
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = (voidpf)png_ptr;
switch (inflateInit(&png_ptr->zstream))
{
case Z_OK: /* Do nothing */ break;
case Z_MEM_ERROR:
case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error");
break;
case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error");
break;
default: png_error(png_ptr, "Unknown zlib error");
}
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
#ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then
encounter a png_error() will longjmp here. Since the jmpbuf is
then meaningless we abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
#endif
#endif /* PNG_SETJMP_SUPPORTED */
return (png_ptr);
}
| png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{
#endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
#endif
#endif
int i;
png_debug(1, "in png_create_read_struct");
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
#else
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
#endif
if (png_ptr == NULL)
return (NULL);
/* Added at libpng-1.2.6 */
#ifdef PNG_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
/* Added at libpng-1.2.43 and 1.4.0 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
#else
if (setjmp(png_ptr->jmpbuf))
#endif
{
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
return (NULL);
}
#ifdef USE_FAR_KEYWORD
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#endif
#endif /* PNG_SETJMP_SUPPORTED */
#ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
#endif
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver != NULL)
{
int found_dots = 0;
i = -1;
do
{
i++;
if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (user_png_ver[i] == '.')
found_dots++;
} while (found_dots < 2 && user_png_ver[i] != 0 &&
PNG_LIBPNG_VER_STRING[i] != 0);
}
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version.
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[80];
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_ptr->flags = 0;
#endif
png_error(png_ptr,
"Incompatible libpng version in application and library");
}
}
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = (voidpf)png_ptr;
switch (inflateInit(&png_ptr->zstream))
{
case Z_OK: /* Do nothing */ break;
case Z_MEM_ERROR:
case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error");
break;
case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error");
break;
default: png_error(png_ptr, "Unknown zlib error");
}
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
#ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then
encounter a png_error() will longjmp here. Since the jmpbuf is
then meaningless we abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
#endif
#endif /* PNG_SETJMP_SUPPORTED */
return (png_ptr);
}
| C | Chrome | 0 |
CVE-2018-9491 | https://www.cvedetails.com/cve/CVE-2018-9491/ | CWE-190 | https://android.googlesource.com/platform/frameworks/av/+/2b4667baa5a2badbdfec1794156ee17d4afef37c | 2b4667baa5a2badbdfec1794156ee17d4afef37c | Check for overflow of crypto size
Bug: 111603051
Test: CTS
Change-Id: Ib5b1802b9b35769a25c16e2b977308cf7a810606
(cherry picked from commit d1fd02761236b35a336434367131f71bef7405c9)
| media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec *mData, size_t idx, bool render) {
if (render) {
return translate_error(mData->mCodec->renderOutputBufferAndRelease(idx));
} else {
return translate_error(mData->mCodec->releaseOutputBuffer(idx));
}
}
| media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec *mData, size_t idx, bool render) {
if (render) {
return translate_error(mData->mCodec->renderOutputBufferAndRelease(idx));
} else {
return translate_error(mData->mCodec->releaseOutputBuffer(idx));
}
}
| C | Android | 0 |
CVE-2017-15088 | https://www.cvedetails.com/cve/CVE-2017-15088/ | CWE-119 | https://github.com/krb5/krb5/commit/fbb687db1088ddd894d975996e5f6a4252b9a2b4 | fbb687db1088ddd894d975996e5f6a4252b9a2b4 | Fix PKINIT cert matching data construction
Rewrite X509_NAME_oneline_ex() and its call sites to use dynamic
allocation and to perform proper error checking.
ticket: 8617
target_version: 1.16
target_version: 1.15-next
target_version: 1.14-next
tags: pullup | cms_contentinfo_create(krb5_context context, /* IN */
pkinit_plg_crypto_context plg_cryptoctx, /* IN */
pkinit_req_crypto_context req_cryptoctx, /* IN */
pkinit_identity_crypto_context id_cryptoctx, /* IN */
int cms_msg_type,
unsigned char *data, unsigned int data_len,
unsigned char **out_data, unsigned int *out_data_len)
{
krb5_error_code retval = ENOMEM;
ASN1_OBJECT *oid;
PKCS7 *p7 = NULL;
unsigned char *p;
/* Pick the correct oid for the eContentInfo. */
oid = pkinit_pkcs7type2oid(plg_cryptoctx, cms_msg_type);
if (oid == NULL)
goto cleanup;
retval = create_contentinfo(context, oid, data, data_len, &p7);
if (retval != 0)
goto cleanup;
*out_data_len = i2d_PKCS7(p7, NULL);
if (!(*out_data_len)) {
retval = oerr(context, 0, _("Failed to DER encode PKCS7"));
goto cleanup;
}
retval = ENOMEM;
if ((p = *out_data = malloc(*out_data_len)) == NULL)
goto cleanup;
/* DER encode PKCS7 data */
retval = i2d_PKCS7(p7, &p);
if (!retval) {
retval = oerr(context, 0, _("Failed to DER encode PKCS7"));
goto cleanup;
}
retval = 0;
cleanup:
if (p7)
PKCS7_free(p7);
return retval;
}
| cms_contentinfo_create(krb5_context context, /* IN */
pkinit_plg_crypto_context plg_cryptoctx, /* IN */
pkinit_req_crypto_context req_cryptoctx, /* IN */
pkinit_identity_crypto_context id_cryptoctx, /* IN */
int cms_msg_type,
unsigned char *data, unsigned int data_len,
unsigned char **out_data, unsigned int *out_data_len)
{
krb5_error_code retval = ENOMEM;
ASN1_OBJECT *oid;
PKCS7 *p7 = NULL;
unsigned char *p;
/* Pick the correct oid for the eContentInfo. */
oid = pkinit_pkcs7type2oid(plg_cryptoctx, cms_msg_type);
if (oid == NULL)
goto cleanup;
retval = create_contentinfo(context, oid, data, data_len, &p7);
if (retval != 0)
goto cleanup;
*out_data_len = i2d_PKCS7(p7, NULL);
if (!(*out_data_len)) {
retval = oerr(context, 0, _("Failed to DER encode PKCS7"));
goto cleanup;
}
retval = ENOMEM;
if ((p = *out_data = malloc(*out_data_len)) == NULL)
goto cleanup;
/* DER encode PKCS7 data */
retval = i2d_PKCS7(p7, &p);
if (!retval) {
retval = oerr(context, 0, _("Failed to DER encode PKCS7"));
goto cleanup;
}
retval = 0;
cleanup:
if (p7)
PKCS7_free(p7);
return retval;
}
| C | krb5 | 0 |
CVE-2018-6117 | https://www.cvedetails.com/cve/CVE-2018-6117/ | CWE-200 | https://github.com/chromium/chromium/commit/52f6eb4221430b6248fd5a59bec53bfef9fdd9a7 | 52f6eb4221430b6248fd5a59bec53bfef9fdd9a7 | [md-settings] Clarify Password Saving and Autofill Toggles
This change clarifies the wording around the password saving and
autofill toggles.
Bug: 822465
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I91b31fe61cd0754239f7908e8c04c7e69b72f670
Reviewed-on: https://chromium-review.googlesource.com/970541
Commit-Queue: Jan Wilken Dörrie <[email protected]>
Reviewed-by: Vaclav Brozek <[email protected]>
Reviewed-by: Jochen Eisinger <[email protected]>
Cr-Commit-Position: refs/heads/master@{#544661} | void AddGoogleAssistantStrings(content::WebUIDataSource* html_source) {
LocalizedString localized_strings[] = {
{"googleAssistantPageTitle", IDS_SETTINGS_GOOGLE_ASSISTANT},
{"googleAssistantEnableContext",
IDS_SETTINGS_GOOGLE_ASSISTANT_ENABLE_CONTEXT},
{"googleAssistantEnableContextDescription",
IDS_SETTINGS_GOOGLE_ASSISTANT_ENABLE_CONTEXT_DESCRIPTION},
{"googleAssistantSettings", IDS_SETTINGS_GOOGLE_ASSISTANT_SETTINGS},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
}
| void AddGoogleAssistantStrings(content::WebUIDataSource* html_source) {
LocalizedString localized_strings[] = {
{"googleAssistantPageTitle", IDS_SETTINGS_GOOGLE_ASSISTANT},
{"googleAssistantEnableContext",
IDS_SETTINGS_GOOGLE_ASSISTANT_ENABLE_CONTEXT},
{"googleAssistantEnableContextDescription",
IDS_SETTINGS_GOOGLE_ASSISTANT_ENABLE_CONTEXT_DESCRIPTION},
{"googleAssistantSettings", IDS_SETTINGS_GOOGLE_ASSISTANT_SETTINGS},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
}
| C | Chrome | 0 |
CVE-2017-0379 | https://www.cvedetails.com/cve/CVE-2017-0379/ | CWE-200 | https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=da780c8183cccc8f533c8ace8211ac2cb2bdee7b | da780c8183cccc8f533c8ace8211ac2cb2bdee7b | null | test_ecdh_only_keys (ECC_secret_key *sk, unsigned int nbits, int flags)
{
ECC_public_key pk;
gcry_mpi_t test;
mpi_point_struct R_;
gcry_mpi_t x0, x1;
mpi_ec_t ec;
if (DBG_CIPHER)
log_debug ("Testing ECDH only key.\n");
point_init (&R_);
pk.E = _gcry_ecc_curve_copy (sk->E);
point_init (&pk.Q);
point_set (&pk.Q, &sk->Q);
if ((flags & PUBKEY_FLAG_DJB_TWEAK))
{
char *rndbuf;
test = mpi_new (256);
rndbuf = _gcry_random_bytes (32, GCRY_WEAK_RANDOM);
rndbuf[0] &= 0x7f; /* Clear bit 255. */
rndbuf[0] |= 0x40; /* Set bit 254. */
rndbuf[31] &= 0xf8; /* Clear bits 2..0 so that d mod 8 == 0 */
_gcry_mpi_set_buffer (test, rndbuf, 32, 0);
xfree (rndbuf);
}
else
{
test = mpi_new (nbits);
_gcry_mpi_randomize (test, nbits, GCRY_WEAK_RANDOM);
}
ec = _gcry_mpi_ec_p_internal_new (pk.E.model, pk.E.dialect, flags,
pk.E.p, pk.E.a, pk.E.b);
x0 = mpi_new (0);
x1 = mpi_new (0);
/* R_ = hkQ <=> R_ = hkdG */
_gcry_mpi_ec_mul_point (&R_, test, &pk.Q, ec);
if (!(flags & PUBKEY_FLAG_DJB_TWEAK))
_gcry_mpi_ec_mul_point (&R_, ec->h, &R_, ec);
if (_gcry_mpi_ec_get_affine (x0, NULL, &R_, ec))
log_fatal ("ecdh: Failed to get affine coordinates for hkQ\n");
_gcry_mpi_ec_mul_point (&R_, test, &pk.E.G, ec);
_gcry_mpi_ec_mul_point (&R_, sk->d, &R_, ec);
/* R_ = hdkG */
if (!(flags & PUBKEY_FLAG_DJB_TWEAK))
_gcry_mpi_ec_mul_point (&R_, ec->h, &R_, ec);
if (_gcry_mpi_ec_get_affine (x1, NULL, &R_, ec))
log_fatal ("ecdh: Failed to get affine coordinates for hdkG\n");
if (mpi_cmp (x0, x1))
{
log_fatal ("ECDH test failed.\n");
}
mpi_free (x0);
mpi_free (x1);
_gcry_mpi_ec_free (ec);
point_free (&pk.Q);
_gcry_ecc_curve_free (&pk.E);
point_free (&R_);
mpi_free (test);
}
| test_ecdh_only_keys (ECC_secret_key *sk, unsigned int nbits, int flags)
{
ECC_public_key pk;
gcry_mpi_t test;
mpi_point_struct R_;
gcry_mpi_t x0, x1;
mpi_ec_t ec;
if (DBG_CIPHER)
log_debug ("Testing ECDH only key.\n");
point_init (&R_);
pk.E = _gcry_ecc_curve_copy (sk->E);
point_init (&pk.Q);
point_set (&pk.Q, &sk->Q);
if ((flags & PUBKEY_FLAG_DJB_TWEAK))
{
char *rndbuf;
test = mpi_new (256);
rndbuf = _gcry_random_bytes (32, GCRY_WEAK_RANDOM);
rndbuf[0] &= 0x7f; /* Clear bit 255. */
rndbuf[0] |= 0x40; /* Set bit 254. */
rndbuf[31] &= 0xf8; /* Clear bits 2..0 so that d mod 8 == 0 */
_gcry_mpi_set_buffer (test, rndbuf, 32, 0);
xfree (rndbuf);
}
else
{
test = mpi_new (nbits);
_gcry_mpi_randomize (test, nbits, GCRY_WEAK_RANDOM);
}
ec = _gcry_mpi_ec_p_internal_new (pk.E.model, pk.E.dialect, flags,
pk.E.p, pk.E.a, pk.E.b);
x0 = mpi_new (0);
x1 = mpi_new (0);
/* R_ = hkQ <=> R_ = hkdG */
_gcry_mpi_ec_mul_point (&R_, test, &pk.Q, ec);
if (!(flags & PUBKEY_FLAG_DJB_TWEAK))
_gcry_mpi_ec_mul_point (&R_, ec->h, &R_, ec);
if (_gcry_mpi_ec_get_affine (x0, NULL, &R_, ec))
log_fatal ("ecdh: Failed to get affine coordinates for hkQ\n");
_gcry_mpi_ec_mul_point (&R_, test, &pk.E.G, ec);
_gcry_mpi_ec_mul_point (&R_, sk->d, &R_, ec);
/* R_ = hdkG */
if (!(flags & PUBKEY_FLAG_DJB_TWEAK))
_gcry_mpi_ec_mul_point (&R_, ec->h, &R_, ec);
if (_gcry_mpi_ec_get_affine (x1, NULL, &R_, ec))
log_fatal ("ecdh: Failed to get affine coordinates for hdkG\n");
if (mpi_cmp (x0, x1))
{
log_fatal ("ECDH test failed.\n");
}
mpi_free (x0);
mpi_free (x1);
_gcry_mpi_ec_free (ec);
point_free (&pk.Q);
_gcry_ecc_curve_free (&pk.E);
point_free (&R_);
mpi_free (test);
}
| C | gnupg | 0 |
CVE-2019-11811 | https://www.cvedetails.com/cve/CVE-2019-11811/ | CWE-416 | https://github.com/torvalds/linux/commit/401e7e88d4ef80188ffa07095ac00456f901b8c4 | 401e7e88d4ef80188ffa07095ac00456f901b8c4 | ipmi_si: fix use-after-free of resource->name
When we excute the following commands, we got oops
rmmod ipmi_si
cat /proc/ioports
[ 1623.482380] Unable to handle kernel paging request at virtual address ffff00000901d478
[ 1623.482382] Mem abort info:
[ 1623.482383] ESR = 0x96000007
[ 1623.482385] Exception class = DABT (current EL), IL = 32 bits
[ 1623.482386] SET = 0, FnV = 0
[ 1623.482387] EA = 0, S1PTW = 0
[ 1623.482388] Data abort info:
[ 1623.482389] ISV = 0, ISS = 0x00000007
[ 1623.482390] CM = 0, WnR = 0
[ 1623.482393] swapper pgtable: 4k pages, 48-bit VAs, pgdp = 00000000d7d94a66
[ 1623.482395] [ffff00000901d478] pgd=000000dffbfff003, pud=000000dffbffe003, pmd=0000003f5d06e003, pte=0000000000000000
[ 1623.482399] Internal error: Oops: 96000007 [#1] SMP
[ 1623.487407] Modules linked in: ipmi_si(E) nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm dm_mirror dm_region_hash dm_log iw_cm dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ses ghash_ce sha2_ce enclosure sha256_arm64 sg sha1_ce hisi_sas_v2_hw hibmc_drm sbsa_gwdt hisi_sas_main ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe mdio hns_dsaf ipmi_devintf hns_enet_drv ipmi_msghandler hns_mdio [last unloaded: ipmi_si]
[ 1623.532410] CPU: 30 PID: 11438 Comm: cat Kdump: loaded Tainted: G E 5.0.0-rc3+ #168
[ 1623.541498] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017
[ 1623.548822] pstate: a0000005 (NzCv daif -PAN -UAO)
[ 1623.553684] pc : string+0x28/0x98
[ 1623.557040] lr : vsnprintf+0x368/0x5e8
[ 1623.560837] sp : ffff000013213a80
[ 1623.564191] x29: ffff000013213a80 x28: ffff00001138abb5
[ 1623.569577] x27: ffff000013213c18 x26: ffff805f67d06049
[ 1623.574963] x25: 0000000000000000 x24: ffff00001138abb5
[ 1623.580349] x23: 0000000000000fb7 x22: ffff0000117ed000
[ 1623.585734] x21: ffff000011188fd8 x20: ffff805f67d07000
[ 1623.591119] x19: ffff805f67d06061 x18: ffffffffffffffff
[ 1623.596505] x17: 0000000000000200 x16: 0000000000000000
[ 1623.601890] x15: ffff0000117ed748 x14: ffff805f67d07000
[ 1623.607276] x13: ffff805f67d0605e x12: 0000000000000000
[ 1623.612661] x11: 0000000000000000 x10: 0000000000000000
[ 1623.618046] x9 : 0000000000000000 x8 : 000000000000000f
[ 1623.623432] x7 : ffff805f67d06061 x6 : fffffffffffffffe
[ 1623.628817] x5 : 0000000000000012 x4 : ffff00000901d478
[ 1623.634203] x3 : ffff0a00ffffff04 x2 : ffff805f67d07000
[ 1623.639588] x1 : ffff805f67d07000 x0 : ffffffffffffffff
[ 1623.644974] Process cat (pid: 11438, stack limit = 0x000000008d4cbc10)
[ 1623.651592] Call trace:
[ 1623.654068] string+0x28/0x98
[ 1623.657071] vsnprintf+0x368/0x5e8
[ 1623.660517] seq_vprintf+0x70/0x98
[ 1623.668009] seq_printf+0x7c/0xa0
[ 1623.675530] r_show+0xc8/0xf8
[ 1623.682558] seq_read+0x330/0x440
[ 1623.689877] proc_reg_read+0x78/0xd0
[ 1623.697346] __vfs_read+0x60/0x1a0
[ 1623.704564] vfs_read+0x94/0x150
[ 1623.711339] ksys_read+0x6c/0xd8
[ 1623.717939] __arm64_sys_read+0x24/0x30
[ 1623.725077] el0_svc_common+0x120/0x148
[ 1623.732035] el0_svc_handler+0x30/0x40
[ 1623.738757] el0_svc+0x8/0xc
[ 1623.744520] Code: d1000406 aa0103e2 54000149 b4000080 (39400085)
[ 1623.753441] ---[ end trace f91b6a4937de9835 ]---
[ 1623.760871] Kernel panic - not syncing: Fatal exception
[ 1623.768935] SMP: stopping secondary CPUs
[ 1623.775718] Kernel Offset: disabled
[ 1623.781998] CPU features: 0x002,21006008
[ 1623.788777] Memory Limit: none
[ 1623.798329] Starting crashdump kernel...
[ 1623.805202] Bye!
If io_setup is called successful in try_smi_init() but try_smi_init()
goes out_err before calling ipmi_register_smi(), so ipmi_unregister_smi()
will not be called while removing module. It leads to the resource that
allocated in io_setup() can not be freed, but the name(DEVICE_NAME) of
resource is freed while removing the module. It causes use-after-free
when cat /proc/ioports.
Fix this by calling io_cleanup() while try_smi_init() goes to out_err.
and don't call io_cleanup() until io_setup() returns successful to avoid
warning prints.
Fixes: 93c303d2045b ("ipmi_si: Clean up shutdown a bit")
Cc: [email protected]
Reported-by: NuoHan Qiao <[email protected]>
Suggested-by: Corey Minyard <[email protected]>
Signed-off-by: Yang Yingliang <[email protected]>
Signed-off-by: Corey Minyard <[email protected]> | static struct smi_info *find_dup_si(struct smi_info *info)
{
struct smi_info *e;
list_for_each_entry(e, &smi_infos, link) {
if (e->io.addr_type != info->io.addr_type)
continue;
if (e->io.addr_data == info->io.addr_data) {
/*
* This is a cheap hack, ACPI doesn't have a defined
* slave address but SMBIOS does. Pick it up from
* any source that has it available.
*/
if (info->io.slave_addr && !e->io.slave_addr)
e->io.slave_addr = info->io.slave_addr;
return e;
}
}
return NULL;
}
| static struct smi_info *find_dup_si(struct smi_info *info)
{
struct smi_info *e;
list_for_each_entry(e, &smi_infos, link) {
if (e->io.addr_type != info->io.addr_type)
continue;
if (e->io.addr_data == info->io.addr_data) {
/*
* This is a cheap hack, ACPI doesn't have a defined
* slave address but SMBIOS does. Pick it up from
* any source that has it available.
*/
if (info->io.slave_addr && !e->io.slave_addr)
e->io.slave_addr = info->io.slave_addr;
return e;
}
}
return NULL;
}
| C | linux | 0 |
CVE-2011-2486 | https://www.cvedetails.com/cve/CVE-2011-2486/ | CWE-264 | https://github.com/davidben/nspluginwrapper/commit/7e4ab8e1189846041f955e6c83f72bc1624e7a98 | 7e4ab8e1189846041f955e6c83f72bc1624e7a98 | Support all the new variables added | static int do_recv_NPUTF8(rpc_message_t *message, void *p_value)
{
NPUTF8 **string_p = (NPUTF8 **)p_value;
NPUTF8 *string = NULL;
uint32_t len;
int error = rpc_message_recv_uint32(message, &len);
if (error < 0)
return error;
if ((string = NPN_MemAlloc(len)) == NULL)
return RPC_ERROR_NO_MEMORY;
if (len > 0) {
if ((error = rpc_message_recv_bytes(message, (unsigned char *)string, len)) < 0)
return error;
}
if (string_p)
*string_p = string;
else if (string)
NPN_MemFree(string);
return RPC_ERROR_NO_ERROR;
}
| static int do_recv_NPUTF8(rpc_message_t *message, void *p_value)
{
NPUTF8 **string_p = (NPUTF8 **)p_value;
NPUTF8 *string = NULL;
uint32_t len;
int error = rpc_message_recv_uint32(message, &len);
if (error < 0)
return error;
if ((string = NPN_MemAlloc(len)) == NULL)
return RPC_ERROR_NO_MEMORY;
if (len > 0) {
if ((error = rpc_message_recv_bytes(message, (unsigned char *)string, len)) < 0)
return error;
}
if (string_p)
*string_p = string;
else if (string)
NPN_MemFree(string);
return RPC_ERROR_NO_ERROR;
}
| C | nspluginwrapper | 0 |
CVE-2017-5009 | https://www.cvedetails.com/cve/CVE-2017-5009/ | CWE-119 | https://github.com/chromium/chromium/commit/1c40f9042ae2d6ee7483d72998aabb5e73b2ff60 | 1c40f9042ae2d6ee7483d72998aabb5e73b2ff60 | DevTools: send proper resource type in Network.RequestWillBeSent
This patch plumbs resoure type into the DispatchWillSendRequest
instrumenation. This allows us to report accurate type in
Network.RequestWillBeSent event, instead of "Other", that we report
today.
BUG=765501
R=dgozman
Change-Id: I0134c08b841e8dd247fdc8ff208bfd51e462709c
Reviewed-on: https://chromium-review.googlesource.com/667504
Reviewed-by: Pavel Feldman <[email protected]>
Reviewed-by: Dmitry Gozman <[email protected]>
Commit-Queue: Andrey Lushnikov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#507936} | bool WorkerFetchContext::ShouldBlockRequestByInspector(const KURL& url) const {
bool should_block_request = false;
probe::shouldBlockRequest(global_scope_, url, &should_block_request);
return should_block_request;
}
| bool WorkerFetchContext::ShouldBlockRequestByInspector(const KURL& url) const {
bool should_block_request = false;
probe::shouldBlockRequest(global_scope_, url, &should_block_request);
return should_block_request;
}
| C | Chrome | 0 |
CVE-2012-5147 | https://www.cvedetails.com/cve/CVE-2012-5147/ | CWE-399 | https://github.com/chromium/chromium/commit/9c0b13574dc0ddeb502d7ed92ba10f7981da6736 | 9c0b13574dc0ddeb502d7ed92ba10f7981da6736 | Add QuicStream and friends to QUIC code.
Fix bug in tests that caused failures.
Revert 165859
First Landed as 165858
Review URL: https://chromiumcodereview.appspot.com/11367082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165864 0039d316-1c4b-4281-b951-d872f2087c98 | void CompareQuicDataWithHexError(
const string& description,
QuicData* actual,
QuicData* expected) {
CompareCharArraysWithHexError(
description,
actual->data(), actual->length(),
expected->data(), expected->length());
}
| void CompareQuicDataWithHexError(
const string& description,
QuicData* actual,
QuicData* expected) {
CompareCharArraysWithHexError(
description,
actual->data(), actual->length(),
expected->data(), expected->length());
}
| 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} | void Textfield::OnVisibleBoundsChanged() {
if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
}
| void Textfield::OnVisibleBoundsChanged() {
if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
}
| C | Chrome | 0 |
CVE-2011-4621 | https://www.cvedetails.com/cve/CVE-2011-4621/ | null | https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64 | f26f9aff6aaf67e9a430d16c266f91b13a5bff64 | Sched: fix skip_clock_update optimization
idle_balance() drops/retakes rq->lock, leaving the previous task
vulnerable to set_tsk_need_resched(). Clear it after we return
from balancing instead, and in setup_thread_stack() as well, so
no successfully descheduled or never scheduled task has it set.
Need resched confused the skip_clock_update logic, which assumes
that the next call to update_rq_clock() will come nearly immediately
after being set. Make the optimization robust against the waking
a sleeper before it sucessfully deschedules case by checking that
the current task has not been dequeued before setting the flag,
since it is that useless clock update we're trying to save, and
clear unconditionally in schedule() proper instead of conditionally
in put_prev_task().
Signed-off-by: Mike Galbraith <[email protected]>
Reported-by: Bjoern B. Brandenburg <[email protected]>
Tested-by: Yong Zhang <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]> | static long calc_load_fold_active(struct rq *this_rq)
{
long nr_active, delta = 0;
nr_active = this_rq->nr_running;
nr_active += (long) this_rq->nr_uninterruptible;
if (nr_active != this_rq->calc_load_active) {
delta = nr_active - this_rq->calc_load_active;
this_rq->calc_load_active = nr_active;
}
return delta;
}
| static long calc_load_fold_active(struct rq *this_rq)
{
long nr_active, delta = 0;
nr_active = this_rq->nr_running;
nr_active += (long) this_rq->nr_uninterruptible;
if (nr_active != this_rq->calc_load_active) {
delta = nr_active - this_rq->calc_load_active;
this_rq->calc_load_active = nr_active;
}
return delta;
}
| C | linux | 0 |
CVE-2018-18347 | https://www.cvedetails.com/cve/CVE-2018-18347/ | CWE-20 | https://github.com/chromium/chromium/commit/0aa576040704401ae28ea73b862d0b5d84262d51 | 0aa576040704401ae28ea73b862d0b5d84262d51 | Don't preserve NavigationEntry for failed navigations with invalid URLs.
The formatting logic may rewrite such URLs into an unsafe state. This
is a first step before preventing navigations to invalid URLs entirely.
Bug: 850824
Change-Id: I71743bfb4b610d55ce901ee8902125f934a2bb23
Reviewed-on: https://chromium-review.googlesource.com/c/1252942
Reviewed-by: Alex Moshchuk <[email protected]>
Commit-Queue: Charlie Reis <[email protected]>
Cr-Commit-Position: refs/heads/master@{#597304} | net::EmbeddedTestServer* https_server() { return &https_server_; }
| net::EmbeddedTestServer* https_server() { return &https_server_; }
| C | Chrome | 0 |
null | null | null | https://github.com/chromium/chromium/commit/364fb6e517fc4fbc8196a4afba4f77b3d5300c3e | 364fb6e517fc4fbc8196a4afba4f77b3d5300c3e | Add InputMethodObserver support into InputMethodBase
This is a preparation CL to fix issue 164964.
Following observer callbacks are defined but not yet
supported by ui::InputMethodBase and its sub classes.
- InputMethodObserver::OnCaretBoundsChanged
- InputMethodObserver::OnInputLocaleChanged
This CL makes these callbacks functional for each
sub class of ui::InputMethodBase.
BUG=164964
TEST=ui_unittests --gtest_filter=InputMethodBaseTest.*
Review URL: https://codereview.chromium.org/48393003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231563 0039d316-1c4b-4281-b951-d872f2087c98 | void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) {
delegate_ = delegate;
}
| void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) {
delegate_ = delegate;
}
| C | Chrome | 0 |
CVE-2013-7271 | https://www.cvedetails.com/cve/CVE-2013-7271/ | CWE-20 | https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]> | static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
{
struct sock *sk = NULL;
sk_for_each(sk, &rfcomm_sk_list.head) {
if (rfcomm_pi(sk)->channel == channel &&
!bacmp(&rfcomm_pi(sk)->src, src))
break;
}
return sk ? sk : NULL;
}
| static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
{
struct sock *sk = NULL;
sk_for_each(sk, &rfcomm_sk_list.head) {
if (rfcomm_pi(sk)->channel == channel &&
!bacmp(&rfcomm_pi(sk)->src, src))
break;
}
return sk ? sk : NULL;
}
| C | linux | 0 |
CVE-2014-3690 | https://www.cvedetails.com/cve/CVE-2014-3690/ | CWE-399 | https://github.com/torvalds/linux/commit/d974baa398f34393db76be45f7d4d04fbdbb4a0a | d974baa398f34393db76be45f7d4d04fbdbb4a0a | x86,kvm,vmx: Preserve CR4 across VM entry
CR4 isn't constant; at least the TSD and PCE bits can vary.
TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks
like it's correct.
This adds a branch and a read from cr4 to each vm entry. Because it is
extremely likely that consecutive entries into the same vcpu will have
the same host cr4 value, this fixes up the vmcs instead of restoring cr4
after the fact. A subsequent patch will add a kernel-wide cr4 shadow,
reducing the overhead in the common case to just two memory reads and a
branch.
Signed-off-by: Andy Lutomirski <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Petr Matousek <[email protected]>
Cc: Gleb Natapov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]> | static inline bool cpu_has_vmx_ept_4levels(void)
{
return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT;
}
| static inline bool cpu_has_vmx_ept_4levels(void)
{
return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT;
}
| C | linux | 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]> | static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
{
struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
return (!ipv6_only_sock(sk2) &&
(!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
}
| static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
{
struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
return (!ipv6_only_sock(sk2) &&
(!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
}
| C | linux | 0 |
CVE-2012-2896 | https://www.cvedetails.com/cve/CVE-2012-2896/ | CWE-189 | https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984 | 3aad1a37affb1ab70d1897f2b03eb8c077264984 | Fix SafeAdd and SafeMultiply
BUG=145648,145544
Review URL: https://chromiumcodereview.appspot.com/10916165
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98 | error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket(
uint32 immediate_data_size,
const gles2::BindUniformLocationCHROMIUMBucket& c) {
GLuint program = static_cast<GLuint>(c.program);
GLint location = static_cast<GLint>(c.location);
Bucket* bucket = GetBucket(c.name_bucket_id);
if (!bucket || bucket->size() == 0) {
return error::kInvalidArguments;
}
std::string name_str;
if (!bucket->GetAsString(&name_str)) {
return error::kInvalidArguments;
}
DoBindUniformLocationCHROMIUM(program, location, name_str.c_str());
return error::kNoError;
}
| error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket(
uint32 immediate_data_size,
const gles2::BindUniformLocationCHROMIUMBucket& c) {
GLuint program = static_cast<GLuint>(c.program);
GLint location = static_cast<GLint>(c.location);
Bucket* bucket = GetBucket(c.name_bucket_id);
if (!bucket || bucket->size() == 0) {
return error::kInvalidArguments;
}
std::string name_str;
if (!bucket->GetAsString(&name_str)) {
return error::kInvalidArguments;
}
DoBindUniformLocationCHROMIUM(program, location, name_str.c_str());
return error::kNoError;
}
| C | Chrome | 0 |
CVE-2016-1616 | https://www.cvedetails.com/cve/CVE-2016-1616/ | CWE-254 | https://github.com/chromium/chromium/commit/297ae873b471a46929ea39697b121c0b411434ee | 297ae873b471a46929ea39697b121c0b411434ee | Custom buttons should only handle accelerators when focused.
BUG=541415
Review URL: https://codereview.chromium.org/1437523005
Cr-Commit-Position: refs/heads/master@{#360130} | bool CustomButton::OnMousePressed(const ui::MouseEvent& event) {
if (state_ != STATE_DISABLED) {
if (ShouldEnterPushedState(event) && HitTestPoint(event.location()))
SetState(STATE_PRESSED);
if (request_focus_on_press_)
RequestFocus();
if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_PRESS) {
NotifyClick(event);
}
}
return true;
}
| bool CustomButton::OnMousePressed(const ui::MouseEvent& event) {
if (state_ != STATE_DISABLED) {
if (ShouldEnterPushedState(event) && HitTestPoint(event.location()))
SetState(STATE_PRESSED);
if (request_focus_on_press_)
RequestFocus();
if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_PRESS) {
NotifyClick(event);
}
}
return true;
}
| 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} | void WebGL2RenderingContextBase::uniform4ui(
const WebGLUniformLocation* location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3) {
if (isContextLost() || !location)
return;
if (location->Program() != current_program_) {
SynthesizeGLError(GL_INVALID_OPERATION, "uniform4ui",
"location not for current program");
return;
}
ContextGL()->Uniform4ui(location->Location(), v0, v1, v2, v3);
}
| void WebGL2RenderingContextBase::uniform4ui(
const WebGLUniformLocation* location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3) {
if (isContextLost() || !location)
return;
if (location->Program() != current_program_) {
SynthesizeGLError(GL_INVALID_OPERATION, "uniform4ui",
"location not for current program");
return;
}
ContextGL()->Uniform4ui(location->Location(), v0, v1, v2, v3);
}
| C | Chrome | 0 |
CVE-2016-6327 | https://www.cvedetails.com/cve/CVE-2016-6327/ | CWE-476 | https://github.com/torvalds/linux/commit/51093254bf879bc9ce96590400a87897c7498463 | 51093254bf879bc9ce96590400a87897c7498463 | IB/srpt: Simplify srpt_handle_tsk_mgmt()
Let the target core check task existence instead of the SRP target
driver. Additionally, let the target core check the validity of the
task management request instead of the ib_srpt driver.
This patch fixes the following kernel crash:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
IP: [<ffffffffa0565f37>] srpt_handle_new_iu+0x6d7/0x790 [ib_srpt]
Oops: 0002 [#1] SMP
Call Trace:
[<ffffffffa05660ce>] srpt_process_completion+0xde/0x570 [ib_srpt]
[<ffffffffa056669f>] srpt_compl_thread+0x13f/0x160 [ib_srpt]
[<ffffffff8109726f>] kthread+0xcf/0xe0
[<ffffffff81613cfc>] ret_from_fork+0x7c/0xb0
Signed-off-by: Bart Van Assche <[email protected]>
Fixes: 3e4f574857ee ("ib_srpt: Convert TMR path to target_submit_tmr")
Tested-by: Alex Estrin <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Cc: Nicholas Bellinger <[email protected]>
Cc: Sagi Grimberg <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Doug Ledford <[email protected]> | static void srpt_queue_response(struct se_cmd *cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state state;
unsigned long flags;
int ret;
enum dma_data_direction dir;
int resp_len;
u8 srp_tm_status;
ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
ch = ioctx->ch;
BUG_ON(!ch);
spin_lock_irqsave(&ioctx->spinlock, flags);
state = ioctx->state;
switch (state) {
case SRPT_STATE_NEW:
case SRPT_STATE_DATA_IN:
ioctx->state = SRPT_STATE_CMD_RSP_SENT;
break;
case SRPT_STATE_MGMT:
ioctx->state = SRPT_STATE_MGMT_RSP_SENT;
break;
default:
WARN(true, "ch %p; cmd %d: unexpected command state %d\n",
ch, ioctx->ioctx.index, ioctx->state);
break;
}
spin_unlock_irqrestore(&ioctx->spinlock, flags);
if (unlikely(transport_check_aborted_status(&ioctx->cmd, false)
|| WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
atomic_inc(&ch->req_lim_delta);
srpt_abort_cmd(ioctx);
return;
}
dir = ioctx->cmd.data_direction;
/* For read commands, transfer the data to the initiator. */
if (dir == DMA_FROM_DEVICE && ioctx->cmd.data_length &&
!ioctx->queue_status_only) {
ret = srpt_xfer_data(ch, ioctx);
if (ret) {
pr_err("xfer_data failed for tag %llu\n",
ioctx->cmd.tag);
return;
}
}
if (state != SRPT_STATE_MGMT)
resp_len = srpt_build_cmd_rsp(ch, ioctx, ioctx->cmd.tag,
cmd->scsi_status);
else {
srp_tm_status
= tcm_to_srp_tsk_mgmt_status(cmd->se_tmr_req->response);
resp_len = srpt_build_tskmgmt_rsp(ch, ioctx, srp_tm_status,
ioctx->cmd.tag);
}
ret = srpt_post_send(ch, ioctx, resp_len);
if (ret) {
pr_err("sending cmd response failed for tag %llu\n",
ioctx->cmd.tag);
srpt_unmap_sg_to_ib_sge(ch, ioctx);
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
target_put_sess_cmd(&ioctx->cmd);
}
}
| static void srpt_queue_response(struct se_cmd *cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state state;
unsigned long flags;
int ret;
enum dma_data_direction dir;
int resp_len;
u8 srp_tm_status;
ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
ch = ioctx->ch;
BUG_ON(!ch);
spin_lock_irqsave(&ioctx->spinlock, flags);
state = ioctx->state;
switch (state) {
case SRPT_STATE_NEW:
case SRPT_STATE_DATA_IN:
ioctx->state = SRPT_STATE_CMD_RSP_SENT;
break;
case SRPT_STATE_MGMT:
ioctx->state = SRPT_STATE_MGMT_RSP_SENT;
break;
default:
WARN(true, "ch %p; cmd %d: unexpected command state %d\n",
ch, ioctx->ioctx.index, ioctx->state);
break;
}
spin_unlock_irqrestore(&ioctx->spinlock, flags);
if (unlikely(transport_check_aborted_status(&ioctx->cmd, false)
|| WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
atomic_inc(&ch->req_lim_delta);
srpt_abort_cmd(ioctx);
return;
}
dir = ioctx->cmd.data_direction;
/* For read commands, transfer the data to the initiator. */
if (dir == DMA_FROM_DEVICE && ioctx->cmd.data_length &&
!ioctx->queue_status_only) {
ret = srpt_xfer_data(ch, ioctx);
if (ret) {
pr_err("xfer_data failed for tag %llu\n",
ioctx->cmd.tag);
return;
}
}
if (state != SRPT_STATE_MGMT)
resp_len = srpt_build_cmd_rsp(ch, ioctx, ioctx->cmd.tag,
cmd->scsi_status);
else {
srp_tm_status
= tcm_to_srp_tsk_mgmt_status(cmd->se_tmr_req->response);
resp_len = srpt_build_tskmgmt_rsp(ch, ioctx, srp_tm_status,
ioctx->cmd.tag);
}
ret = srpt_post_send(ch, ioctx, resp_len);
if (ret) {
pr_err("sending cmd response failed for tag %llu\n",
ioctx->cmd.tag);
srpt_unmap_sg_to_ib_sge(ch, ioctx);
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
target_put_sess_cmd(&ioctx->cmd);
}
}
| C | linux | 0 |
CVE-2013-0886 | https://www.cvedetails.com/cve/CVE-2013-0886/ | null | https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76 | 18d67244984a574ba2dd8779faabc0e3e34f4b76 | Implement TextureImageTransportSurface using texture mailbox
This has a couple of advantages:
- allow tearing down and recreating the UI parent context without
losing the renderer contexts
- do not require a context to be able to generate textures when
creating the GLSurfaceHandle
- clearer ownership semantics that potentially allows for more
robust and easier lost context handling/thumbnailing/etc., since a texture is at
any given time owned by either: UI parent, mailbox, or
TextureImageTransportSurface
- simplify frontbuffer protection logic;
the frontbuffer textures are now owned by RWHV where they are refcounted
The TextureImageTransportSurface informs RenderWidgetHostView of the
mailbox names for the front- and backbuffer textures by
associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message.
During SwapBuffers() or PostSubBuffer() cycles, it then uses
produceTextureCHROMIUM() and consumeTextureCHROMIUM()
to transfer ownership between renderer and browser compositor.
RWHV sends back the surface_handle of the buffer being returned with the Swap ACK
(or 0 if no buffer is being returned in which case TextureImageTransportSurface will
allocate a new texture - note that this could be used to
simply keep textures for thumbnailing).
BUG=154815,139616
[email protected]
Review URL: https://chromiumcodereview.appspot.com/11194042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98 | void RenderWidgetHostImpl::ProcessTouchAck(InputEventAckState ack_result) {
touch_event_queue_->ProcessTouchAck(ack_result);
}
| void RenderWidgetHostImpl::ProcessTouchAck(InputEventAckState ack_result) {
touch_event_queue_->ProcessTouchAck(ack_result);
}
| C | Chrome | 0 |
CVE-2018-10199 | https://www.cvedetails.com/cve/CVE-2018-10199/ | CWE-416 | https://github.com/mruby/mruby/commit/b51b21fc63c9805862322551387d9036f2b63433 | b51b21fc63c9805862322551387d9036f2b63433 | Fix `use after free in File#initilialize_copy`; fix #4001
The bug and the fix were reported by https://hackerone.com/pnoltof | mrb_io_s_select(mrb_state *mrb, mrb_value klass)
{
mrb_value *argv;
mrb_int argc;
mrb_value read, read_io, write, except, timeout, list;
struct timeval *tp, timerec;
fd_set pset, rset, wset, eset;
fd_set *rp, *wp, *ep;
struct mrb_io *fptr;
int pending = 0;
mrb_value result;
int max = 0;
int interrupt_flag = 0;
int i, n;
mrb_get_args(mrb, "*", &argv, &argc);
if (argc < 1 || argc > 4) {
mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%S for 1..4)", mrb_fixnum_value(argc));
}
timeout = mrb_nil_value();
except = mrb_nil_value();
write = mrb_nil_value();
if (argc > 3)
timeout = argv[3];
if (argc > 2)
except = argv[2];
if (argc > 1)
write = argv[1];
read = argv[0];
if (mrb_nil_p(timeout)) {
tp = NULL;
} else {
timerec = time2timeval(mrb, timeout);
tp = &timerec;
}
FD_ZERO(&pset);
if (!mrb_nil_p(read)) {
mrb_check_type(mrb, read, MRB_TT_ARRAY);
rp = &rset;
FD_ZERO(rp);
for (i = 0; i < RARRAY_LEN(read); i++) {
read_io = RARRAY_PTR(read)[i];
fptr = (struct mrb_io *)mrb_get_datatype(mrb, read_io, &mrb_io_type);
FD_SET(fptr->fd, rp);
if (mrb_io_read_data_pending(mrb, read_io)) {
pending++;
FD_SET(fptr->fd, &pset);
}
if (max < fptr->fd)
max = fptr->fd;
}
if (pending) {
timerec.tv_sec = timerec.tv_usec = 0;
tp = &timerec;
}
} else {
rp = NULL;
}
if (!mrb_nil_p(write)) {
mrb_check_type(mrb, write, MRB_TT_ARRAY);
wp = &wset;
FD_ZERO(wp);
for (i = 0; i < RARRAY_LEN(write); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(write)[i], &mrb_io_type);
FD_SET(fptr->fd, wp);
if (max < fptr->fd)
max = fptr->fd;
if (fptr->fd2 >= 0) {
FD_SET(fptr->fd2, wp);
if (max < fptr->fd2)
max = fptr->fd2;
}
}
} else {
wp = NULL;
}
if (!mrb_nil_p(except)) {
mrb_check_type(mrb, except, MRB_TT_ARRAY);
ep = &eset;
FD_ZERO(ep);
for (i = 0; i < RARRAY_LEN(except); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(except)[i], &mrb_io_type);
FD_SET(fptr->fd, ep);
if (max < fptr->fd)
max = fptr->fd;
if (fptr->fd2 >= 0) {
FD_SET(fptr->fd2, ep);
if (max < fptr->fd2)
max = fptr->fd2;
}
}
} else {
ep = NULL;
}
max++;
retry:
n = select(max, rp, wp, ep, tp);
if (n < 0) {
if (errno != EINTR)
mrb_sys_fail(mrb, "select failed");
if (tp == NULL)
goto retry;
interrupt_flag = 1;
}
if (!pending && n == 0)
return mrb_nil_value();
result = mrb_ary_new_capa(mrb, 3);
mrb_ary_push(mrb, result, rp? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
mrb_ary_push(mrb, result, wp? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
mrb_ary_push(mrb, result, ep? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
if (interrupt_flag == 0) {
if (rp) {
list = RARRAY_PTR(result)[0];
for (i = 0; i < RARRAY_LEN(read); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(read)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, rp) ||
FD_ISSET(fptr->fd, &pset)) {
mrb_ary_push(mrb, list, RARRAY_PTR(read)[i]);
}
}
}
if (wp) {
list = RARRAY_PTR(result)[1];
for (i = 0; i < RARRAY_LEN(write); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(write)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, wp)) {
mrb_ary_push(mrb, list, RARRAY_PTR(write)[i]);
} else if (fptr->fd2 >= 0 && FD_ISSET(fptr->fd2, wp)) {
mrb_ary_push(mrb, list, RARRAY_PTR(write)[i]);
}
}
}
if (ep) {
list = RARRAY_PTR(result)[2];
for (i = 0; i < RARRAY_LEN(except); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(except)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, ep)) {
mrb_ary_push(mrb, list, RARRAY_PTR(except)[i]);
} else if (fptr->fd2 >= 0 && FD_ISSET(fptr->fd2, ep)) {
mrb_ary_push(mrb, list, RARRAY_PTR(except)[i]);
}
}
}
}
return result;
}
| mrb_io_s_select(mrb_state *mrb, mrb_value klass)
{
mrb_value *argv;
mrb_int argc;
mrb_value read, read_io, write, except, timeout, list;
struct timeval *tp, timerec;
fd_set pset, rset, wset, eset;
fd_set *rp, *wp, *ep;
struct mrb_io *fptr;
int pending = 0;
mrb_value result;
int max = 0;
int interrupt_flag = 0;
int i, n;
mrb_get_args(mrb, "*", &argv, &argc);
if (argc < 1 || argc > 4) {
mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%S for 1..4)", mrb_fixnum_value(argc));
}
timeout = mrb_nil_value();
except = mrb_nil_value();
write = mrb_nil_value();
if (argc > 3)
timeout = argv[3];
if (argc > 2)
except = argv[2];
if (argc > 1)
write = argv[1];
read = argv[0];
if (mrb_nil_p(timeout)) {
tp = NULL;
} else {
timerec = time2timeval(mrb, timeout);
tp = &timerec;
}
FD_ZERO(&pset);
if (!mrb_nil_p(read)) {
mrb_check_type(mrb, read, MRB_TT_ARRAY);
rp = &rset;
FD_ZERO(rp);
for (i = 0; i < RARRAY_LEN(read); i++) {
read_io = RARRAY_PTR(read)[i];
fptr = (struct mrb_io *)mrb_get_datatype(mrb, read_io, &mrb_io_type);
FD_SET(fptr->fd, rp);
if (mrb_io_read_data_pending(mrb, read_io)) {
pending++;
FD_SET(fptr->fd, &pset);
}
if (max < fptr->fd)
max = fptr->fd;
}
if (pending) {
timerec.tv_sec = timerec.tv_usec = 0;
tp = &timerec;
}
} else {
rp = NULL;
}
if (!mrb_nil_p(write)) {
mrb_check_type(mrb, write, MRB_TT_ARRAY);
wp = &wset;
FD_ZERO(wp);
for (i = 0; i < RARRAY_LEN(write); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(write)[i], &mrb_io_type);
FD_SET(fptr->fd, wp);
if (max < fptr->fd)
max = fptr->fd;
if (fptr->fd2 >= 0) {
FD_SET(fptr->fd2, wp);
if (max < fptr->fd2)
max = fptr->fd2;
}
}
} else {
wp = NULL;
}
if (!mrb_nil_p(except)) {
mrb_check_type(mrb, except, MRB_TT_ARRAY);
ep = &eset;
FD_ZERO(ep);
for (i = 0; i < RARRAY_LEN(except); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(except)[i], &mrb_io_type);
FD_SET(fptr->fd, ep);
if (max < fptr->fd)
max = fptr->fd;
if (fptr->fd2 >= 0) {
FD_SET(fptr->fd2, ep);
if (max < fptr->fd2)
max = fptr->fd2;
}
}
} else {
ep = NULL;
}
max++;
retry:
n = select(max, rp, wp, ep, tp);
if (n < 0) {
if (errno != EINTR)
mrb_sys_fail(mrb, "select failed");
if (tp == NULL)
goto retry;
interrupt_flag = 1;
}
if (!pending && n == 0)
return mrb_nil_value();
result = mrb_ary_new_capa(mrb, 3);
mrb_ary_push(mrb, result, rp? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
mrb_ary_push(mrb, result, wp? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
mrb_ary_push(mrb, result, ep? mrb_ary_new(mrb) : mrb_ary_new_capa(mrb, 0));
if (interrupt_flag == 0) {
if (rp) {
list = RARRAY_PTR(result)[0];
for (i = 0; i < RARRAY_LEN(read); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(read)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, rp) ||
FD_ISSET(fptr->fd, &pset)) {
mrb_ary_push(mrb, list, RARRAY_PTR(read)[i]);
}
}
}
if (wp) {
list = RARRAY_PTR(result)[1];
for (i = 0; i < RARRAY_LEN(write); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(write)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, wp)) {
mrb_ary_push(mrb, list, RARRAY_PTR(write)[i]);
} else if (fptr->fd2 >= 0 && FD_ISSET(fptr->fd2, wp)) {
mrb_ary_push(mrb, list, RARRAY_PTR(write)[i]);
}
}
}
if (ep) {
list = RARRAY_PTR(result)[2];
for (i = 0; i < RARRAY_LEN(except); i++) {
fptr = (struct mrb_io *)mrb_get_datatype(mrb, RARRAY_PTR(except)[i], &mrb_io_type);
if (FD_ISSET(fptr->fd, ep)) {
mrb_ary_push(mrb, list, RARRAY_PTR(except)[i]);
} else if (fptr->fd2 >= 0 && FD_ISSET(fptr->fd2, ep)) {
mrb_ary_push(mrb, list, RARRAY_PTR(except)[i]);
}
}
}
}
return result;
}
| C | mruby | 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 int perf_tp_event_match(struct perf_event *event,
struct perf_sample_data *data,
struct pt_regs *regs)
{
if (event->hw.state & PERF_HES_STOPPED)
return 0;
/*
* All tracepoints are from kernel-space.
*/
if (event->attr.exclude_kernel)
return 0;
if (!perf_tp_filter_match(event, data))
return 0;
return 1;
}
| static int perf_tp_event_match(struct perf_event *event,
struct perf_sample_data *data,
struct pt_regs *regs)
{
if (event->hw.state & PERF_HES_STOPPED)
return 0;
/*
* All tracepoints are from kernel-space.
*/
if (event->attr.exclude_kernel)
return 0;
if (!perf_tp_filter_match(event, data))
return 0;
return 1;
}
| C | linux | 0 |
CVE-2017-7645 | https://www.cvedetails.com/cve/CVE-2017-7645/ | CWE-20 | https://github.com/torvalds/linux/commit/e6838a29ecb484c97e4efef9429643b9851fba6e | e6838a29ecb484c97e4efef9429643b9851fba6e | nfsd: check for oversized NFSv2/v3 arguments
A client can append random data to the end of an NFSv2 or NFSv3 RPC call
without our complaining; we'll just stop parsing at the end of the
expected data and ignore the rest.
Encoded arguments and replies are stored together in an array of pages,
and if a call is too large it could leave inadequate space for the
reply. This is normally OK because NFS RPC's typically have either
short arguments and long replies (like READ) or long arguments and short
replies (like WRITE). But a client that sends an incorrectly long reply
can violate those assumptions. This was observed to cause crashes.
Also, several operations increment rq_next_page in the decode routine
before checking the argument size, which can leave rq_next_page pointing
well past the end of the page array, causing trouble later in
svc_free_pages.
So, following a suggestion from Neil Brown, add a central check to
enforce our expectation that no NFSv2/v3 call has both a large call and
a large reply.
As followup we may also want to rewrite the encoding routines to check
more carefully that they aren't running off the end of the page array.
We may also consider rejecting calls that have any extra garbage
appended. That would be safer, and within our rights by spec, but given
the age of our server and the NFS protocol, and the fact that we've
never enforced this before, we may need to balance that against the
possibility of breaking some oddball client.
Reported-by: Tuomas Haanpää <[email protected]>
Reported-by: Ari Kauppi <[email protected]>
Cc: [email protected]
Reviewed-by: NeilBrown <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]> | int nfsd_create_serv(struct net *net)
{
int error;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
WARN_ON(!mutex_is_locked(&nfsd_mutex));
if (nn->nfsd_serv) {
svc_get(nn->nfsd_serv);
return 0;
}
if (nfsd_max_blksize == 0)
nfsd_max_blksize = nfsd_get_default_max_blksize();
nfsd_reset_versions();
nn->nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
&nfsd_thread_sv_ops);
if (nn->nfsd_serv == NULL)
return -ENOMEM;
nn->nfsd_serv->sv_maxconn = nn->max_connections;
error = svc_bind(nn->nfsd_serv, net);
if (error < 0) {
svc_destroy(nn->nfsd_serv);
return error;
}
set_max_drc();
/* check if the notifier is already set */
if (atomic_inc_return(&nfsd_notifier_refcount) == 1) {
register_inetaddr_notifier(&nfsd_inetaddr_notifier);
#if IS_ENABLED(CONFIG_IPV6)
register_inet6addr_notifier(&nfsd_inet6addr_notifier);
#endif
}
do_gettimeofday(&nn->nfssvc_boot); /* record boot time */
return 0;
}
| int nfsd_create_serv(struct net *net)
{
int error;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
WARN_ON(!mutex_is_locked(&nfsd_mutex));
if (nn->nfsd_serv) {
svc_get(nn->nfsd_serv);
return 0;
}
if (nfsd_max_blksize == 0)
nfsd_max_blksize = nfsd_get_default_max_blksize();
nfsd_reset_versions();
nn->nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
&nfsd_thread_sv_ops);
if (nn->nfsd_serv == NULL)
return -ENOMEM;
nn->nfsd_serv->sv_maxconn = nn->max_connections;
error = svc_bind(nn->nfsd_serv, net);
if (error < 0) {
svc_destroy(nn->nfsd_serv);
return error;
}
set_max_drc();
/* check if the notifier is already set */
if (atomic_inc_return(&nfsd_notifier_refcount) == 1) {
register_inetaddr_notifier(&nfsd_inetaddr_notifier);
#if IS_ENABLED(CONFIG_IPV6)
register_inet6addr_notifier(&nfsd_inet6addr_notifier);
#endif
}
do_gettimeofday(&nn->nfssvc_boot); /* record boot time */
return 0;
}
| C | linux | 0 |
CVE-2018-12714 | https://www.cvedetails.com/cve/CVE-2018-12714/ | CWE-787 | https://github.com/torvalds/linux/commit/81f9c4e4177d31ced6f52a89bb70e93bfb77ca03 | 81f9c4e4177d31ced6f52a89bb70e93bfb77ca03 | Merge tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt:
"This contains a few fixes and a clean up.
- a bad merge caused an "endif" to go in the wrong place in
scripts/Makefile.build
- softirq tracing fix for tracing that corrupts lockdep and causes a
false splat
- histogram documentation typo fixes
- fix a bad memory reference when passing in no filter to the filter
code
- simplify code by using the swap macro instead of open coding the
swap"
* tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
tracing: Fix some errors in histogram documentation
tracing: Use swap macro in update_max_tr
softirq: Reorder trace_softirqs_on to prevent lockdep splat
tracing: Check for no filter when processing event filters | static inline void ftrace_trace_stack(struct trace_array *tr,
struct ring_buffer *buffer,
unsigned long flags,
int skip, int pc, struct pt_regs *regs)
{
}
| static inline void ftrace_trace_stack(struct trace_array *tr,
struct ring_buffer *buffer,
unsigned long flags,
int skip, int pc, struct pt_regs *regs)
{
}
| C | linux | 0 |
CVE-2010-1166 | https://www.cvedetails.com/cve/CVE-2010-1166/ | CWE-189 | https://cgit.freedesktop.org/xorg/xserver/commit/?id=d2f813f7db | d2f813f7db157fc83abc4b3726821c36ee7e40b1 | null | fbStore_a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)
{
int i;
for (i = 0; i < width; ++i) {
Store4(bits, i + x, READ(values + i)>>28);
}
}
| fbStore_a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)
{
int i;
for (i = 0; i < width; ++i) {
Store4(bits, i + x, READ(values + i)>>28);
}
}
| C | xserver | 0 |
CVE-2017-12182 | https://www.cvedetails.com/cve/CVE-2017-12182/ | CWE-20 | https://cgit.freedesktop.org/xorg/xserver/commit/?id=1b1d4c04695dced2463404174b50b3581dbd857b | 1b1d4c04695dced2463404174b50b3581dbd857b | null | DGAAvailable(int index)
{
ScreenPtr pScreen;
assert(index < MAXSCREENS);
pScreen = screenInfo.screens[index];
return DGAScreenAvailable(pScreen);
}
| DGAAvailable(int index)
{
ScreenPtr pScreen;
assert(index < MAXSCREENS);
pScreen = screenInfo.screens[index];
return DGAScreenAvailable(pScreen);
}
| C | xserver | 0 |
CVE-2016-9557 | https://www.cvedetails.com/cve/CVE-2016-9557/ | CWE-190 | https://github.com/mdadams/jasper/commit/d42b2388f7f8e0332c846675133acea151fc557a | d42b2388f7f8e0332c846675133acea151fc557a | The generation of the configuration file jas_config.h has been completely
reworked in order to avoid pollution of the global namespace.
Some problematic types like uchar, ulong, and friends have been replaced
with names with a jas_ prefix.
An option max_samples has been added to the BMP and JPEG decoders to
restrict the maximum size of image that they can decode. This change
was made as a (possibly temporary) fix to address security concerns.
A max_samples command-line option has also been added to imginfo.
Whether an image component (for jas_image_t) is stored in memory or on
disk is now based on the component size (rather than the image size).
Some debug log message were added.
Some new integer overflow checks were added.
Some new safe integer add/multiply functions were added.
More pre-C99 cruft was removed. JasPer has numerous "hacks" to
handle pre-C99 compilers. JasPer now assumes C99 support. So, this
pre-C99 cruft is unnecessary and can be removed.
The regression jasper-doublefree-mem_close.jpg has been re-enabled.
Theoretically, it should work more predictably now. | jas_iccprof_t *jas_iccprof_copy(jas_iccprof_t *prof)
{
jas_iccprof_t *newprof;
newprof = 0;
if (!(newprof = jas_iccprof_create()))
goto error;
newprof->hdr = prof->hdr;
newprof->tagtab.numents = 0;
newprof->tagtab.ents = 0;
assert(newprof->attrtab);
jas_iccattrtab_destroy(newprof->attrtab);
if (!(newprof->attrtab = jas_iccattrtab_copy(prof->attrtab)))
goto error;
return newprof;
error:
if (newprof)
jas_iccprof_destroy(newprof);
return 0;
}
| jas_iccprof_t *jas_iccprof_copy(jas_iccprof_t *prof)
{
jas_iccprof_t *newprof;
newprof = 0;
if (!(newprof = jas_iccprof_create()))
goto error;
newprof->hdr = prof->hdr;
newprof->tagtab.numents = 0;
newprof->tagtab.ents = 0;
assert(newprof->attrtab);
jas_iccattrtab_destroy(newprof->attrtab);
if (!(newprof->attrtab = jas_iccattrtab_copy(prof->attrtab)))
goto error;
return newprof;
error:
if (newprof)
jas_iccprof_destroy(newprof);
return 0;
}
| C | jasper | 0 |
CVE-2016-2464 | https://www.cvedetails.com/cve/CVE-2016-2464/ | CWE-20 | https://android.googlesource.com/platform/external/libvpx/+/cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d | cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d | external/libvpx/libwebm: Update snapshot
Update libwebm snapshot. This update contains security fixes from upstream.
Upstream git hash: 229f49347d19b0ca0941e072b199a242ef6c5f2b
BUG=23167726
Change-Id: Id3e140e7b31ae11294724b1ecfe2e9c83b4d4207
(cherry picked from commit d0281a15b3c6bd91756e453cc9398c5ef412d99a)
| bool Chapters::Edition::ExpandAtomsArray() {
if (m_atoms_size > m_atoms_count)
return true; // nothing else to do
const int size = (m_atoms_size == 0) ? 1 : 2 * m_atoms_size;
Atom* const atoms = new (std::nothrow) Atom[size];
if (atoms == NULL)
return false;
for (int idx = 0; idx < m_atoms_count; ++idx) {
m_atoms[idx].ShallowCopy(atoms[idx]);
}
delete[] m_atoms;
m_atoms = atoms;
m_atoms_size = size;
return true;
}
| bool Chapters::Edition::ExpandAtomsArray() {
if (m_atoms_size > m_atoms_count)
return true; // nothing else to do
const int size = (m_atoms_size == 0) ? 1 : 2 * m_atoms_size;
Atom* const atoms = new (std::nothrow) Atom[size];
if (atoms == NULL)
return false;
for (int idx = 0; idx < m_atoms_count; ++idx) {
m_atoms[idx].ShallowCopy(atoms[idx]);
}
delete[] m_atoms;
m_atoms = atoms;
m_atoms_size = size;
return true;
}
| C | Android | 0 |
CVE-2017-5019 | https://www.cvedetails.com/cve/CVE-2017-5019/ | CWE-416 | https://github.com/chromium/chromium/commit/f03ea5a5c2ff26e239dfd23e263b15da2d9cee93 | f03ea5a5c2ff26e239dfd23e263b15da2d9cee93 | Convert FrameHostMsg_DidAddMessageToConsole to Mojo.
Note: Since this required changing the test
RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually
re-introduced https://crbug.com/666714 locally (the bug the test was
added for), and reran the test to confirm that it still covers the bug.
Bug: 786836
Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270
Commit-Queue: Lowell Manners <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#653137} | void RenderFrameImpl::OnAddMessageToConsole(
blink::mojom::ConsoleMessageLevel level,
const std::string& message) {
AddMessageToConsole(level, message);
}
| void RenderFrameImpl::OnAddMessageToConsole(
blink::mojom::ConsoleMessageLevel level,
const std::string& message) {
AddMessageToConsole(level, message);
}
| C | Chrome | 0 |
CVE-2018-17204 | https://www.cvedetails.com/cve/CVE-2018-17204/ | CWE-617 | https://github.com/openvswitch/ovs/commit/4af6da3b275b764b1afe194df6499b33d2bf4cde | 4af6da3b275b764b1afe194df6499b33d2bf4cde | ofp-group: Don't assert-fail decoding bad OF1.5 group mod type or command.
When decoding a group mod, the current code validates the group type and
command after the whole group mod has been decoded. The OF1.5 decoder,
however, tries to use the type and command earlier, when it might still be
invalid. This caused an assertion failure (via OVS_NOT_REACHED). This
commit fixes the problem.
ovs-vswitchd does not enable support for OpenFlow 1.5 by default.
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9249
Signed-off-by: Ben Pfaff <[email protected]>
Reviewed-by: Yifeng Sun <[email protected]> | ofputil_queue_stats_from_ofp13(struct ofputil_queue_stats *oqs,
const struct ofp13_queue_stats *qs13)
{
enum ofperr error = ofputil_queue_stats_from_ofp11(oqs, &qs13->qs);
if (!error) {
oqs->duration_sec = ntohl(qs13->duration_sec);
oqs->duration_nsec = ntohl(qs13->duration_nsec);
}
return error;
}
| ofputil_queue_stats_from_ofp13(struct ofputil_queue_stats *oqs,
const struct ofp13_queue_stats *qs13)
{
enum ofperr error = ofputil_queue_stats_from_ofp11(oqs, &qs13->qs);
if (!error) {
oqs->duration_sec = ntohl(qs13->duration_sec);
oqs->duration_nsec = ntohl(qs13->duration_nsec);
}
return error;
}
| C | ovs | 0 |
CVE-2015-1191 | https://www.cvedetails.com/cve/CVE-2015-1191/ | CWE-22 | https://github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f | fdad1406b3ec809f4954ff7cdf9e99eb18c2458f | When decompressing with -N or -NT, strip any path from header name.
This uses the path of the compressed file combined with the name
from the header as the name of the decompressed output file. Any
path information in the header name is stripped. This avoids a
possible vulnerability where absolute or descending paths are put
in the gzip header. | local int option(char *arg)
{
static int get = 0; /* if not zero, look for option parameter */
char bad[3] = "-X"; /* for error messages (X is replaced) */
/* if no argument or dash option, check status of get */
if (get && (arg == NULL || *arg == '-')) {
bad[1] = "bpSIM"[get - 1];
bail("missing parameter after ", bad);
}
if (arg == NULL)
return 0;
/* process long option or short options */
if (*arg == '-') {
/* a single dash will be interpreted as stdin */
if (*++arg == 0)
return 1;
/* process long option (fall through with equivalent short option) */
if (*arg == '-') {
int j;
arg++;
for (j = NLOPTS - 1; j >= 0; j--)
if (strcmp(arg, longopts[j][0]) == 0) {
arg = longopts[j][1];
break;
}
if (j < 0)
bail("invalid option: ", arg - 2);
}
/* process short options (more than one allowed after dash) */
do {
/* if looking for a parameter, don't process more single character
options until we have the parameter */
if (get) {
if (get == 3)
bail("invalid usage: -s must be followed by space", "");
break; /* allow -pnnn and -bnnn, fall to parameter code */
}
/* process next single character option or compression level */
bad[1] = *arg;
switch (*arg) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
g.level = *arg - '0';
while (arg[1] >= '0' && arg[1] <= '9') {
if (g.level && (INT_MAX - (arg[1] - '0')) / g.level < 10)
bail("only levels 0..9 and 11 are allowed", "");
g.level = g.level * 10 + *++arg - '0';
}
if (g.level == 10 || g.level > 11)
bail("only levels 0..9 and 11 are allowed", "");
new_opts();
break;
case 'F': g.zopts.blocksplittinglast = 1; break;
case 'I': get = 4; break;
case 'K': g.form = 2; g.sufx = ".zip"; break;
case 'L':
fputs(VERSION, stderr);
fputs("Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013"
" Mark Adler\n",
stderr);
fputs("Subject to the terms of the zlib license.\n",
stderr);
fputs("No warranty is provided or implied.\n", stderr);
exit(0);
case 'M': get = 5; break;
case 'N': g.headis |= 0xf; break;
case 'O': g.zopts.blocksplitting = 0; break;
case 'R': g.rsync = 1; break;
case 'S': get = 3; break;
case 'T': g.headis &= ~0xa; break;
case 'V': fputs(VERSION, stderr); exit(0);
case 'Z':
bail("invalid option: LZW output not supported: ", bad);
case 'a':
bail("invalid option: ascii conversion not supported: ", bad);
case 'b': get = 1; break;
case 'c': g.pipeout = 1; break;
case 'd': if (!g.decode) g.headis >>= 2; g.decode = 1; break;
case 'f': g.force = 1; break;
case 'h': help(); break;
case 'i': g.setdict = 0; break;
case 'k': g.keep = 1; break;
case 'l': g.list = 1; break;
case 'n': g.headis &= ~5; break;
case 'p': get = 2; break;
case 'q': g.verbosity = 0; break;
case 'r': g.recurse = 1; break;
case 't': g.decode = 2; break;
case 'v': g.verbosity++; break;
case 'z': g.form = 1; g.sufx = ".zz"; break;
default:
bail("invalid option: ", bad);
}
} while (*++arg);
if (*arg == 0)
return 0;
}
/* process option parameter for -b, -p, -S, -I, or -M */
if (get) {
size_t n;
if (get == 1) {
n = num(arg);
g.block = n << 10; /* chunk size */
if (g.block < DICT)
bail("block size too small (must be >= 32K)", "");
if (n != g.block >> 10 ||
OUTPOOL(g.block) < g.block ||
(ssize_t)OUTPOOL(g.block) < 0 ||
g.block > (1UL << 29)) /* limited by append_len() */
bail("block size too large: ", arg);
new_opts();
}
else if (get == 2) {
n = num(arg);
g.procs = (int)n; /* # processes */
if (g.procs < 1)
bail("invalid number of processes: ", arg);
if ((size_t)g.procs != n || INBUFS(g.procs) < 1)
bail("too many processes: ", arg);
#ifdef NOTHREAD
if (g.procs > 1)
bail("compiled without threads", "");
#endif
new_opts();
}
else if (get == 3)
g.sufx = arg; /* gz suffix */
else if (get == 4)
g.zopts.numiterations = num(arg); /* optimization iterations */
else if (get == 5)
g.zopts.blocksplittingmax = num(arg); /* max block splits */
get = 0;
return 0;
}
/* neither an option nor parameter */
return 1;
}
| local int option(char *arg)
{
static int get = 0; /* if not zero, look for option parameter */
char bad[3] = "-X"; /* for error messages (X is replaced) */
/* if no argument or dash option, check status of get */
if (get && (arg == NULL || *arg == '-')) {
bad[1] = "bpSIM"[get - 1];
bail("missing parameter after ", bad);
}
if (arg == NULL)
return 0;
/* process long option or short options */
if (*arg == '-') {
/* a single dash will be interpreted as stdin */
if (*++arg == 0)
return 1;
/* process long option (fall through with equivalent short option) */
if (*arg == '-') {
int j;
arg++;
for (j = NLOPTS - 1; j >= 0; j--)
if (strcmp(arg, longopts[j][0]) == 0) {
arg = longopts[j][1];
break;
}
if (j < 0)
bail("invalid option: ", arg - 2);
}
/* process short options (more than one allowed after dash) */
do {
/* if looking for a parameter, don't process more single character
options until we have the parameter */
if (get) {
if (get == 3)
bail("invalid usage: -s must be followed by space", "");
break; /* allow -pnnn and -bnnn, fall to parameter code */
}
/* process next single character option or compression level */
bad[1] = *arg;
switch (*arg) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
g.level = *arg - '0';
while (arg[1] >= '0' && arg[1] <= '9') {
if (g.level && (INT_MAX - (arg[1] - '0')) / g.level < 10)
bail("only levels 0..9 and 11 are allowed", "");
g.level = g.level * 10 + *++arg - '0';
}
if (g.level == 10 || g.level > 11)
bail("only levels 0..9 and 11 are allowed", "");
new_opts();
break;
case 'F': g.zopts.blocksplittinglast = 1; break;
case 'I': get = 4; break;
case 'K': g.form = 2; g.sufx = ".zip"; break;
case 'L':
fputs(VERSION, stderr);
fputs("Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013"
" Mark Adler\n",
stderr);
fputs("Subject to the terms of the zlib license.\n",
stderr);
fputs("No warranty is provided or implied.\n", stderr);
exit(0);
case 'M': get = 5; break;
case 'N': g.headis |= 0xf; break;
case 'O': g.zopts.blocksplitting = 0; break;
case 'R': g.rsync = 1; break;
case 'S': get = 3; break;
case 'T': g.headis &= ~0xa; break;
case 'V': fputs(VERSION, stderr); exit(0);
case 'Z':
bail("invalid option: LZW output not supported: ", bad);
case 'a':
bail("invalid option: ascii conversion not supported: ", bad);
case 'b': get = 1; break;
case 'c': g.pipeout = 1; break;
case 'd': if (!g.decode) g.headis >>= 2; g.decode = 1; break;
case 'f': g.force = 1; break;
case 'h': help(); break;
case 'i': g.setdict = 0; break;
case 'k': g.keep = 1; break;
case 'l': g.list = 1; break;
case 'n': g.headis &= ~5; break;
case 'p': get = 2; break;
case 'q': g.verbosity = 0; break;
case 'r': g.recurse = 1; break;
case 't': g.decode = 2; break;
case 'v': g.verbosity++; break;
case 'z': g.form = 1; g.sufx = ".zz"; break;
default:
bail("invalid option: ", bad);
}
} while (*++arg);
if (*arg == 0)
return 0;
}
/* process option parameter for -b, -p, -S, -I, or -M */
if (get) {
size_t n;
if (get == 1) {
n = num(arg);
g.block = n << 10; /* chunk size */
if (g.block < DICT)
bail("block size too small (must be >= 32K)", "");
if (n != g.block >> 10 ||
OUTPOOL(g.block) < g.block ||
(ssize_t)OUTPOOL(g.block) < 0 ||
g.block > (1UL << 29)) /* limited by append_len() */
bail("block size too large: ", arg);
new_opts();
}
else if (get == 2) {
n = num(arg);
g.procs = (int)n; /* # processes */
if (g.procs < 1)
bail("invalid number of processes: ", arg);
if ((size_t)g.procs != n || INBUFS(g.procs) < 1)
bail("too many processes: ", arg);
#ifdef NOTHREAD
if (g.procs > 1)
bail("compiled without threads", "");
#endif
new_opts();
}
else if (get == 3)
g.sufx = arg; /* gz suffix */
else if (get == 4)
g.zopts.numiterations = num(arg); /* optimization iterations */
else if (get == 5)
g.zopts.blocksplittingmax = num(arg); /* max block splits */
get = 0;
return 0;
}
/* neither an option nor parameter */
return 1;
}
| C | pigz | 0 |
null | null | null | https://github.com/chromium/chromium/commit/820957a3386e960334be3b93b48636e749d38ea3 | 820957a3386e960334be3b93b48636e749d38ea3 | Make WebContentsDelegate::OpenColorChooser return NULL on failure
Changing WebContentsDelegate::OpenColorChooser to return NULL on failure so we don't put the same ColorChooser into two scoped_ptrs(WebContentsImpl::color_chooser_)
BUG=331790
Review URL: https://codereview.chromium.org/128053002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244710 0039d316-1c4b-4281-b951-d872f2087c98 | int WebContentsImpl::CreateSwappedOutRenderView(
SiteInstance* instance) {
return GetRenderManager()->CreateRenderFrame(instance, MSG_ROUTING_NONE,
true, true);
}
| int WebContentsImpl::CreateSwappedOutRenderView(
SiteInstance* instance) {
return GetRenderManager()->CreateRenderFrame(instance, MSG_ROUTING_NONE,
true, true);
}
| C | Chrome | 0 |
CVE-2013-1848 | https://www.cvedetails.com/cve/CVE-2013-1848/ | CWE-20 | https://github.com/torvalds/linux/commit/8d0c2d10dd72c5292eda7a06231056a4c972e4cc | 8d0c2d10dd72c5292eda7a06231056a4c972e4cc | ext3: Fix format string issues
ext3_msg() takes the printk prefix as the second parameter and the
format string as the third parameter. Two callers of ext3_msg omit the
prefix and pass the format string as the second parameter and the first
parameter to the format string as the third parameter. In both cases
this string comes from an arbitrary source. Which means the string may
contain format string characters, which will
lead to undefined and potentially harmful behavior.
The issue was introduced in commit 4cf46b67eb("ext3: Unify log messages
in ext3") and is fixed by this patch.
CC: [email protected]
Signed-off-by: Lars-Peter Clausen <[email protected]>
Signed-off-by: Jan Kara <[email protected]> | static struct dentry *ext3_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type)
{
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
ext3_nfs_get_inode);
}
| static struct dentry *ext3_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type)
{
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
ext3_nfs_get_inode);
}
| C | linux | 0 |
CVE-2015-3331 | https://www.cvedetails.com/cve/CVE-2015-3331/ | CWE-119 | https://github.com/torvalds/linux/commit/ccfe8c3f7e52ae83155cb038753f4c75b774ca8a | ccfe8c3f7e52ae83155cb038753f4c75b774ca8a | crypto: aesni - fix memory usage in GCM decryption
The kernel crypto API logic requires the caller to provide the
length of (ciphertext || authentication tag) as cryptlen for the
AEAD decryption operation. Thus, the cipher implementation must
calculate the size of the plaintext output itself and cannot simply use
cryptlen.
The RFC4106 GCM decryption operation tries to overwrite cryptlen memory
in req->dst. As the destination buffer for decryption only needs to hold
the plaintext memory but cryptlen references the input buffer holding
(ciphertext || authentication tag), the assumption of the destination
buffer length in RFC4106 GCM operation leads to a too large size. This
patch simply uses the already calculated plaintext size.
In addition, this patch fixes the offset calculation of the AAD buffer
pointer: as mentioned before, cryptlen already includes the size of the
tag. Thus, the tag does not need to be added. With the addition, the AAD
will be written beyond the already allocated buffer.
Note, this fixes a kernel crash that can be triggered from user space
via AF_ALG(aead) -- simply use the libkcapi test application
from [1] and update it to use rfc4106-gcm-aes.
Using [1], the changes were tested using CAVS vectors to demonstrate
that the crypto operation still delivers the right results.
[1] http://www.chronox.de/libkcapi.html
CC: Tadeusz Struk <[email protected]>
Cc: [email protected]
Signed-off-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]> | static int cbc_decrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct crypto_aes_ctx *ctx = aes_ctx(crypto_blkcipher_ctx(desc->tfm));
struct blkcipher_walk walk;
int err;
blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk);
desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
kernel_fpu_begin();
while ((nbytes = walk.nbytes)) {
aesni_cbc_dec(ctx, walk.dst.virt.addr, walk.src.virt.addr,
nbytes & AES_BLOCK_MASK, walk.iv);
nbytes &= AES_BLOCK_SIZE - 1;
err = blkcipher_walk_done(desc, &walk, nbytes);
}
kernel_fpu_end();
return err;
}
| static int cbc_decrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct crypto_aes_ctx *ctx = aes_ctx(crypto_blkcipher_ctx(desc->tfm));
struct blkcipher_walk walk;
int err;
blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk);
desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
kernel_fpu_begin();
while ((nbytes = walk.nbytes)) {
aesni_cbc_dec(ctx, walk.dst.virt.addr, walk.src.virt.addr,
nbytes & AES_BLOCK_MASK, walk.iv);
nbytes &= AES_BLOCK_SIZE - 1;
err = blkcipher_walk_done(desc, &walk, nbytes);
}
kernel_fpu_end();
return err;
}
| C | linux | 0 |
CVE-2019-13307 | https://www.cvedetails.com/cve/CVE-2019-13307/ | CWE-119 | https://github.com/ImageMagick/ImageMagick6/commit/91e58d967a92250439ede038ccfb0913a81e59fe | 91e58d967a92250439ede038ccfb0913a81e59fe | https://github.com/ImageMagick/ImageMagick/issues/1615 | MagickExport MagickBooleanType GetImageChannelRange(const Image *image,
const ChannelType channel,double *minima,double *maxima,
ExceptionInfo *exception)
{
MagickPixelPacket
pixel;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
*maxima=(-MagickMaximumValue);
*minima=MagickMaximumValue;
GetMagickPixelPacket(image,&pixel);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
*magick_restrict indexes;
register const PixelPacket
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetMagickPixelPacket(image,p,indexes+x,&pixel);
if ((channel & RedChannel) != 0)
{
if (pixel.red < *minima)
*minima=(double) pixel.red;
if (pixel.red > *maxima)
*maxima=(double) pixel.red;
}
if ((channel & GreenChannel) != 0)
{
if (pixel.green < *minima)
*minima=(double) pixel.green;
if (pixel.green > *maxima)
*maxima=(double) pixel.green;
}
if ((channel & BlueChannel) != 0)
{
if (pixel.blue < *minima)
*minima=(double) pixel.blue;
if (pixel.blue > *maxima)
*maxima=(double) pixel.blue;
}
if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse))
{
if ((QuantumRange-pixel.opacity) < *minima)
*minima=(double) (QuantumRange-pixel.opacity);
if ((QuantumRange-pixel.opacity) > *maxima)
*maxima=(double) (QuantumRange-pixel.opacity);
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
if ((double) pixel.index < *minima)
*minima=(double) pixel.index;
if ((double) pixel.index > *maxima)
*maxima=(double) pixel.index;
}
p++;
}
}
return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);
}
| MagickExport MagickBooleanType GetImageChannelRange(const Image *image,
const ChannelType channel,double *minima,double *maxima,
ExceptionInfo *exception)
{
MagickPixelPacket
pixel;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
*maxima=(-MagickMaximumValue);
*minima=MagickMaximumValue;
GetMagickPixelPacket(image,&pixel);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
*magick_restrict indexes;
register const PixelPacket
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetMagickPixelPacket(image,p,indexes+x,&pixel);
if ((channel & RedChannel) != 0)
{
if (pixel.red < *minima)
*minima=(double) pixel.red;
if (pixel.red > *maxima)
*maxima=(double) pixel.red;
}
if ((channel & GreenChannel) != 0)
{
if (pixel.green < *minima)
*minima=(double) pixel.green;
if (pixel.green > *maxima)
*maxima=(double) pixel.green;
}
if ((channel & BlueChannel) != 0)
{
if (pixel.blue < *minima)
*minima=(double) pixel.blue;
if (pixel.blue > *maxima)
*maxima=(double) pixel.blue;
}
if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse))
{
if ((QuantumRange-pixel.opacity) < *minima)
*minima=(double) (QuantumRange-pixel.opacity);
if ((QuantumRange-pixel.opacity) > *maxima)
*maxima=(double) (QuantumRange-pixel.opacity);
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
if ((double) pixel.index < *minima)
*minima=(double) pixel.index;
if ((double) pixel.index > *maxima)
*maxima=(double) pixel.index;
}
p++;
}
}
return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);
}
| C | ImageMagick6 | 0 |
CVE-2016-5183 | https://www.cvedetails.com/cve/CVE-2016-5183/ | CWE-416 | https://github.com/chromium/chromium/commit/8cfe2463cec6835c7b0b73dcb2ab2edaf035e3f9 | 8cfe2463cec6835c7b0b73dcb2ab2edaf035e3f9 | Refactor the AppController implementation into a KeyedService.
This is necessary to guarantee that the AppController will not outlive
the AppServiceProxy, which could happen before during Profile destruction.
Bug: 945427
Change-Id: I9e2089799e38d5a70a4a9aa66df5319113e7809e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1542336
Reviewed-by: Michael Giuffrida <[email protected]>
Commit-Queue: Lucas Tenório <[email protected]>
Cr-Commit-Position: refs/heads/master@{#645122} | void KioskNextHomeInterfaceBrokerImpl::GetIdentityAccessor(
::identity::mojom::IdentityAccessorRequest request) {
connector_->BindInterface(::identity::mojom::kServiceName,
std::move(request));
}
| void KioskNextHomeInterfaceBrokerImpl::GetIdentityAccessor(
::identity::mojom::IdentityAccessorRequest request) {
connector_->BindInterface(::identity::mojom::kServiceName,
std::move(request));
}
| C | Chrome | 0 |
null | null | null | https://github.com/chromium/chromium/commit/74c1ec481b33194dc7a428f2d58fc89640b313ae | 74c1ec481b33194dc7a428f2d58fc89640b313ae | Fix glGetFramebufferAttachmentParameteriv so it returns
current names for buffers.
TEST=unit_tests and conformance tests
BUG=none
Review URL: http://codereview.chromium.org/3135003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55831 0039d316-1c4b-4281-b951-d872f2087c98 | GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
: GLES2Decoder(group),
error_bits_(0),
util_(0), // TODO(gman): Set to actual num compress texture formats.
pack_alignment_(4),
unpack_alignment_(4),
attrib_0_buffer_id_(0),
attrib_0_size_(0),
active_texture_unit_(0),
black_2d_texture_id_(0),
black_cube_texture_id_(0),
clear_red_(0),
clear_green_(0),
clear_blue_(0),
clear_alpha_(0),
mask_red_(true),
mask_green_(true),
mask_blue_(true),
mask_alpha_(true),
clear_stencil_(0),
mask_stencil_front_(-1),
mask_stencil_back_(-1),
clear_depth_(1.0f),
mask_depth_(true),
enable_scissor_test_(false),
anti_aliased_(false),
use_shader_translator_(true),
vertex_compiler_(NULL),
fragment_compiler_(NULL),
validators_(group->validators()),
depth24_stencil8_oes_supported_(false) {
attrib_0_value_.v[0] = 0.0f;
attrib_0_value_.v[1] = 0.0f;
attrib_0_value_.v[2] = 0.0f;
attrib_0_value_.v[3] = 1.0f;
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ||
gfx::GetGLImplementation() == gfx::kGLImplementationMockGL) {
use_shader_translator_ = false;
}
}
| GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
: GLES2Decoder(group),
error_bits_(0),
util_(0), // TODO(gman): Set to actual num compress texture formats.
pack_alignment_(4),
unpack_alignment_(4),
attrib_0_buffer_id_(0),
attrib_0_size_(0),
active_texture_unit_(0),
black_2d_texture_id_(0),
black_cube_texture_id_(0),
clear_red_(0),
clear_green_(0),
clear_blue_(0),
clear_alpha_(0),
mask_red_(true),
mask_green_(true),
mask_blue_(true),
mask_alpha_(true),
clear_stencil_(0),
mask_stencil_front_(-1),
mask_stencil_back_(-1),
clear_depth_(1.0f),
mask_depth_(true),
enable_scissor_test_(false),
anti_aliased_(false),
use_shader_translator_(true),
vertex_compiler_(NULL),
fragment_compiler_(NULL),
validators_(group->validators()),
depth24_stencil8_oes_supported_(false) {
attrib_0_value_.v[0] = 0.0f;
attrib_0_value_.v[1] = 0.0f;
attrib_0_value_.v[2] = 0.0f;
attrib_0_value_.v[3] = 1.0f;
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ||
gfx::GetGLImplementation() == gfx::kGLImplementationMockGL) {
use_shader_translator_ = false;
}
}
| C | Chrome | 0 |
CVE-2015-6768 | https://www.cvedetails.com/cve/CVE-2015-6768/ | CWE-264 | https://github.com/chromium/chromium/commit/4c8b008f055f79e622344627fed7f820375a4f01 | 4c8b008f055f79e622344627fed7f820375a4f01 | Change Document::detach() to RELEASE_ASSERT all subframes are gone.
BUG=556724,577105
Review URL: https://codereview.chromium.org/1667573002
Cr-Commit-Position: refs/heads/master@{#373642} | static ParseQualifiedNameResult parseQualifiedNameInternal(const AtomicString& qualifiedName, const CharType* characters, unsigned length, AtomicString& prefix, AtomicString& localName)
{
bool nameStart = true;
bool sawColon = false;
int colonPos = 0;
for (unsigned i = 0; i < length;) {
UChar32 c;
U16_NEXT(characters, i, length, c)
if (c == ':') {
if (sawColon)
return ParseQualifiedNameResult(QNMultipleColons);
nameStart = true;
sawColon = true;
colonPos = i - 1;
} else if (nameStart) {
if (!isValidNameStart(c))
return ParseQualifiedNameResult(QNInvalidStartChar, c);
nameStart = false;
} else {
if (!isValidNamePart(c))
return ParseQualifiedNameResult(QNInvalidChar, c);
}
}
if (!sawColon) {
prefix = nullAtom;
localName = qualifiedName;
} else {
prefix = AtomicString(characters, colonPos);
if (prefix.isEmpty())
return ParseQualifiedNameResult(QNEmptyPrefix);
int prefixStart = colonPos + 1;
localName = AtomicString(characters + prefixStart, length - prefixStart);
}
if (localName.isEmpty())
return ParseQualifiedNameResult(QNEmptyLocalName);
return ParseQualifiedNameResult(QNValid);
}
| static ParseQualifiedNameResult parseQualifiedNameInternal(const AtomicString& qualifiedName, const CharType* characters, unsigned length, AtomicString& prefix, AtomicString& localName)
{
bool nameStart = true;
bool sawColon = false;
int colonPos = 0;
for (unsigned i = 0; i < length;) {
UChar32 c;
U16_NEXT(characters, i, length, c)
if (c == ':') {
if (sawColon)
return ParseQualifiedNameResult(QNMultipleColons);
nameStart = true;
sawColon = true;
colonPos = i - 1;
} else if (nameStart) {
if (!isValidNameStart(c))
return ParseQualifiedNameResult(QNInvalidStartChar, c);
nameStart = false;
} else {
if (!isValidNamePart(c))
return ParseQualifiedNameResult(QNInvalidChar, c);
}
}
if (!sawColon) {
prefix = nullAtom;
localName = qualifiedName;
} else {
prefix = AtomicString(characters, colonPos);
if (prefix.isEmpty())
return ParseQualifiedNameResult(QNEmptyPrefix);
int prefixStart = colonPos + 1;
localName = AtomicString(characters + prefixStart, length - prefixStart);
}
if (localName.isEmpty())
return ParseQualifiedNameResult(QNEmptyLocalName);
return ParseQualifiedNameResult(QNValid);
}
| C | Chrome | 0 |
CVE-2012-5375 | https://www.cvedetails.com/cve/CVE-2012-5375/ | CWE-310 | https://github.com/torvalds/linux/commit/9c52057c698fb96f8f07e7a4bcf4801a092bda89 | 9c52057c698fb96f8f07e7a4bcf4801a092bda89 | Btrfs: fix hash overflow handling
The handling for directory crc hash overflows was fairly obscure,
split_leaf returns EOVERFLOW when we try to extend the item and that is
supposed to bubble up to userland. For a while it did so, but along the
way we added better handling of errors and forced the FS readonly if we
hit IO errors during the directory insertion.
Along the way, we started testing only for EEXIST and the EOVERFLOW case
was dropped. The end result is that we may force the FS readonly if we
catch a directory hash bucket overflow.
This fixes a few problem spots. First I add tests for EOVERFLOW in the
places where we can safely just return the error up the chain.
btrfs_rename is harder though, because it tries to insert the new
directory item only after it has already unlinked anything the rename
was going to overwrite. Rather than adding very complex logic, I added
a helper to test for the hash overflow case early while it is still safe
to bail out.
Snapshot and subvolume creation had a similar problem, so they are using
the new helper now too.
Signed-off-by: Chris Mason <[email protected]>
Reported-by: Pascal Junod <[email protected]> | static void btrfs_run_delalloc_work(struct btrfs_work *work)
{
struct btrfs_delalloc_work *delalloc_work;
delalloc_work = container_of(work, struct btrfs_delalloc_work,
work);
if (delalloc_work->wait)
btrfs_wait_ordered_range(delalloc_work->inode, 0, (u64)-1);
else
filemap_flush(delalloc_work->inode->i_mapping);
if (delalloc_work->delay_iput)
btrfs_add_delayed_iput(delalloc_work->inode);
else
iput(delalloc_work->inode);
complete(&delalloc_work->completion);
}
| static void btrfs_run_delalloc_work(struct btrfs_work *work)
{
struct btrfs_delalloc_work *delalloc_work;
delalloc_work = container_of(work, struct btrfs_delalloc_work,
work);
if (delalloc_work->wait)
btrfs_wait_ordered_range(delalloc_work->inode, 0, (u64)-1);
else
filemap_flush(delalloc_work->inode->i_mapping);
if (delalloc_work->delay_iput)
btrfs_add_delayed_iput(delalloc_work->inode);
else
iput(delalloc_work->inode);
complete(&delalloc_work->completion);
}
| C | linux | 0 |
CVE-2017-9203 | https://www.cvedetails.com/cve/CVE-2017-9203/ | CWE-787 | https://github.com/jsummers/imageworsener/commit/a4f247707f08e322f0b41e82c3e06e224240a654 | a4f247707f08e322f0b41e82c3e06e224240a654 | Fixed a bug that could cause invalid memory to be accessed
The bug could happen when transparency is removed from an image.
Also fixed a semi-related BMP error handling logic bug.
Fixes issue #21 | static iw_tmpsample iw_color_to_grayscale(struct iw_context *ctx,
iw_tmpsample r, iw_tmpsample g, iw_tmpsample b)
{
iw_tmpsample v0,v1,v2;
switch(ctx->grayscale_formula) {
case IW_GSF_WEIGHTED:
return ctx->grayscale_weight[0]*r +
ctx->grayscale_weight[1]*g +
ctx->grayscale_weight[2]*b;
case IW_GSF_ORDERBYVALUE:
if(g<=r) { v0=r; v1=g; }
else { v0=g; v1=r; }
if(b<=v1) {
v2=b;
}
else {
v2=v1;
if(b<=v0) { v1=b; }
else { v1=v0; v0=b; }
}
return ctx->grayscale_weight[0]*v0 +
ctx->grayscale_weight[1]*v1 +
ctx->grayscale_weight[2]*v2;
}
return 0.0;
}
| static iw_tmpsample iw_color_to_grayscale(struct iw_context *ctx,
iw_tmpsample r, iw_tmpsample g, iw_tmpsample b)
{
iw_tmpsample v0,v1,v2;
switch(ctx->grayscale_formula) {
case IW_GSF_WEIGHTED:
return ctx->grayscale_weight[0]*r +
ctx->grayscale_weight[1]*g +
ctx->grayscale_weight[2]*b;
case IW_GSF_ORDERBYVALUE:
if(g<=r) { v0=r; v1=g; }
else { v0=g; v1=r; }
if(b<=v1) {
v2=b;
}
else {
v2=v1;
if(b<=v0) { v1=b; }
else { v1=v0; v0=b; }
}
return ctx->grayscale_weight[0]*v0 +
ctx->grayscale_weight[1]*v1 +
ctx->grayscale_weight[2]*v2;
}
return 0.0;
}
| C | imageworsener | 0 |
CVE-2018-6178 | https://www.cvedetails.com/cve/CVE-2018-6178/ | CWE-254 | https://github.com/chromium/chromium/commit/fbeba958bb83c05ec8cc54e285a4a9ca10d1b311 | fbeba958bb83c05ec8cc54e285a4a9ca10d1b311 | Allow to specify elide behavior for confrim infobar message
Used in "<extension name> is debugging this browser" infobar.
Bug: 823194
Change-Id: Iff6627097c020cccca8f7cc3e21a803a41fd8f2c
Reviewed-on: https://chromium-review.googlesource.com/1048064
Commit-Queue: Dmitry Gozman <[email protected]>
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#557245} | void GlobalConfirmInfoBar::MaybeAddInfoBar(content::WebContents* web_contents) {
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
DCHECK(infobar_service);
if (ContainsKey(proxies_, infobar_service))
return;
std::unique_ptr<GlobalConfirmInfoBar::DelegateProxy> proxy(
new GlobalConfirmInfoBar::DelegateProxy(weak_factory_.GetWeakPtr()));
GlobalConfirmInfoBar::DelegateProxy* proxy_ptr = proxy.get();
infobars::InfoBar* added_bar = infobar_service->AddInfoBar(
infobar_service->CreateConfirmInfoBar(std::move(proxy)));
if (!added_bar) {
if (!is_closing_) {
is_closing_ = true;
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&GlobalConfirmInfoBar::Close, weak_factory_.GetWeakPtr()));
}
return;
}
proxy_ptr->info_bar_ = added_bar;
proxies_[infobar_service] = proxy_ptr;
infobar_service->AddObserver(this);
}
| void GlobalConfirmInfoBar::MaybeAddInfoBar(content::WebContents* web_contents) {
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
DCHECK(infobar_service);
if (ContainsKey(proxies_, infobar_service))
return;
std::unique_ptr<GlobalConfirmInfoBar::DelegateProxy> proxy(
new GlobalConfirmInfoBar::DelegateProxy(weak_factory_.GetWeakPtr()));
GlobalConfirmInfoBar::DelegateProxy* proxy_ptr = proxy.get();
infobars::InfoBar* added_bar = infobar_service->AddInfoBar(
infobar_service->CreateConfirmInfoBar(std::move(proxy)));
if (!added_bar) {
if (!is_closing_) {
is_closing_ = true;
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&GlobalConfirmInfoBar::Close, weak_factory_.GetWeakPtr()));
}
return;
}
proxy_ptr->info_bar_ = added_bar;
proxies_[infobar_service] = proxy_ptr;
infobar_service->AddObserver(this);
}
| C | Chrome | 0 |
CVE-2015-2348 | https://www.cvedetails.com/cve/CVE-2015-2348/ | CWE-264 | https://git.php.net/?p=php-src.git;a=commit;h=1291d6bbee93b6109eb07e8f7916ff1b7fcc13e1 | 1291d6bbee93b6109eb07e8f7916ff1b7fcc13e1 | null | PHP_FUNCTION(set_magic_quotes_runtime)
{
zend_bool new_setting;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
return;
}
if (new_setting) {
php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
}
RETURN_FALSE;
}
| PHP_FUNCTION(set_magic_quotes_runtime)
{
zend_bool new_setting;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
return;
}
if (new_setting) {
php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
}
RETURN_FALSE;
}
| C | php | 0 |
CVE-2017-9330 | https://www.cvedetails.com/cve/CVE-2017-9330/ | CWE-835 | https://git.qemu.org/?p=qemu.git;a=commit;h=26f670a244982335cc08943fb1ec099a2c81e42d | 26f670a244982335cc08943fb1ec099a2c81e42d | null | static void usb_ohci_exit(PCIDevice *dev)
{
OHCIPCIState *ohci = PCI_OHCI(dev);
OHCIState *s = &ohci->state;
trace_usb_ohci_exit(s->name);
ohci_bus_stop(s);
if (s->async_td) {
usb_cancel_packet(&s->usb_packet);
s->async_td = 0;
}
ohci_stop_endpoints(s);
if (!ohci->masterbus) {
usb_bus_release(&s->bus);
}
timer_del(s->eof_timer);
timer_free(s->eof_timer);
}
| static void usb_ohci_exit(PCIDevice *dev)
{
OHCIPCIState *ohci = PCI_OHCI(dev);
OHCIState *s = &ohci->state;
trace_usb_ohci_exit(s->name);
ohci_bus_stop(s);
if (s->async_td) {
usb_cancel_packet(&s->usb_packet);
s->async_td = 0;
}
ohci_stop_endpoints(s);
if (!ohci->masterbus) {
usb_bus_release(&s->bus);
}
timer_del(s->eof_timer);
timer_free(s->eof_timer);
}
| C | qemu | 0 |
CVE-2016-3751 | https://www.cvedetails.com/cve/CVE-2016-3751/ | null | https://android.googlesource.com/platform/external/libpng/+/9d4853418ab2f754c2b63e091c29c5529b8b86ca | 9d4853418ab2f754c2b63e091c29c5529b8b86ca | DO NOT MERGE Update libpng to 1.6.20
BUG:23265085
Change-Id: I85199805636d771f3597b691b63bc0bf46084833
(cherry picked from commit bbe98b40cda082024b669fa508931042eed18f82)
| gpc_gb16(Pixel *out, const Pixel *in, const Background *back)
{
if (in->a <= 0)
out->r = out->g = out->b = back->ig;
else if (in->a >= 65535)
out->r = out->g = out->b = isRGB(in->g);
else
{
double a = in->a / 65535.;
double a1 = 1-a;
a /= 65535;
out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
}
out->a = 255;
}
| gpc_gb16(Pixel *out, const Pixel *in, const Background *back)
{
if (in->a <= 0)
out->r = out->g = out->b = back->ig;
else if (in->a >= 65535)
out->r = out->g = out->b = isRGB(in->g);
else
{
double a = in->a / 65535.;
double a1 = 1-a;
a /= 65535;
out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
}
out->a = 255;
}
| C | Android | 0 |
CVE-2013-6661 | https://www.cvedetails.com/cve/CVE-2013-6661/ | null | https://github.com/chromium/chromium/commit/23cbfc1d685fa7389e88588584e02786820d4d26 | 23cbfc1d685fa7389e88588584e02786820d4d26 | Add the SandboxedDMGParser and wire it up to the DownloadProtectionService.
BUG=496898,464083
[email protected], [email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/1299223006 .
Cr-Commit-Position: refs/heads/master@{#344876} | void StartExtractFileFeatures() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(item_); // Called directly from Start(), item should still exist.
BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
FROM_HERE,
base::Bind(&CheckClientDownloadRequest::ExtractFileFeatures,
this, item_->GetFullPath()),
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
| void StartExtractFileFeatures() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(item_); // Called directly from Start(), item should still exist.
BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
FROM_HERE,
base::Bind(&CheckClientDownloadRequest::ExtractFileFeatures,
this, item_->GetFullPath()),
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
| C | Chrome | 0 |
CVE-2013-2902 | https://www.cvedetails.com/cve/CVE-2013-2902/ | CWE-399 | https://github.com/chromium/chromium/commit/87a082c5137a63dedb3fe5b1f48f75dcd1fd780c | 87a082c5137a63dedb3fe5b1f48f75dcd1fd780c | Removed pinch viewport scroll offset distribution
The associated change in Blink makes the pinch viewport a proper
ScrollableArea meaning the normal path for synchronizing layer scroll
offsets is used.
This is a 2 sided patch, the other CL:
https://codereview.chromium.org/199253002/
BUG=349941
Review URL: https://codereview.chromium.org/210543002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260105 0039d316-1c4b-4281-b951-d872f2087c98 | void LayerTreeHost::RateLimit() {
proxy_->ForceSerializeOnSwapBuffers();
client_->RateLimitSharedMainThreadContext();
}
| void LayerTreeHost::RateLimit() {
proxy_->ForceSerializeOnSwapBuffers();
client_->RateLimitSharedMainThreadContext();
}
| C | Chrome | 0 |
CVE-2017-7895 | https://www.cvedetails.com/cve/CVE-2017-7895/ | CWE-119 | https://github.com/torvalds/linux/commit/13bf9fbff0e5e099e2b6f003a0ab8ae145436309 | 13bf9fbff0e5e099e2b6f003a0ab8ae145436309 | nfsd: stricter decoding of write-like NFSv2/v3 ops
The NFSv2/v3 code does not systematically check whether we decode past
the end of the buffer. This generally appears to be harmless, but there
are a few places where we do arithmetic on the pointers involved and
don't account for the possibility that a length could be negative. Add
checks to catch these.
Reported-by: Tuomas Haanpää <[email protected]>
Reported-by: Ari Kauppi <[email protected]>
Reviewed-by: NeilBrown <[email protected]>
Cc: [email protected]
Signed-off-by: J. Bruce Fields <[email protected]> | nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_writeargs *args)
{
unsigned int len, hdr, dlen;
struct kvec *head = rqstp->rq_arg.head;
int v;
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p++; /* beginoffset */
args->offset = ntohl(*p++); /* offset */
p++; /* totalcount */
len = args->len = ntohl(*p++);
/*
* The protocol specifies a maximum of 8192 bytes.
*/
if (len > NFSSVC_MAXBLKSIZE_V2)
return 0;
/*
* Check to make sure that we got the right number of
* bytes.
*/
hdr = (void*)p - head->iov_base;
if (hdr > head->iov_len)
return 0;
dlen = head->iov_len + rqstp->rq_arg.page_len - hdr;
/*
* Round the length of the data which was specified up to
* the next multiple of XDR units and then compare that
* against the length which was actually received.
* Note that when RPCSEC/GSS (for example) is used, the
* data buffer can be padded so dlen might be larger
* than required. It must never be smaller.
*/
if (dlen < XDR_QUADLEN(len)*4)
return 0;
rqstp->rq_vec[0].iov_base = (void*)p;
rqstp->rq_vec[0].iov_len = head->iov_len - hdr;
v = 0;
while (len > rqstp->rq_vec[v].iov_len) {
len -= rqstp->rq_vec[v].iov_len;
v++;
rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]);
rqstp->rq_vec[v].iov_len = PAGE_SIZE;
}
rqstp->rq_vec[v].iov_len = len;
args->vlen = v + 1;
return 1;
}
| nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_writeargs *args)
{
unsigned int len, hdr, dlen;
struct kvec *head = rqstp->rq_arg.head;
int v;
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p++; /* beginoffset */
args->offset = ntohl(*p++); /* offset */
p++; /* totalcount */
len = args->len = ntohl(*p++);
/*
* The protocol specifies a maximum of 8192 bytes.
*/
if (len > NFSSVC_MAXBLKSIZE_V2)
return 0;
/*
* Check to make sure that we got the right number of
* bytes.
*/
hdr = (void*)p - head->iov_base;
dlen = head->iov_len + rqstp->rq_arg.page_len - hdr;
/*
* Round the length of the data which was specified up to
* the next multiple of XDR units and then compare that
* against the length which was actually received.
* Note that when RPCSEC/GSS (for example) is used, the
* data buffer can be padded so dlen might be larger
* than required. It must never be smaller.
*/
if (dlen < XDR_QUADLEN(len)*4)
return 0;
rqstp->rq_vec[0].iov_base = (void*)p;
rqstp->rq_vec[0].iov_len = head->iov_len - hdr;
v = 0;
while (len > rqstp->rq_vec[v].iov_len) {
len -= rqstp->rq_vec[v].iov_len;
v++;
rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]);
rqstp->rq_vec[v].iov_len = PAGE_SIZE;
}
rqstp->rq_vec[v].iov_len = len;
args->vlen = v + 1;
return 1;
}
| C | linux | 1 |
CVE-2012-2133 | https://www.cvedetails.com/cve/CVE-2012-2133/ | CWE-399 | https://github.com/torvalds/linux/commit/90481622d75715bfcb68501280a917dbfe516029 | 90481622d75715bfcb68501280a917dbfe516029 | hugepages: fix use after free bug in "quota" handling
hugetlbfs_{get,put}_quota() are badly named. They don't interact with the
general quota handling code, and they don't much resemble its behaviour.
Rather than being about maintaining limits on on-disk block usage by
particular users, they are instead about maintaining limits on in-memory
page usage (including anonymous MAP_PRIVATE copied-on-write pages)
associated with a particular hugetlbfs filesystem instance.
Worse, they work by having callbacks to the hugetlbfs filesystem code from
the low-level page handling code, in particular from free_huge_page().
This is a layering violation of itself, but more importantly, if the
kernel does a get_user_pages() on hugepages (which can happen from KVM
amongst others), then the free_huge_page() can be delayed until after the
associated inode has already been freed. If an unmount occurs at the
wrong time, even the hugetlbfs superblock where the "quota" limits are
stored may have been freed.
Andrew Barry proposed a patch to fix this by having hugepages, instead of
storing a pointer to their address_space and reaching the superblock from
there, had the hugepages store pointers directly to the superblock,
bumping the reference count as appropriate to avoid it being freed.
Andrew Morton rejected that version, however, on the grounds that it made
the existing layering violation worse.
This is a reworked version of Andrew's patch, which removes the extra, and
some of the existing, layering violation. It works by introducing the
concept of a hugepage "subpool" at the lower hugepage mm layer - that is a
finite logical pool of hugepages to allocate from. hugetlbfs now creates
a subpool for each filesystem instance with a page limit set, and a
pointer to the subpool gets added to each allocated hugepage, instead of
the address_space pointer used now. The subpool has its own lifetime and
is only freed once all pages in it _and_ all other references to it (i.e.
superblocks) are gone.
subpools are optional - a NULL subpool pointer is taken by the code to
mean that no subpool limits are in effect.
Previous discussion of this bug found in: "Fix refcounting in hugetlbfs
quota handling.". See: https://lkml.org/lkml/2011/8/11/28 or
http://marc.info/?l=linux-mm&m=126928970510627&w=1
v2: Fixed a bug spotted by Hillf Danton, and removed the extra parameter to
alloc_huge_page() - since it already takes the vma, it is not necessary.
Signed-off-by: Andrew Barry <[email protected]>
Signed-off-by: David Gibson <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]> | static void hugetlbfs_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
}
| static void hugetlbfs_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
}
| C | linux | 0 |
CVE-2011-3209 | https://www.cvedetails.com/cve/CVE-2011-3209/ | CWE-189 | https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d | f8bd2258e2d520dff28c855658bd24bdafb5102d | remove div_long_long_rem
x86 is the only arch right now, which provides an optimized for
div_long_long_rem and it has the downside that one has to be very careful that
the divide doesn't overflow.
The API is a little akward, as the arguments for the unsigned divide are
signed. The signed version also doesn't handle a negative divisor and
produces worse code on 64bit archs.
There is little incentive to keep this API alive, so this converts the few
users to the new API.
Signed-off-by: Roman Zippel <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: john stultz <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]> | static int __init setup_slub_max_order(char *str)
{
get_option(&str, &slub_max_order);
return 1;
}
| static int __init setup_slub_max_order(char *str)
{
get_option(&str, &slub_max_order);
return 1;
}
| C | linux | 0 |
CVE-2018-6171 | https://www.cvedetails.com/cve/CVE-2018-6171/ | CWE-416 | https://github.com/chromium/chromium/commit/c5c6320f80159dc41dffc3cfbf0298925c7dcf1b | c5c6320f80159dc41dffc3cfbf0298925c7dcf1b | chrome.bluetoothSocket: Fix regression in send()
In https://crrev.com/c/997098, params_ was changed to a local variable,
but it needs to last longer than that since net::WrappedIOBuffer may use
the data after the local variable goes out of scope.
This CL changed it back to be an instance variable.
Bug: 851799
Change-Id: I392f8acaef4c6473d6ea4fbee7209445aa09112e
Reviewed-on: https://chromium-review.googlesource.com/1103676
Reviewed-by: Toni Barzic <[email protected]>
Commit-Queue: Sonny Sasaka <[email protected]>
Cr-Commit-Position: refs/heads/master@{#568137} | const std::string& BluetoothSocketListenUsingRfcommFunction::uuid() const {
return params_->uuid;
}
| const std::string& BluetoothSocketListenUsingRfcommFunction::uuid() const {
return params_->uuid;
}
| C | Chrome | 0 |
CVE-2014-9717 | https://www.cvedetails.com/cve/CVE-2014-9717/ | CWE-284 | https://github.com/torvalds/linux/commit/ce07d891a0891d3c0d0c2d73d577490486b809e1 | ce07d891a0891d3c0d0c2d73d577490486b809e1 | mnt: Honor MNT_LOCKED when detaching mounts
Modify umount(MNT_DETACH) to keep mounts in the hash table that are
locked to their parent mounts, when the parent is lazily unmounted.
In mntput_no_expire detach the children from the hash table, depending
on mnt_pin_kill in cleanup_mnt to decrement the mnt_count of the children.
In __detach_mounts if there are any mounts that have been unmounted
but still are on the list of mounts of a mountpoint, remove their
children from the mount hash table and those children to the unmounted
list so they won't linger potentially indefinitely waiting for their
final mntput, now that the mounts serve no purpose.
Cc: [email protected]
Signed-off-by: "Eric W. Biederman" <[email protected]> | static void mntput_no_expire(struct mount *mnt)
{
rcu_read_lock();
mnt_add_count(mnt, -1);
if (likely(mnt->mnt_ns)) { /* shouldn't be the last one */
rcu_read_unlock();
return;
}
lock_mount_hash();
if (mnt_get_count(mnt)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
mnt->mnt.mnt_flags |= MNT_DOOMED;
rcu_read_unlock();
list_del(&mnt->mnt_instance);
if (unlikely(!list_empty(&mnt->mnt_mounts))) {
struct mount *p, *tmp;
list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
umount_mnt(p);
}
}
unlock_mount_hash();
if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
struct task_struct *task = current;
if (likely(!(task->flags & PF_KTHREAD))) {
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
if (!task_work_add(task, &mnt->mnt_rcu, true))
return;
}
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
schedule_delayed_work(&delayed_mntput_work, 1);
return;
}
cleanup_mnt(mnt);
}
| static void mntput_no_expire(struct mount *mnt)
{
rcu_read_lock();
mnt_add_count(mnt, -1);
if (likely(mnt->mnt_ns)) { /* shouldn't be the last one */
rcu_read_unlock();
return;
}
lock_mount_hash();
if (mnt_get_count(mnt)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
mnt->mnt.mnt_flags |= MNT_DOOMED;
rcu_read_unlock();
list_del(&mnt->mnt_instance);
unlock_mount_hash();
if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
struct task_struct *task = current;
if (likely(!(task->flags & PF_KTHREAD))) {
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
if (!task_work_add(task, &mnt->mnt_rcu, true))
return;
}
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
schedule_delayed_work(&delayed_mntput_work, 1);
return;
}
cleanup_mnt(mnt);
}
| C | linux | 1 |
CVE-2015-1265 | https://www.cvedetails.com/cve/CVE-2015-1265/ | null | https://github.com/chromium/chromium/commit/04ff52bb66284467ccb43d90800013b89ee8db75 | 04ff52bb66284467ccb43d90800013b89ee8db75 | Switching AudioOutputAuthorizationHandler from using AudioManager interface to AudioSystem one.
BUG=672468
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Review-Url: https://codereview.chromium.org/2692203003
Cr-Commit-Position: refs/heads/master@{#450939} | void RenderProcessHostImpl::ProcessDied(bool already_dead,
RendererClosedDetails* known_details) {
DCHECK(!within_process_died_observer_);
DCHECK(!deleting_soon_);
base::TerminationStatus status = base::TERMINATION_STATUS_NORMAL_TERMINATION;
int exit_code = 0;
if (known_details) {
status = known_details->status;
exit_code = known_details->exit_code;
} else if (child_process_launcher_.get()) {
status = child_process_launcher_->GetChildTerminationStatus(already_dead,
&exit_code);
if (already_dead && status == base::TERMINATION_STATUS_STILL_RUNNING) {
status = base::TERMINATION_STATUS_PROCESS_CRASHED;
}
}
RendererClosedDetails details(status, exit_code);
child_process_launcher_.reset();
is_dead_ = true;
if (route_provider_binding_.is_bound())
route_provider_binding_.Close();
ResetChannelProxy();
UpdateProcessPriority();
DCHECK(!is_process_backgrounded_);
within_process_died_observer_ = true;
NotificationService::current()->Notify(
NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this),
Details<RendererClosedDetails>(&details));
for (auto& observer : observers_)
observer.RenderProcessExited(this, status, exit_code);
within_process_died_observer_ = false;
message_port_message_filter_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
IDMap<IPC::Listener*>::iterator iter(&listeners_);
while (!iter.IsAtEnd()) {
iter.GetCurrentValue()->OnMessageReceived(FrameHostMsg_RenderProcessGone(
iter.GetCurrentKey(), static_cast<int>(status), exit_code));
iter.Advance();
}
EnableSendQueue();
if (delayed_cleanup_needed_)
Cleanup();
}
| void RenderProcessHostImpl::ProcessDied(bool already_dead,
RendererClosedDetails* known_details) {
DCHECK(!within_process_died_observer_);
DCHECK(!deleting_soon_);
base::TerminationStatus status = base::TERMINATION_STATUS_NORMAL_TERMINATION;
int exit_code = 0;
if (known_details) {
status = known_details->status;
exit_code = known_details->exit_code;
} else if (child_process_launcher_.get()) {
status = child_process_launcher_->GetChildTerminationStatus(already_dead,
&exit_code);
if (already_dead && status == base::TERMINATION_STATUS_STILL_RUNNING) {
status = base::TERMINATION_STATUS_PROCESS_CRASHED;
}
}
RendererClosedDetails details(status, exit_code);
child_process_launcher_.reset();
is_dead_ = true;
if (route_provider_binding_.is_bound())
route_provider_binding_.Close();
ResetChannelProxy();
UpdateProcessPriority();
DCHECK(!is_process_backgrounded_);
within_process_died_observer_ = true;
NotificationService::current()->Notify(
NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this),
Details<RendererClosedDetails>(&details));
for (auto& observer : observers_)
observer.RenderProcessExited(this, status, exit_code);
within_process_died_observer_ = false;
message_port_message_filter_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
IDMap<IPC::Listener*>::iterator iter(&listeners_);
while (!iter.IsAtEnd()) {
iter.GetCurrentValue()->OnMessageReceived(FrameHostMsg_RenderProcessGone(
iter.GetCurrentKey(), static_cast<int>(status), exit_code));
iter.Advance();
}
EnableSendQueue();
if (delayed_cleanup_needed_)
Cleanup();
}
| C | Chrome | 0 |
CVE-2016-0838 | https://www.cvedetails.com/cve/CVE-2016-0838/ | CWE-119 | https://android.googlesource.com/platform/external/sonivox/+/3ac044334c3ff6a61cb4238ff3ddaf17c7efcf49 | 3ac044334c3ff6a61cb4238ff3ddaf17c7efcf49 | Sonivox: sanity check numSamples.
Bug: 26366256
Change-Id: I066888c25035ea4c60c88f316db4508dc4dab6bc
| void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
{
EAS_PCM *pAudioBuffer;
EAS_I32 k;
EAS_I32 b1;
EAS_I32 b2;
EAS_I32 z1;
EAS_I32 z2;
EAS_I32 acc0;
EAS_I32 acc1;
EAS_I32 numSamples;
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
if (numSamples <= 0) {
ALOGE("b/26366256");
return;
}
pAudioBuffer = pWTIntFrame->pAudioBuffer;
z1 = pFilter->z1;
z2 = pFilter->z2;
b1 = -pWTIntFrame->frame.b1;
/*lint -e{702} <avoid divide> */
b2 = -pWTIntFrame->frame.b2 >> 1;
/*lint -e{702} <avoid divide> */
k = pWTIntFrame->frame.k >> 1;
while (numSamples--)
{
/* do filter calculations */
acc0 = *pAudioBuffer;
acc1 = z1 * b1;
acc1 += z2 * b2;
acc0 = acc1 + k * acc0;
z2 = z1;
/*lint -e{702} <avoid divide> */
z1 = acc0 >> 14;
*pAudioBuffer++ = (EAS_I16) z1;
}
/* save delay values */
pFilter->z1 = (EAS_I16) z1;
pFilter->z2 = (EAS_I16) z2;
}
| void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
{
EAS_PCM *pAudioBuffer;
EAS_I32 k;
EAS_I32 b1;
EAS_I32 b2;
EAS_I32 z1;
EAS_I32 z2;
EAS_I32 acc0;
EAS_I32 acc1;
EAS_I32 numSamples;
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
pAudioBuffer = pWTIntFrame->pAudioBuffer;
z1 = pFilter->z1;
z2 = pFilter->z2;
b1 = -pWTIntFrame->frame.b1;
/*lint -e{702} <avoid divide> */
b2 = -pWTIntFrame->frame.b2 >> 1;
/*lint -e{702} <avoid divide> */
k = pWTIntFrame->frame.k >> 1;
while (numSamples--)
{
/* do filter calculations */
acc0 = *pAudioBuffer;
acc1 = z1 * b1;
acc1 += z2 * b2;
acc0 = acc1 + k * acc0;
z2 = z1;
/*lint -e{702} <avoid divide> */
z1 = acc0 >> 14;
*pAudioBuffer++ = (EAS_I16) z1;
}
/* save delay values */
pFilter->z1 = (EAS_I16) z1;
pFilter->z2 = (EAS_I16) z2;
}
| C | Android | 1 |
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 int setup_proc_entry( struct net_device *dev,
struct airo_info *apriv ) {
struct proc_dir_entry *entry;
/* First setup the device directory */
strcpy(apriv->proc_name,dev->name);
apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
airo_entry);
if (!apriv->proc_entry)
goto fail;
apriv->proc_entry->uid = proc_uid;
apriv->proc_entry->gid = proc_gid;
/* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry)
goto fail_stats_delta;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev);
if (!entry)
goto fail_stats;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev);
if (!entry)
goto fail_status;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Config */
entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev);
if (!entry)
goto fail_config;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the SSID */
entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry)
goto fail_ssid;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the APList */
entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev);
if (!entry)
goto fail_aplist;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry)
goto fail_bsslist;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry)
goto fail_wepkey;
entry->uid = proc_uid;
entry->gid = proc_gid;
return 0;
fail_wepkey:
remove_proc_entry("BSSList", apriv->proc_entry);
fail_bsslist:
remove_proc_entry("APList", apriv->proc_entry);
fail_aplist:
remove_proc_entry("SSID", apriv->proc_entry);
fail_ssid:
remove_proc_entry("Config", apriv->proc_entry);
fail_config:
remove_proc_entry("Status", apriv->proc_entry);
fail_status:
remove_proc_entry("Stats", apriv->proc_entry);
fail_stats:
remove_proc_entry("StatsDelta", apriv->proc_entry);
fail_stats_delta:
remove_proc_entry(apriv->proc_name, airo_entry);
fail:
return -ENOMEM;
}
| static int setup_proc_entry( struct net_device *dev,
struct airo_info *apriv ) {
struct proc_dir_entry *entry;
/* First setup the device directory */
strcpy(apriv->proc_name,dev->name);
apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
airo_entry);
if (!apriv->proc_entry)
goto fail;
apriv->proc_entry->uid = proc_uid;
apriv->proc_entry->gid = proc_gid;
/* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry)
goto fail_stats_delta;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev);
if (!entry)
goto fail_stats;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev);
if (!entry)
goto fail_status;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the Config */
entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev);
if (!entry)
goto fail_config;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the SSID */
entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry)
goto fail_ssid;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the APList */
entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev);
if (!entry)
goto fail_aplist;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry)
goto fail_bsslist;
entry->uid = proc_uid;
entry->gid = proc_gid;
/* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry)
goto fail_wepkey;
entry->uid = proc_uid;
entry->gid = proc_gid;
return 0;
fail_wepkey:
remove_proc_entry("BSSList", apriv->proc_entry);
fail_bsslist:
remove_proc_entry("APList", apriv->proc_entry);
fail_aplist:
remove_proc_entry("SSID", apriv->proc_entry);
fail_ssid:
remove_proc_entry("Config", apriv->proc_entry);
fail_config:
remove_proc_entry("Status", apriv->proc_entry);
fail_status:
remove_proc_entry("Stats", apriv->proc_entry);
fail_stats:
remove_proc_entry("StatsDelta", apriv->proc_entry);
fail_stats_delta:
remove_proc_entry(apriv->proc_name, airo_entry);
fail:
return -ENOMEM;
}
| C | linux | 0 |