Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
ff687ae9
Commit
ff687ae9
authored
Oct 22, 2018
by
Doug Muir
Committed by
Wouter van Oortmerssen
Oct 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make alignment checking optional. (#5011)
parent
ca417426
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
flatbuffers.h
include/flatbuffers/flatbuffers.h
+4
-2
No files found.
include/flatbuffers/flatbuffers.h
View file @
ff687ae9
...
...
@@ -1901,7 +1901,7 @@ inline bool BufferHasIdentifier(const void *buf, const char *identifier, bool si
class
Verifier
FLATBUFFERS_FINAL_CLASS
{
public
:
Verifier
(
const
uint8_t
*
buf
,
size_t
buf_len
,
uoffset_t
_max_depth
=
64
,
uoffset_t
_max_tables
=
1000000
)
uoffset_t
_max_tables
=
1000000
,
bool
_check_alignment
=
true
)
:
buf_
(
buf
),
size_
(
buf_len
),
depth_
(
0
),
...
...
@@ -1912,6 +1912,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
#ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
,
upper_bound_
(
0
)
#endif
,
check_alignment_
(
_check_alignment
)
// clang-format on
{
FLATBUFFERS_ASSERT
(
size_
<
FLATBUFFERS_MAX_BUFFER_SIZE
);
...
...
@@ -1944,7 +1945,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
}
template
<
typename
T
>
bool
VerifyAlignment
(
size_t
elem
)
const
{
return
(
elem
&
(
sizeof
(
T
)
-
1
))
==
0
;
return
(
elem
&
(
sizeof
(
T
)
-
1
))
==
0
||
!
check_alignment_
;
}
// Verify a range indicated by sizeof(T).
...
...
@@ -2127,6 +2128,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
mutable
size_t
upper_bound_
;
#endif
// clang-format on
bool
check_alignment_
;
};
// Convenient way to bundle a buffer and its length, to pass it around
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment