Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string.pack not throwing overflow error #171

Closed
Baileyeatspizza opened this issue Nov 7, 2021 · 1 comment · Fixed by #200
Closed

string.pack not throwing overflow error #171

Baileyeatspizza opened this issue Nov 7, 2021 · 1 comment · Fixed by #200
Labels
bug Something isn't working

Comments

@Baileyeatspizza
Copy link
Contributor

Baileyeatspizza commented Nov 7, 2021

So I build luau as normal and ran make test
Screenshot 2021-11-07 at 21 23 15

what's happening is that its expecting string.pack("<I" .. I, -1) to throw an error but it doesn't it actually just returns nothing

after more testing using this simple command line version of what that script is doing
for i = 1, 3 do local umax = bit32.lshift(1, i * 8) - 1 local max = bit32.rshift(umax, 1) local min = -max-1 print("Testing") print("Result = ",pcall(string.pack, "<I" .. i, min)) end

I found that it works as intended in Roblox Studio
Screenshot 2021-11-07 at 21 29 31

but fails in luau
Screenshot 2021-11-07 at 21 31 01

so I'm just assuming the function isn't throwing an overflow error for whatever reason

weirdly enough what I run unpack on the packed string it produces this in luau
Screenshot 2021-11-07 at 21 36 43

whereas in Roblox it well...
Screenshot 2021-11-07 at 21 38 47

again for convenience here is the code for that simple test
for i = 1, 3 do local umax = bit32.lshift(1, i * 8) - 1 local max = bit32.rshift(umax, 1) local min = -max-1 print("Testing") print(string.unpack(string.pack("<I" .. i, min), "<I")) end

compiled using: make config=release luau luau-analyze
compiled version: 0.503 (latest release I just downloaded the repo)

a few things to note:
I tried running make test multiple times always failed
I tried reinstalling the tests still failed
I tried compiling with cmake it still failed

its a pretty weird bug how it works in Roblox tests but not in luau tests

should also mention I'm running macOS Monterey Version 12.0.1 (21A559)
Apple M1 chip

oh and final note is that it fails for all overflow errors not just the <I one I showed off in tests that's just the first one that fails in make test

@Baileyeatspizza Baileyeatspizza added the bug Something isn't working label Nov 7, 2021
@zeux
Copy link
Collaborator

zeux commented Nov 7, 2021

Thanks! This is a bug specific to ARM architecture. It so happens that we already fixed it last week but the fix didn't make it to this repository yet. Let's keep this open, the fix should land here on Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants