Stan Hu
9836087dd1
Fix LUA out-of-range checks to handle integer overflow
...
As discussed in https://github.com/protocolbuffers/upb/issues/439 , the
LUA binding tests were failing on some compilers (e.g. s390x) since
conversion of out-of-range integers values (e.g. 2^64 or
18446744073709551616) to a double can lead to undefined behavior. On
some compilers, this conversion can return 0, but it can also return the
max value.
To make this check work across platforms, we do the following:
1. Break the double into its integral and fractional components.
2. If there any fractional components, return an error.
3. Compare the min and max values in an intelligent way. We can't simply
compare against UINT64_MAX since that value will get implicitly
converted to a double in an undefined way, and 18446744073709551616 >
UINT64_MAX can return false. Instead, we can use the largest power of
two and use ldexp to generate the max value.
Closes https://github.com/protocolbuffers/upb/issues/439
3 years ago
Stan Hu
ba83e135d2
Refactor decode_munge to call decode_munge_int32
...
This avoids an additional type check when decoding packed enums.
3 years ago
Stan Hu
ad4d4076e1
Fix big endian decoding of enum_packed
3 years ago
Stan Hu
c604ed9ae9
Fix big endian handling of enums
...
Previously using an enum for a field on big-endian process such as the
s390x would fail to decode properly. We need to munge it in the correct
byte order before decoding it.
3 years ago
Joshua Haberman
c59d8f8eb7
Addressed PR comments and fixed the broken test.
3 years ago
Joshua Haberman
d0795a29d9
Test for def_to_proto is working.
3 years ago
Joshua Haberman
0be33b1e3c
WIP.
3 years ago
Joshua Haberman
1c941dbf16
Added a clarifying comment.
3 years ago
Joshua Haberman
50b360f974
Addressed PR comments.
3 years ago
Joshua Haberman
cfda119c52
Updated the doc comments.
3 years ago
Joshua Haberman
880ca37531
Functionality is complete and it is passing all tests.
3 years ago
Joshua Haberman
5817886392
Simplified the field path representation.
3 years ago
Joshua Haberman
0834ee254b
Baseline code.
3 years ago
Joshua Haberman
2199be91bc
Fixed UBSAN error.
3 years ago
Joshua Haberman
58968d6a78
A bit of minor code tweaking that improves benchmarks by 10%.
3 years ago
Joshua Haberman
58c1dbc11f
Addressed PR comments.
3 years ago
Joshua Haberman
1618e1b9a6
Fixed case of parsing an unknown field.
3 years ago
Joshua Haberman
779c30949b
Finished up the test.
3 years ago
Joshua Haberman
f7980b7ed1
Restructured for simplicity and fixed fasttable parser.
3 years ago
Joshua Haberman
dfa28861cc
Don't store field_start, derive it separately.
3 years ago
Joshua Haberman
7c83eb93be
Removed extra size from message.
3 years ago
Joshua Haberman
3d437bbcab
Some pre-PR fixes.
3 years ago
Joshua Haberman
a763267219
Addressed PR comments.
3 years ago
Joshua Haberman
4abe724dde
A few more fixes.
3 years ago
Joshua Haberman
4307f5dbba
Fixed the CMake build and amalgamation.
3 years ago
Joshua Haberman
7771a0515b
Addressed PR comments.
3 years ago
Joshua Haberman
16f763e4d6
Addressed PR comments.
3 years ago
Joshua Haberman
9d26c706e0
Removed dependency on popcount() intrinsic.
3 years ago
Joshua Haberman
7907ed913b
Expanded the test to cover packed fields also.
3 years ago
Joshua Haberman
c755099a89
WIP.
3 years ago
Joshua Haberman
401e1747b5
Addressed PR feedback.
3 years ago
Joshua Haberman
cd4981133f
WIP.
3 years ago
Joshua Haberman
cc03669a17
Several changes to defs.
...
Biggest/key changes:
1. Defs are now nested per the .proto file syntax.
2. Options are parsed and vended.
3 years ago
Joshua Haberman
2484d12c1c
Addressed PR comments.
3 years ago
Joshua Haberman
8c916941b0
MSET -> MSGSET
3 years ago
Joshua Haberman
b3c91c276b
Addressed PR comments.
3 years ago
Joshua Haberman
d80e682a9c
Moved find field function closer to where it is used.
3 years ago
Joshua Haberman
53ce4354cf
Minor formatting changes.
3 years ago
Joshua Haberman
37a577c0e7
Further factored the function.
3 years ago
Joshua Haberman
69bb5d1d94
Simplified main parsing function.
3 years ago
Joshua Haberman
6f89034249
Implemented support for MessageSet.
3 years ago
Joshua Haberman
29be74c5d2
Addressed PR comments.
3 years ago
Joshua Haberman
b1bbbdd4e7
Addressed PR comments.
3 years ago
Joshua Haberman
b23ec9a59c
Fixed fasttable parser.
3 years ago
Joshua Haberman
ce012b7b55
Added support for extensions.
3 years ago
Joshua Haberman
3366d02f04
Addressed PR comments.
3 years ago
Joshua Haberman
5c28ab6b2c
Implemented upb_enumvaldef, for storing information about enumvals.
3 years ago
Joshua Haberman
53fba823de
Added missing upb_symtab_lookupext() function.
3 years ago
Joshua Haberman
a669587817
Fixed the edge case where rounding up causes overflow.
3 years ago
Joshua Haberman
e83aeba595
Align arena initial block to ensure allocations are aligned.
3 years ago