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
871cebaf
Commit
871cebaf
authored
Dec 29, 2016
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚑
fix for #405
parent
8381cd60
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
json.hpp
src/json.hpp
+6
-0
json.hpp.re2c
src/json.hpp.re2c
+6
-0
unit-regression.cpp
test/src/unit-regression.cpp
+7
-0
No files found.
src/json.hpp
View file @
871cebaf
...
@@ -6871,6 +6871,12 @@ class basic_json
...
@@ -6871,6 +6871,12 @@ class basic_json
{
{
throw
std
::
out_of_range
(
"len+offset out of range"
);
throw
std
::
out_of_range
(
"len+offset out of range"
);
}
}
// last case: reading past the end of the vector
if
(
len
+
offset
>
size
)
{
throw
std
::
out_of_range
(
"len+offset out of range"
);
}
}
}
/*!
/*!
...
...
src/json.hpp.re2c
View file @
871cebaf
...
@@ -6871,6 +6871,12 @@ class basic_json
...
@@ -6871,6 +6871,12 @@ class basic_json
{
{
throw std::out_of_range("len+offset out of range");
throw std::out_of_range("len+offset out of range");
}
}
// last case: reading past the end of the vector
if (len + offset > size)
{
throw std::out_of_range("len+offset out of range");
}
}
}
/*!
/*!
...
...
test/src/unit-regression.cpp
View file @
871cebaf
...
@@ -540,4 +540,11 @@ TEST_CASE("regression tests")
...
@@ -540,4 +540,11 @@ TEST_CASE("regression tests")
CHECK
(
j
.
is_number_float
());
CHECK
(
j
.
is_number_float
());
CHECK
(
j
.
dump
()
==
"1.66020696663386e+20"
);
CHECK
(
j
.
dump
()
==
"1.66020696663386e+20"
);
}
}
SECTION
(
"issue #405 - Heap-buffer-overflow (OSS-Fuzz issue 342)"
)
{
// original test case
std
::
vector
<
uint8_t
>
vec
{
0x65
,
0xf5
,
0x0a
,
0x48
,
0x21
};
CHECK_THROWS_AS
(
json
::
from_cbor
(
vec
),
std
::
out_of_range
);
}
}
}
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