Skip to content

在某些情况下append_table中判断table是否是array不正确 #9

@usbuild

Description

@usbuild

相关代码

lua_rawlen可能返回在 hashpart 部分的 integer key,从而使得后面的 lua_next 的结果处于不确定的状态。

系统环境

Lua 5.3.2
3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2

测试用例

t={}
for i = 1, 33 do t[i] = 1; end
for i = 1, 10 do t[i] = nil; end
t[35] = 1
t['7']=1
bson.encode({t})

输出

Invalid array key type : string
stack traceback:
        [C]: in function 'bson.encode'
        stdin:1: in main chunk
        [C]: in ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions