Age | Commit message (Collapse) | Author |
|
Previously nanopb didn't enforce that decoded bool fields
had valid true/false values. This could lead to undefined
behavior in user code.
This has potential security implications when
1) message contains bool field (has_ fields are safe)
and
2) user code uses ternary operator dependent on the field value,
such as: int value = msg.my_bool ? 1234 : 0
and
3) the value returned from ternary operator affects a memory access,
such as: data_array[value] = 9999
|
|
|
|
|
|
This could happen with zero-length submessages and strings.
While technically valid, it is an useless call and a rare
corner case that can easily lead to bugs in the callback
implementation.
|
|
Previously the example code would falsely detect EOF condition if
called with count = 0.
|
|
|
|
Don't encode scalar arrays as packed. This is only to be used when
the decoder on the receiving side cannot process packed scalar arrays.
Such example is older protobuf.js.
|
|
|
|
Unsorted enums in message specifications do not result in correct
min/max values per the protobuf spec for cpp code:
https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#enum
The google cpp compiler uses the min/max _value_ instead of the position
of the enum entry in the message spec, so this patch updates nanopb to
do the same.
Example input:
```protobuf
syntax = "proto3";
enum Language {
UNKNOWN = 0;
ENGLISH_EN_GB = 12;
ENGLISH_EN_US = 1;
FRENCH_FR_FR = 2;
ITALIAN_IT_IT = 3;
GERMAN_DE_DE = 4;
SPANISH_ES_AR = 13;
SPANISH_ES_ES = 5;
SPANISH_ES_MX = 14;
SWEDISH_SV_SE = 6;
DUTCH_NL_NL = 7;
KOREAN_KO_KR = 8;
JAPANESE_JA_JP = 9;
CHINESE_SIMPLIFIED_ZH_CN = 10;
CHINESE_TRADITIONAL_ZH_TW = 11;
}
```
This would previously result in:
```c
#define _Language_MIN Language_UNKNOWN
#define _Language_MAX Language_CHINESE_TRADITIONAL_ZH_TW
#define _Language_ARRAYSIZE ((Language)(Language_CHINESE_TRADITIONAL_ZH_TW+1))
```
After this patch,
```c
#define _Language_MIN Language_UNKNOWN
#define _Language_MAX Language_SPANISH_ES_MX
#define _Language_ARRAYSIZE ((Language)(Language_SPANISH_ES_MX+1))
```
Add a test `enum_minmax` to cover this case.
|
|
am: 07c127e075
Change-Id: I248ee8847450b3145c0ac9b06237d89f61a90a2d
|
|
am: b97cbd30e1
Change-Id: I0404d46f7f784ecd131080a4c1e755ccadc285e7
|
|
am: d8d508fb38
Change-Id: Ic059ea63104522e35704990577930b11dc16e02f
|
|
Test: compile
Change-Id: I9d5cb0b1d63cd38717f4a8e15785058da84262a4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
am: 1d0ca59852
Change-Id: I412488a20b4fcfa05f58528c2e38fff5a7e3a0c0
|
|
am: aaae7fff6e
Change-Id: I7e9b49665176548ce0c7d5e5c9f3c62ec37d5650
|
|
am: 3f5b6d4262
Change-Id: I2f79eba12ecf6e8d7ab7ed2d102bbe745c0b6c0c
|
|
Add 32BIT and 16BIT compile time flag for nanopb library to support
16BIT or 32BIT size, default is 8BIT. User need to use the corresponding
library when define the PB_FIELD_* flag during compilation.
Test: None
Bug: 122292884
Change-Id: I1b3c572e54297d020776e7721d37b65526f1a0ff
|
|
am: e80a74a431
Change-Id: I120cf2f5451910c68e9ebfad9d86358c02b32098
|
|
am: eeedc9b64b
Change-Id: I3355d9aa570683a1488f528752342ce4527c6190
|
|
am: 4090366181
Change-Id: Ic5a149eb6e898140647c92aa446f5614cfbcb7d0
|
|
Bug: 123068679
Change-Id: I7b75d9d7c8a8980bcceafc44580fb70ce4d31938
|
|
|
|
|
|
am: be7f0300db
Change-Id: Icb79d01247504977e99800b9d0ad8635d2d292d8
|
|
am: 7ef083d766
Change-Id: Ice842086225ed70303eb9432489888ff20a23412
|
|
am: b5cea29f5e
Change-Id: I7ebbe28c941c8e8c91f147bc7a0981d98c946a56
|
|
Bug: 33166666
Test: gerrit uploader
Change-Id: I0d65423c625fd4085a88fe0fdbeaa27cb7909c43
|
|
A bit of a mess, should have done the 0.3.9.2 release from this branch instead.
Oh well, doesn't change anything.
|
|
|
|
|
|
|
|
Clarify the usage of callback fields inside oneof sections in the docs
|
|
|
|
MERGE am: c8cd40fafa -s ours am: 1457d4dfb9 -s ours
am: 90df857c8f -s ours
Change-Id: Iad213fa375bd4b5733d73cdabfe63aac1aade16d
|
|
MERGE am: c8cd40fafa -s ours
am: 1457d4dfb9 -s ours
Change-Id: I9a3c40d09131859174d46e53a127a89e9eb9917d
|
|
am: c8cd40fafa -s ours
Change-Id: I47ea8b0732f1eda7547e58081b1fd0454c86e378
|
|
Change-Id: Iaa0bee4c8ee4dace87ef0ad2aee6d8537ffd101c
|
|
MERGE am: ba5d139354 -s ours
am: 3ce1eb5d7a -s ours
Change-Id: I5c812a72d24c30207f2d8f4f1c04c7ddac200104
|
|
MERGE
am: ba5d139354 -s ours
Change-Id: I84269a992148b8c4beec3aee31073eb7e62dc974
|
|
cmake: Include CMAKE_INSTALL_LIBDIR in CMAKE_INSTALL_CMAKEDIR
|
|
cmake: Allow to build a shared library
|
|
Change-Id: Id358b7b183cdb993644b08f1587085f1fc672bc7
|
|
If user defines non-standard directory in CMAKE_INSTALL_LIBDIR
option (i.e. /usr/lib64), then CMAKE_INSTALL_CMAKEDIR should
use it as a prefix.
|
|
Introduce options BUILD_SHARED_LIBS and BUILD_STATIC_LIBS to allow
building both types of libraries. By default only BUILD_STATIC_LIBS
is enabled.
|