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
cbe8747b
Commit
cbe8747b
authored
Jan 18, 2016
by
Oli Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check (& skipping) of the utf-8 byte order mark (0xEF BB BF) at the beginning of the file
parent
63b526db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
idl.h
include/flatbuffers/idl.h
+1
-0
idl_parser.cpp
src/idl_parser.cpp
+9
-0
No files found.
include/flatbuffers/idl.h
View file @
cbe8747b
...
...
@@ -444,6 +444,7 @@ private:
FLATBUFFERS_CHECKED_ERROR
Error
(
const
std
::
string
&
msg
);
FLATBUFFERS_CHECKED_ERROR
ParseHexNum
(
int
nibbles
,
int64_t
*
val
);
FLATBUFFERS_CHECKED_ERROR
Next
();
FLATBUFFERS_CHECKED_ERROR
SkipByteOrderMark
();
bool
Is
(
int
t
);
FLATBUFFERS_CHECKED_ERROR
Expect
(
int
t
);
std
::
string
TokenToStringId
(
int
t
);
...
...
src/idl_parser.cpp
View file @
cbe8747b
...
...
@@ -200,6 +200,14 @@ CheckedError Parser::ParseHexNum(int nibbles, int64_t *val) {
return
NoError
();
}
CheckedError
Parser
::
SkipByteOrderMark
()
{
if
(
static_cast
<
unsigned
char
>
(
*
cursor_
)
!=
0xef
)
return
NoError
();
cursor_
++
;
if
(
static_cast
<
unsigned
char
>
(
*
cursor_
++
)
!=
0xbb
)
return
Error
(
"invalid utf-8 byte order mark"
);
if
(
static_cast
<
unsigned
char
>
(
*
cursor_
++
)
!=
0xbf
)
return
Error
(
"invalid utf-8 byte order mark"
);
return
NoError
();
}
CheckedError
Parser
::
Next
()
{
doc_comment_
.
clear
();
bool
seen_newline
=
false
;
...
...
@@ -1584,6 +1592,7 @@ CheckedError Parser::DoParse(const char *source, const char **include_paths,
builder_
.
Clear
();
// Start with a blank namespace just in case this file doesn't have one.
namespaces_
.
push_back
(
new
Namespace
());
ECHECK
(
SkipByteOrderMark
());
NEXT
();
// Includes must come before type declarations:
for
(;;)
{
...
...
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