Skip to content

Commit f05776e

Browse files
committed
fix recursion limit when threads are disabled, hopefully fix win32 stuff too
1 parent fa8ffb7 commit f05776e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/asar/asar.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ class recurseblock {
6767
recurseblock()
6868
{
6969
recursioncount++;
70-
if(check_stack_left() < 32768 || recursioncount > 10000)
70+
#if !defined(_WIN32) && defined(NO_USE_THREADS)
71+
if(recursioncount > 500)
72+
#else
73+
if(check_stack_left() < 32768 || recursioncount > 5000)
74+
#endif
7175
asar_throw_error(pass, error_type_fatal, error_id_recursion_limit);
7276
}
7377
~recurseblock()

src/asar/platform/windows/thread-helpers-win32.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#if defined(_WIN32)
44

55
#include <windows.h>
6+
#include <processthreadsapi.h>
67

78
struct function_pointer_wrapper /*have this struct at global level*/
89
{
@@ -84,7 +85,7 @@ bool run_as_thread(functor&& callback) {
8485
}
8586

8687
size_t check_stack_left() {
87-
void *stack_low, *stack_high;
88+
size_t stack_low, stack_high;
8889
GetCurrentThreadStackLimits(&stack_low, &stack_high);
8990
size_t stack_left = (char*)&stack_low - (char*)stack_low;
9091
return stack_left;

0 commit comments

Comments
 (0)