lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I found a bug in string.unpack:

```
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> string.unpack("I4", "\255\255\255\255")
4294967295	5
> string.unpack("I8", "\255\255\255\255\255\255\255\255")
-1	9
> string.unpack("I8", "\255\255\255\255\255\255\255\127")
9223372036854775807	9
> string.unpack("I8", "\255\255\255\255\255\255\255\128")
-9151314442816847873	9
```

I tried looking for the cause but I am not fluent in C. Maybe something about lua_Integer?