test_stack_check.c 399 B

12345678910111213141516171819202122232425
  1. #include "unity.h"
  2. #if CONFIG_COMPILER_STACK_CHECK
  3. static void recur_and_smash(void)
  4. {
  5. static int cnt;
  6. volatile uint8_t buf[50];
  7. volatile int num = sizeof(buf)+10;
  8. if (cnt++ < 1) {
  9. recur_and_smash();
  10. }
  11. for (int i = 0; i < num; i++) {
  12. buf[i] = 0;
  13. }
  14. }
  15. TEST_CASE("stack smashing protection", "[stack_check] [ignore]")
  16. {
  17. recur_and_smash();
  18. }
  19. #endif