mirror of
https://github.com/google/pebble
synced 2026-10-18 01:04:12 +02:00
Import of the watch repository from Pebble
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# Check that pb_release() correctly handles corrupted size fields of
|
||||
# static arrays.
|
||||
|
||||
Import('env', 'malloc_env')
|
||||
|
||||
env.NanopbProto('size_corruption')
|
||||
|
||||
p = malloc_env.Program(["size_corruption.c",
|
||||
"size_corruption.pb.c",
|
||||
"$COMMON/pb_decode_with_malloc.o",
|
||||
"$COMMON/pb_common_with_malloc.o",
|
||||
"$COMMON/malloc_wrappers.o"])
|
||||
env.RunTest(p)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "size_corruption.pb.h"
|
||||
#include <pb_decode.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
MainMessage msg = MainMessage_init_zero;
|
||||
msg.bar_count = (pb_size_t)-1;
|
||||
pb_release(MainMessage_fields, &msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
syntax = "proto2";
|
||||
import 'nanopb.proto';
|
||||
|
||||
message SubMessage {
|
||||
repeated int32 foo = 1 [(nanopb).type = FT_POINTER];
|
||||
}
|
||||
|
||||
message MainMessage {
|
||||
repeated SubMessage bar = 1 [(nanopb).max_count = 5];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user