mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Suppress false positve asan stack underflow error
+ hide public symbols if possible Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
c226d3e888
commit
606b59ecef
5 changed files with 29 additions and 10 deletions
|
|
@ -173,9 +173,13 @@ SET (ESCARGOT_LDFLAGS_SHAREDLIB -ldl)
|
|||
|
||||
|
||||
# STATIC_LIB FLAGS
|
||||
SET (ESCARGOT_CXXFLAGS_STATICLIB -fPIC)
|
||||
SET (ESCARGOT_CXXFLAGS_STATICLIB -fPIC -DESCARGOT_EXPORT=)
|
||||
SET (ESCARGOT_LDFLAGS_STATICLIB -Wl,--gc-sections)
|
||||
|
||||
# SHELL FLAGS
|
||||
SET (ESCARGOT_CXXFLAGS_SHELL -DESCARGOT_EXPORT=)
|
||||
SET (ESCARGOT_LDFLAGS_SHELL -Wl,--gc-sections)
|
||||
|
||||
|
||||
#######################################################
|
||||
# FLAGS FOR TEST
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_GCC) || defined(COMPILER_CLANG)
|
||||
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
|
||||
#else
|
||||
#define ATTRIBUTE_NO_SANITIZE_ADDRESS
|
||||
#endif
|
||||
|
||||
// #define OS(NAME) (defined OS_##NAME && OS_##NAME)
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
#ifndef __ESCARGOT_PUBLIC__
|
||||
#define __ESCARGOT_PUBLIC__
|
||||
|
||||
#ifndef ESCARGOT_EXPORT
|
||||
#if !defined(ESCARGOT_EXPORT)
|
||||
#if defined(_MSC_VER)
|
||||
#define ESCARGOT_EXPORT __declspec(dllESCARGOT_EXPORT)
|
||||
#define ESCARGOT_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define ESCARGOT_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -174,6 +174,19 @@ void CompressibleString::decompress()
|
|||
constexpr static const size_t g_compressChunkSize = 1044465;
|
||||
static_assert(LZ4_COMPRESSBOUND(g_compressChunkSize) == 1024 * 1024, "");
|
||||
|
||||
static ATTRIBUTE_NO_SANITIZE_ADDRESS bool testPointerExistsOnStack(size_t* start, size_t* end, const void* ptr)
|
||||
{
|
||||
while (start != end) {
|
||||
if (UNLIKELY(*start == (size_t)ptr)) {
|
||||
// if there is reference on stack, we cannot compress string.
|
||||
return true;
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename StringType>
|
||||
bool CompressibleString::compressWorker(void* callerSP)
|
||||
{
|
||||
|
|
@ -188,12 +201,8 @@ bool CompressibleString::compressWorker(void* callerSP)
|
|||
size_t* end = (size_t*)((size_t)callerSP & ~(sizeof(size_t) - 1));
|
||||
#endif
|
||||
|
||||
while (start != end) {
|
||||
if (UNLIKELY(*start == (size_t)m_bufferData.buffer)) {
|
||||
// if there is reference on stack, we cannot compress string.
|
||||
return false;
|
||||
}
|
||||
start++;
|
||||
if (testPointerExistsOnStack(start, end, m_bufferData.buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t originByteLength = m_bufferData.length * sizeof(StringType);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 95766bf5a8157ce6b434303ecdbac11e76deb96c
|
||||
Subproject commit aad8e2f2279ca4583a05cd46c5a1b1efcadb0837
|
||||
Loading…
Add table
Add a link
Reference in a new issue