Commit 64a77de4 authored by Chanjun's avatar Chanjun Committed by François Perrad
Browse files

fix extra bytes detection

parent 395ae3dd
...@@ -838,7 +838,7 @@ function m.unpack (s) ...@@ -838,7 +838,7 @@ function m.unpack (s)
checktype('unpack', 1, s, 'string') checktype('unpack', 1, s, 'string')
local cursor = cursor_string(s) local cursor = cursor_string(s)
local data = unpack_cursor(cursor) local data = unpack_cursor(cursor)
if cursor.i < cursor.j then if cursor.i <= cursor.j then
error "extra bytes" error "extra bytes"
end end
return data return data
......
...@@ -589,7 +589,7 @@ function m.unpack (s) ...@@ -589,7 +589,7 @@ function m.unpack (s)
checktype('unpack', 1, s, 'string') checktype('unpack', 1, s, 'string')
local cursor = cursor_string(s) local cursor = cursor_string(s)
local data = unpack_cursor(cursor) local data = unpack_cursor(cursor)
if cursor.i < cursor.j then if cursor.i <= cursor.j then
error "extra bytes" error "extra bytes"
end end
return data return data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment