esp32: Adds Stack Smashing Protection Feature

These changes add posibility to enable GCC stack protector via menuconfig
for all source files in project.
This commit is contained in:
Alexey Gerenkov
2017-11-15 11:09:54 +03:00
parent b83792f504
commit 692a890232
8 changed files with 147 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#include "unity.h"
#if CONFIG_STACK_CHECK
static void recur_and_smash_cxx()
{
static int cnt;
volatile uint8_t buf[50];
volatile int num = sizeof(buf)+10;
if (cnt++ < 1) {
recur_and_smash_cxx();
}
for (int i = 0; i < num; i++) {
buf[i] = 0;
}
}
TEST_CASE("stack smashing protection CXX", "[stack_check] [ignore]")
{
recur_and_smash_cxx();
}
#endif