Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
79d9fdc0
Commit
79d9fdc0
authored
Oct 22, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user-defined string literals exploit string length (#340)
parent
e3108503
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
json.hpp
src/json.hpp
+6
-4
json.hpp.re2c
src/json.hpp.re2c
+6
-4
No files found.
src/json.hpp
View file @
79d9fdc0
...
...
@@ -10590,13 +10590,14 @@ can be used by adding `"_json"` to a string literal and returns a JSON object
if no parse error occurred.
@param[in] s a string representation of a JSON object
@param[in] n the length of string @a s
@return a JSON object
@since version 1.0.0
*/
inline
nlohmann
::
json
operator
""
_json
(
const
char
*
s
,
std
::
size_t
)
inline
nlohmann
::
json
operator
""
_json
(
const
char
*
s
,
std
::
size_t
n
)
{
return
nlohmann
::
json
::
parse
(
s
);
return
nlohmann
::
json
::
parse
(
s
,
s
+
n
);
}
/*!
...
...
@@ -10607,13 +10608,14 @@ can be used by adding `"_json_pointer"` to a string literal and returns a JSON p
object if no parse error occurred.
@param[in] s a string representation of a JSON Pointer
@param[in] n the length of string @a s
@return a JSON pointer object
@since version 2.0.0
*/
inline
nlohmann
::
json
::
json_pointer
operator
""
_json_pointer
(
const
char
*
s
,
std
::
size_t
)
inline
nlohmann
::
json
::
json_pointer
operator
""
_json_pointer
(
const
char
*
s
,
std
::
size_t
n
)
{
return
nlohmann
::
json
::
json_pointer
(
s
);
return
nlohmann
::
json
::
json_pointer
(
s
td
::
string
(
s
,
n
)
);
}
// restore GCC/clang diagnostic settings
...
...
src/json.hpp.re2c
View file @
79d9fdc0
...
...
@@ -9887,13 +9887,14 @@ can be used by adding `"_json"` to a string literal and returns a JSON object
if no parse error occurred.
@param[in] s a string representation of a JSON object
@param[in] n the length of string @a s
@return a JSON object
@since version 1.0.0
*/
inline nlohmann::json operator "" _json(const char* s, std::size_t)
inline nlohmann::json operator "" _json(const char* s, std::size_t
n
)
{
return nlohmann::json::parse(s);
return nlohmann::json::parse(s
, s + n
);
}
/*!
...
...
@@ -9904,13 +9905,14 @@ can be used by adding `"_json_pointer"` to a string literal and returns a JSON p
object if no parse error occurred.
@param[in] s a string representation of a JSON Pointer
@param[in] n the length of string @a s
@return a JSON pointer object
@since version 2.0.0
*/
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t)
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t
n
)
{
return nlohmann::json::json_pointer(s);
return nlohmann::json::json_pointer(s
td::string(s, n)
);
}
// restore GCC/clang diagnostic settings
...
...
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