]> granicus.if.org Git - esp-idf/blob - components/esp32/test/test_stack_check.c
esp32: Adds Stack Smashing Protection Feature
[esp-idf] / components / esp32 / test / test_stack_check.c
1 #include "unity.h"
2
3 #if CONFIG_STACK_CHECK
4
5 static void recur_and_smash()
6 {
7     static int cnt;
8     volatile uint8_t buf[50];
9     volatile int num = sizeof(buf)+10;
10
11     if (cnt++ < 1) {
12         recur_and_smash();
13     }
14     for (int i = 0; i < num; i++) {
15         buf[i] = 0;
16     }
17 }
18
19
20 TEST_CASE("stack smashing protection", "[stack_check] [ignore]")
21 {
22     recur_and_smash();
23 }
24
25 #endif