Fix Rust UB problems (#6393)

* Fix miri problems by assuming alignment is 1 in rust

* Removed is_aligned fn from rust verifier.

* Add back is_aligned, but make it w.r.t. buffer[0]

* touch unused variable

* touch unused variable

* +nightly

* Move Rust miri testing into its own docker

* fix bash

* missing one endian conversion

* fix endianness2

* format stuff

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2021-01-11 15:24:52 -05:00
committed by GitHub
parent 39e115fdb4
commit 408cf58024
17 changed files with 540 additions and 197 deletions

View File

@@ -98,6 +98,7 @@ fn create_serialized_example_with_generated_code(builder: &mut flatbuffers::Flat
my_game::example::finish_monster_buffer(builder, mon);
}
#[cfg(not(miri))] // slow.
fn main() {
// test the allocation tracking:
{

View File

@@ -103,6 +103,7 @@ fn validate_monster(flexbuffer: &[u8]) {
// This is in a separate binary than tests because taking over the global allocator is not
// hermetic and not thread safe.
#[cfg(not(miri))] // slow.
fn main() {
let start_up = current_allocs();
@@ -133,6 +134,7 @@ fn main() {
}
#[test]
#[cfg(not(miri))] // slow.
fn no_extra_allocations() {
main()
}