From 6d85b62e6d3ecee8285bf20313b088562a9404bd Mon Sep 17 00:00:00 2001 From: weideli Date: Tue, 18 Aug 2020 22:02:04 +0800 Subject: [PATCH] fixed code check bugs --- .../OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp | 2 +- .../shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h | 2 +- src/anbox/android/ip_config_builder.h | 1 + src/anbox/graphics/emugl/ColorBuffer.cpp | 3 +++ src/anbox/graphics/emugl/Renderer.cpp | 6 ++++++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp index 3c48f455..1a0bd7e1 100644 --- a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp +++ b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp @@ -98,7 +98,7 @@ bool ChecksumCalculatorThreadInfo::writeChecksum(const void* buf, bool ChecksumCalculatorThreadInfo::validate(const void* buf, size_t bufLen, - void* checksum, + const void* checksum, size_t checksumLen) { bool ret = false; if(getChecksumCalculatorThreadInfo() != nullptr) { diff --git a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h index d68a43d0..62afe9c5 100644 --- a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h +++ b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h @@ -43,7 +43,7 @@ public: static bool validate(const void* buf, size_t bufLen, - void* checksum, + const void* checksum, size_t checksumLen); static void validOrDie(const void* buf, size_t bufLen, diff --git a/src/anbox/android/ip_config_builder.h b/src/anbox/android/ip_config_builder.h index 812da7ca..c35d6402 100644 --- a/src/anbox/android/ip_config_builder.h +++ b/src/anbox/android/ip_config_builder.h @@ -39,6 +39,7 @@ class IpConfigBuilder { }; IpConfigBuilder() = default; + ~IpConfigBuilder(){} std::size_t write(common::BinaryWriter &writer); diff --git a/src/anbox/graphics/emugl/ColorBuffer.cpp b/src/anbox/graphics/emugl/ColorBuffer.cpp index 75c021d9..862d3bfe 100644 --- a/src/anbox/graphics/emugl/ColorBuffer.cpp +++ b/src/anbox/graphics/emugl/ColorBuffer.cpp @@ -295,6 +295,9 @@ bool ColorBuffer::blitFromCurrentReadBuffer() { s_gles2.glViewport(0, 0, m_width, m_height); // render m_blitTex + if (!m_helper->getTextureDraw()) { + return false; + } m_helper->getTextureDraw()->draw(m_blitTex); // Restore previous viewport. diff --git a/src/anbox/graphics/emugl/Renderer.cpp b/src/anbox/graphics/emugl/Renderer.cpp index e59101a4..ca6f02c2 100644 --- a/src/anbox/graphics/emugl/Renderer.cpp +++ b/src/anbox/graphics/emugl/Renderer.cpp @@ -431,6 +431,9 @@ HandleType Renderer::createRenderContext(int p_config, HandleType p_share, ret = genHandle(); m_contexts[ret] = rctx; RenderThreadInfo *tinfo = RenderThreadInfo::get(); + if (!tinfo) { + return -1; + } int tid = tinfo->m_tid; // The new emulator manages render contexts per guest process. // Fall back to per-thread management if the system image does not @@ -511,6 +514,9 @@ void Renderer::DestroyRenderContext(HandleType p_context) { m_contexts.erase(p_context); RenderThreadInfo *tinfo = RenderThreadInfo::get(); + if (!tinfo) { + return; + } int tid = tinfo->m_tid; // The new emulator manages render contexts per guest process. // Fall back to per-thread management if the system image does not -- GitLab