• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Regression test for issue #547:
2# Buffer overflow when encoding bytes with size set to 65535
3
4Import("env")
5
6env.NanopbProto("test.proto")
7
8# Define the compilation options
9opts = env.Clone()
10opts.Append(CPPDEFINES = {'PB_FIELD_32BIT': 1})
11
12# Build new version of core
13strict = opts.Clone()
14strict.Append(CFLAGS = strict['CORECFLAGS'])
15strict.Object("pb_encode_fields32.o", "$NANOPB/pb_encode.c")
16strict.Object("pb_common_fields32.o", "$NANOPB/pb_common.c")
17
18# Build and run test
19test = opts.Program(["test.c", "test.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"])
20
21env.RunTest(test)
22