We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b58ea9 commit 2cff916Copy full SHA for 2cff916
vendor/cryptopp/allocate.cpp
@@ -39,6 +39,7 @@ void CallNewHandler()
39
40
void * AlignedAllocate(size_t size)
41
{
42
+ unsigned int cnt = 0;
43
byte *p;
44
#if defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
45
while ((p = (byte *)_mm_malloc(size, 16)) == NULLPTR)
@@ -51,8 +52,12 @@ void * AlignedAllocate(size_t size)
51
52
#else
53
while ((p = (byte *)malloc(size + 16)) == NULLPTR)
54
#endif
- CallNewHandler();
55
-
+ {
56
+ if (cnt >= 10)
57
+ throw std::bad_alloc();
58
+ CallNewHandler();
59
+ cnt++;
60
+ }
61
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
62
size_t adjustment = 16-((size_t)p%16);
63
CRYPTOPP_ASSERT(adjustment > 0);
0 commit comments