aboutsummaryrefslogtreecommitdiff
path: root/tests/regression/issue_547/SConscript
blob: c0a19fafc569934821689020911a7073a0bb2573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Regression test for issue #547:
# Buffer overflow when encoding bytes with size set to 65535

Import("env")

env.NanopbProto("test.proto")

# Define the compilation options
opts = env.Clone()
opts.Append(CPPDEFINES = {'PB_FIELD_32BIT': 1})

# Build new version of core
strict = opts.Clone()
strict.Append(CFLAGS = strict['CORECFLAGS'])
strict.Object("pb_encode_fields32.o", "$NANOPB/pb_encode.c")
strict.Object("pb_common_fields32.o", "$NANOPB/pb_common.c")

# Build and run test
test = opts.Program(["test.c", "test.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"])

env.RunTest(test)