Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rt-UA
open62541
Commits
3a4265b3
Commit
3a4265b3
authored
5 years ago
by
Julius Pfrommer
Committed by
Julius Pfrommer
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix(core): Thread-safe parsing of human-readable builtin types
parent
e4c166f6
master
fix/warn_fuzz
pack/master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ua_types_lex.c
+9
-0
src/ua_types_lex.c
src/ua_types_lex.re
+9
-0
src/ua_types_lex.re
with
18 additions
and
0 deletions
+18
-0
src/ua_types_lex.c
View file @
3a4265b3
...
...
@@ -27,6 +27,11 @@
const
char
*
yyt1
;
const
char
*
yyt2
;
const
char
*
yyt3
;
const
char
*
yyt4
;
/* The generated lexer defines global variables. Protect with a mutex. */
#if UA_MULTITHREADING >= 100
UA_LOCK_TYPE
(
parserMutex
)
#endif
static
UA_StatusCode
parse_guid
(
UA_Guid
*
guid
,
const
UA_Byte
*
s
,
const
UA_Byte
*
e
)
{
size_t
len
=
(
size_t
)(
e
-
s
);
...
...
@@ -232,10 +237,12 @@ yy14:
UA_StatusCode
UA_NodeId_parse
(
UA_NodeId
*
id
,
const
UA_String
str
)
{
UA_LOCK
(
parserMutex
);
UA_StatusCode
res
=
parse_nodeid
(
id
,
(
const
char
*
)
str
.
data
,
(
const
char
*
)
str
.
data
+
str
.
length
);
if
(
res
!=
UA_STATUSCODE_GOOD
)
UA_NodeId_clear
(
id
);
UA_UNLOCK
(
parserMutex
);
return
res
;
}
...
...
@@ -490,9 +497,11 @@ yy42:
UA_StatusCode
UA_ExpandedNodeId_parse
(
UA_ExpandedNodeId
*
id
,
const
UA_String
str
)
{
UA_LOCK
(
parserMutex
);
UA_StatusCode
res
=
parse_expandednodeid
(
id
,
(
const
char
*
)
str
.
data
,
(
const
char
*
)
str
.
data
+
str
.
length
);
if
(
res
!=
UA_STATUSCODE_GOOD
)
UA_ExpandedNodeId_clear
(
id
);
UA_UNLOCK
(
parserMutex
);
return
res
;
}
This diff is collapsed.
Click to expand it.
src/ua_types_lex.re
View file @
3a4265b3
...
...
@@ -37,6 +37,11 @@
nodeid_body = ("i=" | "s=" | "g=" | "b=");
*/
/* The generated lexer defines global variables. Protect with a mutex. */
#
if
UA_MULTITHREADING
>=
100
UA_LOCK_TYPE
(
parserMutex
)
#
endif
static
UA_StatusCode
parse_guid
(
UA_Guid
*
guid
,
const
UA_Byte
*
s
,
const
UA_Byte
*
e
)
{
size_t
len
=
(
size_t
)(
e
-
s
);
...
...
@@ -147,10 +152,12 @@ parse_nodeid(UA_NodeId *id, const char *input, const char *end) {
UA_StatusCode
UA_NodeId_parse
(
UA_NodeId
*
id
,
const
UA_String
str
)
{
UA_LOCK
(
parserMutex
);
UA_StatusCode
res
=
parse_nodeid
(
id
,
(
const
char
*
)
str
.
data
,
(
const
char
*
)
str
.
data
+
str
.
length
);
if
(
res
!=
UA_STATUSCODE_GOOD
)
UA_NodeId_clear
(
id
);
UA_UNLOCK
(
parserMutex
);
return
res
;
}
...
...
@@ -193,9 +200,11 @@ parse_expandednodeid(UA_ExpandedNodeId *id, const char *input, const char *end)
UA_StatusCode
UA_ExpandedNodeId_parse
(
UA_ExpandedNodeId
*
id
,
const
UA_String
str
)
{
UA_LOCK
(
parserMutex
);
UA_StatusCode
res
=
parse_expandednodeid
(
id
,
(
const
char
*
)
str
.
data
,
(
const
char
*
)
str
.
data
+
str
.
length
);
if
(
res
!=
UA_STATUSCODE_GOOD
)
UA_ExpandedNodeId_clear
(
id
);
UA_UNLOCK
(
parserMutex
);
return
res
;
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help