starwing / lua-protobuf

A Lua module to work with Google protobuf
MIT License
1.71k stars 388 forks source link

pb.decode() 导致 out of memory #251

Closed wilsonloo closed 10 months ago

wilsonloo commented 10 months ago

使用 commit 为 441d662c01080ce7af3c2beef53d524e5b408635 以上的代码:

local pb = require "pb" -- pb.so

local raw_data = -- 原始二进制数据
local proto = ""
local ret = pb.decode(proto, raw_data) -- 这里会产生 assert:out of memory stack traceback:

原因是 proto 是长度为0的空字符串(不是nil),建议添加对proto这个参数的检测描述,我还已读以为是否我传递的raw_data 有问题。

starwing commented 10 months ago

fixed on HEAD.