Skip to content

Commit

Permalink
修复数组类型判定
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed Oct 8, 2023
1 parent 41d1fea commit 1527fea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extend/lbson/src/bson.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ namespace lbson {
if (!lua_isinteger(L, -2)) {
return bson_type::BSON_DOCUMENT;
}
size_t key = lua_tointeger(L, -2);
if (key <= 0 || key > raw_len) {
return bson_type::BSON_DOCUMENT;
}
cur_len++;
lua_pop(L, 1);
}
Expand Down
4 changes: 4 additions & 0 deletions extend/ljson/src/ljson.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ namespace ljson {
if (!lua_isinteger(L, -2)) {
return false;
}
size_t key = lua_tointeger(L, -2);
if (key <= 0 || key > raw_len) {
return false;
}
lua_pop(L, 1);
cur_len++;
}
Expand Down
4 changes: 4 additions & 0 deletions extend/luakit/include/lua_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ namespace luakit {
if (!lua_isinteger(L, -2)) {
return false;
}
size_t key = lua_tointeger(L, -2);
if (key <= 0 || key > raw_len) {
return false;
}
cur_len++;
lua_pop(L, 1);
}
Expand Down

0 comments on commit 1527fea

Please sign in to comment.