diff options
author | Petr Prokhorenkov <prokhorenkov@gmail.com> | 2016-04-14 11:17:54 +0300 |
---|---|---|
committer | Petr Prokhorenkov <prokhorenkov@gmail.com> | 2016-04-21 09:27:33 +0300 |
commit | f4f9aec52f5b4c46ff32fb9527229da081a14e11 (patch) | |
tree | 02d8ff141ad7e0228bfcf6b2f5ee1322c5df5fbd /src/google/protobuf/unittest_lite.proto | |
parent | 814685ca2cd9280ca401e1842fd6311440921a0a (diff) |
Fix bug with silent message corruption in LITE_RUNTIME.
A protobuf message will be corrupted in the following scenario:
1. Use LITE_RUNTIME.
2. Have an optional enum field following some other field.
3. Update protocol by adding new values to the enum.
4. Have an old client parse and serialize a message having enum field
set to a value the client does not understand.
5. Field preceeding the enum is now corrupted.
The bug is due to the fact that optimized fallthrough in parser code
does not update variablle 'tag' when jumping to the parser code for the
next field.
Diffstat (limited to 'src/google/protobuf/unittest_lite.proto')
-rw-r--r-- | src/google/protobuf/unittest_lite.proto | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/google/protobuf/unittest_lite.proto b/src/google/protobuf/unittest_lite.proto index 41ed845f..878ec7c1 100644 --- a/src/google/protobuf/unittest_lite.proto +++ b/src/google/protobuf/unittest_lite.proto @@ -386,3 +386,22 @@ message TestEmptyMessageLite{ message TestEmptyMessageWithExtensionsLite { extensions 1 to max; } + +enum V1EnumLite { + V1_FIRST = 1; +} + +enum V2EnumLite { + V2_FIRST = 1; + V2_SECOND = 2; +} + +message V1MessageLite { + required int32 int_field = 1; + optional V1EnumLite enum_field = 2 [ default = V1_FIRST ]; +} + +message V2MessageLite { + required int32 int_field = 1; + optional V2EnumLite enum_field = 2 [ default = V2_FIRST ]; +} |