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