Skip to content

Commit

Permalink
Fix stack size detection on Linux (fix #1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed May 21, 2018
1 parent 9462906 commit a0d7f43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/jsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a0d7f43

Please sign in to comment.