Skip to content
Merged

Ci #310

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/lua-openssl.supp
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,107 @@
fun:_dl_catch_error
fun:_dlerror_run
}

{
asn1.c ASN1_TYPE_set1 in openssl_asn1type_new
Memcheck:Leak
match-leak-kinds: indirect
fun:malloc
fun:ASN1_STRING_set
fun:ASN1_STRING_copy
fun:ASN1_STRING_dup
fun:ASN1_TYPE_set1
obj:*
}

{
asn1.c ASN1_TYPE_set1 in openssl_asn1type_new
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:CRYPTO_zalloc
fun:ASN1_STRING_type_new
fun:ASN1_STRING_dup
fun:ASN1_TYPE_set1
obj:*
}

{
dlopen_doit
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
fun:_dl_new_object
fun:_dl_map_object_from_fd
fun:_dl_map_object
fun:openaux
fun:_dl_catch_exception
fun:_dl_map_object_deps
fun:dl_open_worker
fun:_dl_catch_exception
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_exception
}

{
dlopen_doit
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
fun:_dl_new_object
fun:_dl_map_object_from_fd
fun:_dl_map_object
fun:openaux
fun:_dl_catch_exception
fun:_dl_map_object_deps
fun:dl_open_worker
fun:_dl_catch_exception
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_exception
}

{
ASN1_item_d2i
Memcheck:Leak
match-leak-kinds: indirect
fun:malloc
fun:CRYPTO_zalloc
obj:/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
fun:BN_bin2bn
}

{
BIO_new_bio_pair
Memcheck:Leak
match-leak-kinds: indirect
fun:malloc
fun:CRYPTO_zalloc
obj:/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
fun:BIO_new
fun:BIO_new_bio_pair
obj:*
}

{
BIO_new_bio_pair
Memcheck:Leak
match-leak-kinds: indirect
fun:malloc
obj:/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
fun:BIO_ctrl
fun:BIO_new_bio_pair
obj:*
}

{
BIO_new_bio_pair
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:CRYPTO_zalloc
fun:BIO_new
fun:BIO_new_bio_pair
obj:*
}
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
option(BUILD_SHARED_LUA_OPENSSL "Shared or Static lua-openssl" ON)
option(BUILD_LINK_LUA_LIBRARIES "Link Lua libraries during build-time" OFF)
if(WIN32)
set(BUILD_LINK_LUA_LIBRARIES ON)
endif()

include(GNUInstallDirs)

Expand Down Expand Up @@ -87,14 +91,15 @@ target_link_libraries(lua-openssl PUBLIC
Threads::Threads
)

if(WIN32)
target_link_libraries(lua-openssl PUBLIC
${LUA_LIBRARIES}
)
endif()

if(APPLE)
target_link_options(lua-openssl PUBLIC -bundle -undefined dynamic_lookup)
if(BUILD_LINK_LUA_LIBRARIES)
target_link_libraries(lua-openssl PUBLIC ${LUA_LIBRARIES})
if(UNIX)
target_link_options(lua-openssl PUBLIC -Wl,--no-undefined)
endif()
else()
if(APPLE)
target_link_options(lua-openssl PUBLIC -bundle -undefined dynamic_lookup)
endif()
endif()

target_compile_options(lua-openssl PRIVATE -DLUA_LIB)
Expand Down
15 changes: 3 additions & 12 deletions src/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,9 @@ static int openssl_get_object(lua_State*L)
int class = 0;
int ret;

if (start > l)
{
lua_pushnil(L);
openssl_pushargerror(L, 2, "out of range");
return 2;
}
if (start>stop)
{
lua_pushnil(L);
openssl_pushargerror(L, 3, "before of start");
return 2;
}
luaL_argcheck(L, start > 0 && start < l, 2, "start out of length of asn1 string");
luaL_argcheck(L, stop > start, 3, "stop must be greater than start");
luaL_argcheck(L, stop <= l, 3, "stop out of length of asn1 string");

p = (const unsigned char *)asn1s + start - 1;
ret = ASN1_get_object(&p, &len, &tag, &class, stop - start + 1);
Expand Down
Loading