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

Util.intToBytes crashes #10

Open
nfranke opened this issue Apr 19, 2018 · 3 comments
Open

Util.intToBytes crashes #10

nfranke opened this issue Apr 19, 2018 · 3 comments

Comments

@nfranke
Copy link

nfranke commented Apr 19, 2018

If the value is over 255 then intToBytes will crash because the UInt8() cast will cause a runtime exception. I suggest changing that line to this:

            bytes.append(UInt8(0xff & (value >> Int32(x * 8))))
@tobias
Copy link
Owner

tobias commented Apr 19, 2018

Hi @nfranke! I don't use this library, but I'm glad that someone does :) I'd be happy to take a PR to fix this (and #9).

@tobias
Copy link
Owner

tobias commented Apr 19, 2018

Also see #11.

nfranke pushed a commit to nfranke/vertx-swift-eventbus that referenced this issue Apr 20, 2018
	If the value is over 255 then intToBytes will crash because the UInt8() cast will cause a runtime exception. I suggest changing that line to this:
@nfranke
Copy link
Author

nfranke commented Apr 20, 2018

I have created a pull request #12 for this and #9

Not sure how committed I'll be to this project just yet. I may be interested in maintaining it, all depends on whether it continues to work out for my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants