mirror of
https://github.com/google/pebble.git
synced 2025-09-02 10:25:45 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
12
third_party/nanopb/tests/regression/issue_647/SConscript
vendored
Normal file
12
third_party/nanopb/tests/regression/issue_647/SConscript
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Regression test for #647:
|
||||
# Ill-formed oneof message leads to calling free on an arbitrary pointer
|
||||
|
||||
Import("env")
|
||||
|
||||
env.NanopbProto("repro.proto")
|
||||
|
||||
test = env.Program(["repro.c", "repro.pb.c",
|
||||
"$COMMON/pb_decode_with_malloc.o",
|
||||
"$COMMON/pb_common_with_malloc.o",
|
||||
"$COMMON/malloc_wrappers.o"])
|
||||
env.RunTest(test)
|
16
third_party/nanopb/tests/regression/issue_647/repro.c
vendored
Normal file
16
third_party/nanopb/tests/regression/issue_647/repro.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <pb_decode.h>
|
||||
#include <unittests.h>
|
||||
#include <malloc_wrappers.h>
|
||||
#include "repro.pb.h"
|
||||
|
||||
int main() {
|
||||
const uint8_t data[] = {0x08, 0x08, 0x2d};
|
||||
int status = 0;
|
||||
Repro repro = Repro_init_zero;
|
||||
|
||||
pb_istream_t stream = pb_istream_from_buffer(data, sizeof(data));
|
||||
TEST(!pb_decode(&stream, Repro_fields, &repro));
|
||||
TEST(get_alloc_count() == 0);
|
||||
|
||||
return status;
|
||||
}
|
10
third_party/nanopb/tests/regression/issue_647/repro.proto
vendored
Normal file
10
third_party/nanopb/tests/regression/issue_647/repro.proto
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "nanopb.proto";
|
||||
|
||||
message Repro {
|
||||
oneof value_type {
|
||||
bool boolean_value = 1;
|
||||
bytes bytes_value = 5 [(nanopb).type = FT_POINTER];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue