Public bug reported:

lua box.insert(23, 0, bit.lshift(1, 31))
---
error: 'Supplied key field type does not match index type: expected u32'

localhost> lua box.insert(23, 0, -1)
---
error: 'Supplied key field type does not match index type: expected u32'
...

localhost> lua #box.pack("p", -1)
---
 - 9 <!-- must be 5 (was packetd as uint64)
...

 lua box.unpack("wi", box.pack("p", -1))
---
error: 'box.unpack(''wi''): too many bytes: unpacked 5, total 9'
...

 lua box.unpack("wl", box.pack("p", -1))
---
 - 8
 - 18446744073709551615


Please use lua_tointeger OR assign results of  lua_tonumber(L, i) only to 
variables of  the double type instead of uint64_t. **Explicit** convertions to 
uint32_t / uint64_t must not be perfomed.

** Affects: tarantool
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Tarantool
Development Team, which is subscribed to tarantool.
https://bugs.launchpad.net/bugs/1100759

Title:
  box.pack / box.unpack handle negative numbers incorrectly

Status in Tarantool - an efficient in-memory data store:
  New

Bug description:
  lua box.insert(23, 0, bit.lshift(1, 31))
  ---
  error: 'Supplied key field type does not match index type: expected u32'

  localhost> lua box.insert(23, 0, -1)
  ---
  error: 'Supplied key field type does not match index type: expected u32'
  ...

  localhost> lua #box.pack("p", -1)
  ---
   - 9 <!-- must be 5 (was packetd as uint64)
  ...

   lua box.unpack("wi", box.pack("p", -1))
  ---
  error: 'box.unpack(''wi''): too many bytes: unpacked 5, total 9'
  ...

   lua box.unpack("wl", box.pack("p", -1))
  ---
   - 8
   - 18446744073709551615

  
  Please use lua_tointeger OR assign results of  lua_tonumber(L, i) only to 
variables of  the double type instead of uint64_t. **Explicit** convertions to 
uint32_t / uint64_t must not be perfomed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/tarantool/+bug/1100759/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~tarantool-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~tarantool-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to