Skip to content

Commit f2610e7

Browse files
committed
fix: lower ujson4c's stack requirements on x86 (#134)
- as it triggers a stack overflow while connection testing from ODBC Administrator. (The stack pressure might also be increased by the usage of the managed-unmanaged code bridge for the GUI: the driver code path that triggers the stack overflow works fine when invoked without it.) (cherry picked from commit 6776848)
1 parent 1b41af1 commit f2610e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ if (${WIN32})
102102
# 2MB stack size
103103
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:2097152")
104104
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /F 2097152")
105+
if ("${BARCH}" EQUAL "32")
106+
# Force UJSON4C's Unicode decoder scratchpad onto the heap. Its large
107+
# default size (128K) leads to stack overflow with some (older) apps.
108+
set(CMAKE_C_FLAGS
109+
# defined to one wchar_t/Win/UTF-16
110+
"${CMAKE_C_FLAGS} /DJSON_MAX_STACK_BUFFER_SIZE=2")
111+
endif ("${BARCH}" EQUAL "32")
105112

106113
if (${IS_UNICODE})
107114
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DUNICODE /D_UNICODE")

0 commit comments

Comments
 (0)