Skip to content
Permalink
Browse files

Fix stack size detection on Linux (fix #1427)

  • Loading branch information
gfwilliams committed May 21, 2018
1 parent 9462906 commit a0d7f432abee692402c00e8b615ff5982dde9780
Showing with 4 additions and 1 deletion.
  1. +1 −0 ChangeLog
  2. +3 −1 src/jsutils.c
@@ -1,6 +1,7 @@
Increase jslMatch error buffer size to handle "UNFINISHED TEMPLATE LITERAL" string (#1426)
nRF5x: Make FlashWrite cope with flash writes > 4k
Increase max size of native strings on platforms that support it - 16 bit to 32 bit (#1432)
Fix stack size detection on Linux (fix #1427)

1v98 : Allow Crypto SHA1 without SHA256/512 (for ESP8266 where flash is scarce)
Add better docs for the form of Wifi callback functions
@@ -844,7 +844,9 @@ size_t jsuGetFreeStack() {
char ptr; // this is on the stack
extern void *STACK_BASE;
uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);
return 1000000 - count; // give it 1 megabyte of stack
const uint32_t max_stack = 1000000; // give it 1 megabyte of stack
if (count>max_stack) return 0;
return max_stack - count;
#else
// stack depth seems pretty platform-specific :( Default to a value that disables it
return 1000000; // no stack depth check on this platform

0 comments on commit a0d7f43

Please sign in to comment.
You can’t perform that action at this time.