Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
a3586cd1
Commit
a3586cd1
authored
11 years ago
by
ShadowNinja
Browse files
Options
Downloads
Patches
Plain Diff
Add maximum recursion depth to read_json_value
parent
a9df87ed
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/script/common/c_content.cpp
+5
-2
5 additions, 2 deletions
src/script/common/c_content.cpp
src/script/common/c_content.h
+2
-1
2 additions, 1 deletion
src/script/common/c_content.h
with
7 additions
and
3 deletions
src/script/common/c_content.cpp
+
5
−
2
View file @
a3586cd1
...
...
@@ -1088,8 +1088,11 @@ bool push_json_value(lua_State *L, const Json::Value &value, int nullindex)
}
// Converts Lua table --> JSON
void
read_json_value
(
lua_State
*
L
,
Json
::
Value
&
root
,
int
index
)
void
read_json_value
(
lua_State
*
L
,
Json
::
Value
&
root
,
int
index
,
u8
recursion
)
{
if
(
recursion
>
16
)
{
throw
SerializationError
(
"Maximum recursion depth exceeded"
);
}
int
type
=
lua_type
(
L
,
index
);
if
(
type
==
LUA_TBOOLEAN
)
{
root
=
(
bool
)
lua_toboolean
(
L
,
index
);
...
...
@@ -1104,7 +1107,7 @@ void read_json_value(lua_State *L, Json::Value &root, int index)
while
(
lua_next
(
L
,
index
))
{
// Key is at -2 and value is at -1
Json
::
Value
value
;
read_json_value
(
L
,
value
,
lua_gettop
(
L
));
read_json_value
(
L
,
value
,
lua_gettop
(
L
)
,
recursion
+
1
);
Json
::
ValueType
roottype
=
root
.
type
();
int
keytype
=
lua_type
(
L
,
-
1
);
...
...
This diff is collapsed.
Click to expand it.
src/script/common/c_content.h
+
2
−
1
View file @
a3586cd1
...
...
@@ -152,7 +152,8 @@ bool push_json_value (lua_State *L,
int
nullindex
);
void
read_json_value
(
lua_State
*
L
,
Json
::
Value
&
root
,
int
index
);
int
index
,
u8
recursion
=
0
);
extern
struct
EnumString
es_TileAnimationType
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment