From f39b16638d597354f7e9cdf0d1f2954da9a342c4 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 16 Jun 2024 13:14:23 +0200 Subject: [PATCH 1/6] Fix alloc/dealloc mismatch or prevent false-positive ASan error --- source/io/HostResolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/io/HostResolver.cpp b/source/io/HostResolver.cpp index 06d4d5722..b4d9ffaf3 100644 --- a/source/io/HostResolver.cpp +++ b/source/io/HostResolver.cpp @@ -79,6 +79,7 @@ namespace Aws size_t len = hostAddresses ? aws_array_list_length(hostAddresses) : 0; Vector addresses; + addresses.reserve(len); for (size_t i = 0; i < len; ++i) { From 50f3e0d39a64276f9df6691756ec0a6bfe773b30 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 16 Jun 2024 17:11:48 +0200 Subject: [PATCH 2/6] Fix alloc/free mismatch --- include/aws/crt/StlAllocator.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/aws/crt/StlAllocator.h b/include/aws/crt/StlAllocator.h index 13ec6ff68..60686c0e2 100644 --- a/include/aws/crt/StlAllocator.h +++ b/include/aws/crt/StlAllocator.h @@ -51,6 +51,13 @@ namespace Aws return static_cast(aws_mem_acquire(m_allocator, n * sizeof(T))); } +#if _LIBCPP_STD_VER > 20 + std::allocation_result allocate_at_least(size_type n) + { + return {allocate(n), n}; + } +#endif + void deallocate(RawPointer p, size_type) { AWS_ASSERT(m_allocator); From 4e589dc8743f9706fe6f4b265f040c34017aa692 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 24 Jun 2024 09:23:00 -0700 Subject: [PATCH 3/6] lint fix --- include/aws/crt/StlAllocator.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/aws/crt/StlAllocator.h b/include/aws/crt/StlAllocator.h index 60686c0e2..0c45d0d53 100644 --- a/include/aws/crt/StlAllocator.h +++ b/include/aws/crt/StlAllocator.h @@ -52,10 +52,7 @@ namespace Aws } #if _LIBCPP_STD_VER > 20 - std::allocation_result allocate_at_least(size_type n) - { - return {allocate(n), n}; - } + std::allocation_result allocate_at_least(size_type n) { return {allocate(n), n}; } #endif void deallocate(RawPointer p, size_type) From 8f981916bb4a053babda12d3c1926ad8faec8b07 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 24 Jun 2024 09:26:02 -0700 Subject: [PATCH 4/6] latest submodules --- crt/aws-c-common | 2 +- crt/aws-lc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index 4f874cea5..6d974f92c 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 4f874cea50a70bc6ebcd85c6ce1c6c0016b5aff4 +Subproject commit 6d974f92c1d86391c1dcb1173239adf757c52b2d diff --git a/crt/aws-lc b/crt/aws-lc index 4e54dd836..4368aaa69 160000 --- a/crt/aws-lc +++ b/crt/aws-lc @@ -1 +1 @@ -Subproject commit 4e54dd8363396f257d7a2317c48101e18170e6fb +Subproject commit 4368aaa6975ba41bd76d3bb12fac54c4680247fb From 0948921c132f909709b7b858329213d5aaed95a8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 25 Jun 2024 11:44:43 -0700 Subject: [PATCH 5/6] remove ifdef --- include/aws/crt/StlAllocator.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/aws/crt/StlAllocator.h b/include/aws/crt/StlAllocator.h index 0c45d0d53..889994daf 100644 --- a/include/aws/crt/StlAllocator.h +++ b/include/aws/crt/StlAllocator.h @@ -51,9 +51,7 @@ namespace Aws return static_cast(aws_mem_acquire(m_allocator, n * sizeof(T))); } -#if _LIBCPP_STD_VER > 20 std::allocation_result allocate_at_least(size_type n) { return {allocate(n), n}; } -#endif void deallocate(RawPointer p, size_type) { From 1c8ab9b57db3ac2ae9b5f4abc9f06d70c6b9b028 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 25 Jun 2024 11:59:51 -0700 Subject: [PATCH 6/6] Revert "remove ifdef" This reverts commit 0948921c132f909709b7b858329213d5aaed95a8. --- include/aws/crt/StlAllocator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/aws/crt/StlAllocator.h b/include/aws/crt/StlAllocator.h index 889994daf..0c45d0d53 100644 --- a/include/aws/crt/StlAllocator.h +++ b/include/aws/crt/StlAllocator.h @@ -51,7 +51,9 @@ namespace Aws return static_cast(aws_mem_acquire(m_allocator, n * sizeof(T))); } +#if _LIBCPP_STD_VER > 20 std::allocation_result allocate_at_least(size_type n) { return {allocate(n), n}; } +#endif void deallocate(RawPointer p, size_type) {