From e5c104a8cd357bd6aa6d5a8336dbf931ffec6254 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sat, 1 Feb 2020 19:28:30 +0200 Subject: [PATCH] Avoid stack overflow in alltypes_proto3 testcase on AVR --- tests/alltypes_proto3/decode_alltypes.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/alltypes_proto3/decode_alltypes.c b/tests/alltypes_proto3/decode_alltypes.c index 114e78be..2e45b7d6 100644 --- a/tests/alltypes_proto3/decode_alltypes.c +++ b/tests/alltypes_proto3/decode_alltypes.c @@ -9,16 +9,13 @@ #include #include "alltypes.pb.h" #include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - printf("Test " #x " failed.\n"); \ - return false; \ - } +#include "unittests.h" /* This function is called once from main(), it handles the decoding and checks the fields. */ bool check_alltypes(pb_istream_t *stream, int mode) { + int status = 0; AllTypes alltypes = AllTypes_init_zero; /* Fill with garbage to better detect initialization errors */ @@ -139,7 +136,7 @@ bool check_alltypes(pb_istream_t *stream, int mode) TEST(alltypes.end == 1099); - return true; + return status == 0; } int main(int argc, char **argv)