Multiple calls of e.g. CreateString inside a call to a CreateTable
could cause those strings to end up in different locations in the
wire format, since order or argument evaluation is undefined.
This is allowed by the FlatBuffer format, but it is not helpful,
especially when debugging the contents of binaries, or comparing
against a "golden" binary for tests etc.
Now making sure that all the CreateTableDirect calls first serialize
sub strings/vectors before calling CreateTable.
Also made similar changes to the serialization of "binary schemas".
Change-Id: I5747c4038b37a0d400aca2bc592bec751cf5c172
* Make the Parser independent from the global C-locale
* Set a specific test locale using the environment variable FLATBUFFERS_TEST_LOCALE
* Remove redundant static qualifiers
* FlexBuffer to JSON convertor for typed and fixedTypedvectors
* moving the common implementation to template
* signed unsigned comparison fix
* fix a formatting ({
* changing logic to append comma in vector of elements in json
Some generic C++ and Rust code is not generated when unions use type
aliases because of potential ambiguity. Actually check for this
ambiguity and only disable offending code only if it is found.
* Add '-fsanitize' optional flags to flattests and flatc targets
Control: -DFLATBUFFERS_CODE_SANITIZE=(ON | OFF | "=memory,undefined")
Travis-CI: building with -DFLATBUFFERS_CODE_SANITIZE=ON
* Fix -pie flag
* Cleanup
Give the vtable offset enum inside each table the name
"FlatBuffersVTableOffset" and base type voffset_t so it can be used as a
dependent type in IsFieldPresent. This makes that function slightly
safer since it prevents calling it with arbitrary, non-table types.
Now, the only way to use IsFieldPresent incorrectly is to create your
own type which does not inherit from flatbuffers::Table but has a
dependent voffset convertible type "FlatBuffersVTableOffset".
* call reflection code generation from tests
This simplifies instructions to contributors so they don't forget to update
reflection code.
* add error handling to generate_code scripts
Let them propagate their errors instead of swallowing them so they show
up when called in CI.
* apply editorconfig to shell scripts
* use ordered map in dart codegen
Using an unordered map in the codegen can lead to spurious diffs in the
generated dart code.
* add CI check for generate_code being run
* update reflection_generated.h
* disable diff-check for monster_test.bfbs
Work around #5008.
* Efficient conversion of FlatBufferBuilder to grpc::MessageBuilder
* Added a variety of tests to validate correctness of the MessageBuilder move operations.
Disable MessageBuilder half-n-half tests on MacOS.
* Fix failing Android build
* Generalized the MessageBuilder move constructor to accept a deallocator
std::function makes code harder to debug because it requires stepping
through a separate destructor and call operator. It's use unnecessary
in the Parser since the functions taking functors are private and are
only used within idl_parser.cpp. Therefore the definitions can stay in
idl_parser.cpp as well. Only care must be taken that the definitions
appear before use but that's already true and all compilers will
complain equally if it get's violated. This change might also improve
performance since it might allow inlining where it wasn't possible
before but I haven't measured that.
* Refactoring of numbers parser
More accurate parse of float and double.
Hexadecimal floats.
Check "out-of-range" of uint64 fields.
Check correctness of default values and metadata.
* Remove locale-independent code strtod/strtof from PR #4948.
* small optimization
* Add is_(ascii) functions
* is_ascii cleanup
* Fix format conversation
* Refine number parser
* Make code compatible with Android build
* Remove unnecessary suppression of warning C4127
armeabi support was removed from the Android NDK so we should no
longer build it. Since this fixes the Android build failures this
commit also re-enables Travis Android builds.
While re-enabling Android builds, some recent changes broke C++98
support so this fixes those issues as well which include:
- Conditionally compiling use of move constructors, operators and
std::move.
- Changing sample to use flatbuffers::unique_ptr rather than
std::unique_ptr.
Finally, added the special "default_ptr_type" value for the
"cpp_ptr_type" attribute. This expands to the value passed to
the "--cpp-ptr-type" argument of flatc.
* Add more apis to query vector types from a reference
https://github.com/google/flatbuffers/issues/4818
* changing order of apis
* another reordering
* removed vector element type api as not needed as for now
* Add FlatBufferBuilder move semantics tests to main
Do not eagerly delete/reset allocators in release and release_raw functions
Update android, vs2010 build files
New tests for various types of FlatBufferBuilders and move semantics
* Improve test failure output with function names
* Add operator== for c++ genated code
New "--gen-compare" option for flatc to generate compare operators. The operators are defined based on object based api types.
Inspired by issue #263.
* Improve compare operator for c++.
Thanks for the code review.
- Improve robustness against future schema extensions
- Code style
- Fix --rust generation in generate_code.sh
This is a port of FlatBuffers to Rust. It provides code generation and a
runtime library derived from the C++ implementation. It utilizes the
Rust type system to provide safe and fast traversal of FlatBuffers data.
There are 188 tests, including many fuzz tests of roundtrips for various
serialization scenarios. Initial benchmarks indicate that the canonical
example payload can be written in ~700ns, and traversed in ~100ns.
Rustaceans may be interested in the Follow, Push, and SafeSliceAccess
traits. These traits lift traversals, reads, writes, and slice accesses
into the type system, providing abstraction with no runtime penalty.
Unit tests
Update flatbuffers + gRPC build instructions
Update CMakeLists.txt with cmake variables for grpc and protobuf install paths
Update tests for travis build
The verifier must be resilient against any corrupt data, so
now using size_t thru-out to ensure any 64-bit offsets can
be represented.
Also added verification of alignment.
Change-Id: I87a22aa6b045c2d83b69b47a47153f2e15ad7e06
Tested: on Linux, also with libfuzzer.
Fix for: https://bugs.chromium.org/p/chromium/issues/detail?id=834710
Before, the verifier would create pointers to objects, and then
verify they are inside the buffer. But since even constructing pointers
that are outside a valid allocation is Undefinied Behavior in C++, this
can trigger UBSAN (with -fsanitize=pointer-overflow).
Now instead the bounds checking is first performed using offsets
before pointers are even created.
Change-Id: If4d376e90df9847e543247e70a062671914dae1b
Tested: on Linux.
* starting Lua port of python implmention. Syncing commit
* Bulk of Lua module port from Python done. Not tested, only static analysis. Need to work on binary strings. Started work on flatc lua code generation
* Fixed all the basic errors to produced a binary output from the builder, don't know if it is generated correctly, but it contains data, so that must be good
* fixed binary set command that was extending the array improperly
* continued improvement
* Moved lua submodules down a directory so their names don't clash with potential other modules. Added compat module to provide Lua versioning logic
* Successful sample port from Python
* working on testing Lua code with formal tests
* continued to work on tests and fixes to code to make tests pass
* Added reading buffer test
* Changed binaryarray implmentation to use a temporary table for storing data, and then serialize it to a string when requested. This double the rate of building flatbuffers compared to the string approach.
* Didn't need encode module as it just added another layer of indirection that isn't need
* profiled reading buffers, optimizations to increase read performance of monster data to ~7 monster / millisecond
* Writing profiler improvments. Get about
~2 monsters/millisecond building rate
* removed Numpy generation from Lua (came from the Python port)
* math.pow is deprecated in Lua 5.3, so changed to ^ notation. Also added .bat script for starting Lua tests
* adding results of generate_code.bat
* simple edits for code review in PR.
* There was a buffer overflow in inserting the keywords into the unorder set for both the Lua and Python code gens. Changed insertion to use iterators.
* fixed spacing issue
* basic documenation/tutorial updates. Updated sample_binary.lua to reflect the tutorial better
* removed windows-specific build step in Lua tests