Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kaldrum
SRB2
Commits
6414e9db
Commit
6414e9db
authored
Aug 31, 2023
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Fix possible crashes in the Lua API when accessing invalid fields
parent
6c416c61
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lua_consolelib.c
+1
-1
1 addition, 1 deletion
src/lua_consolelib.c
src/lua_hudlib.c
+1
-2
1 addition, 2 deletions
src/lua_hudlib.c
src/lua_maplib.c
+8
-4
8 additions, 4 deletions
src/lua_maplib.c
with
10 additions
and
7 deletions
src/lua_consolelib.c
+
1
−
1
View file @
6414e9db
...
...
@@ -615,7 +615,7 @@ static int cvar_get(lua_State *L)
break
;
default:
if
(
devparm
)
return
luaL_error
(
L
,
LUA_QL
(
"consvar_t"
)
" has no field named "
LUA_QS
,
field
);
return
luaL_error
(
L
,
LUA_QL
(
"consvar_t"
)
" has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
)
);
else
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/lua_hudlib.c
+
1
−
2
View file @
6414e9db
...
...
@@ -282,7 +282,6 @@ static int patch_get(lua_State *L)
patch_t
*
patch
=
*
((
patch_t
**
)
luaL_checkudata
(
L
,
1
,
META_PATCH
));
enum
patch
field
=
Lua_optoption
(
L
,
2
,
-
1
,
patch_fields_ref
);
// patches are invalidated when switching renderers
if
(
!
patch
)
{
if
(
field
==
patch_valid
)
{
lua_pushboolean
(
L
,
0
);
...
...
@@ -436,7 +435,7 @@ static int camera_set(lua_State *L)
cam
->
momz
=
luaL_checkfixed
(
L
,
3
);
break
;
default:
return
luaL_error
(
L
,
LUA_QL
(
"camera_t"
)
" has no field named "
LUA_QS
,
camera_opt
[
field
]
);
return
luaL_error
(
L
,
LUA_QL
(
"camera_t"
)
" has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
)
);
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/lua_maplib.c
+
8
−
4
View file @
6414e9db
...
...
@@ -800,8 +800,9 @@ static int sector_set(lua_State *L)
case
sector_fslope
:
// f_slope
case
sector_cslope
:
// c_slope
case
sector_friction
:
// friction
default:
return
luaL_error
(
L
,
"sector_t field "
LUA_QS
" cannot be set."
,
sector_opt
[
field
]);
default:
return
luaL_error
(
L
,
"sector_t has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
));
case
sector_floorheight
:
{
// floorheight
boolean
flag
;
mobj_t
*
ptmthing
=
tmthing
;
...
...
@@ -1279,8 +1280,9 @@ static int side_set(lua_State *L)
case
side_sector
:
case
side_special
:
case
side_text
:
default:
return
luaL_error
(
L
,
"side_t field "
LUA_QS
" cannot be set."
,
side_opt
[
field
]);
default:
return
luaL_error
(
L
,
"side_t has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
));
case
side_textureoffset
:
side
->
textureoffset
=
luaL_checkfixed
(
L
,
3
);
break
;
...
...
@@ -2291,8 +2293,9 @@ static int ffloor_set(lua_State *L)
case
ffloor_target
:
// target
case
ffloor_next
:
// next
case
ffloor_prev
:
// prev
default:
return
luaL_error
(
L
,
"ffloor_t field "
LUA_QS
" cannot be set."
,
ffloor_opt
[
field
]);
default:
return
luaL_error
(
L
,
"ffloor_t has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
));
case
ffloor_topheight
:
{
// topheight
boolean
flag
;
fixed_t
lastpos
=
*
ffloor
->
topheight
;
...
...
@@ -2426,8 +2429,9 @@ static int slope_set(lua_State *L)
case
slope_d
:
// d
case
slope_flags
:
// flags
case
slope_normal
:
// normal
default:
return
luaL_error
(
L
,
"pslope_t field "
LUA_QS
" cannot be set."
,
slope_opt
[
field
]);
default:
return
luaL_error
(
L
,
"pslope_t has no field named "
LUA_QS
"."
,
lua_tostring
(
L
,
2
));
case
slope_o
:
{
// o
luaL_checktype
(
L
,
3
,
LUA_TTABLE
);
...
...
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