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

NetKAT parses signed 32/64bit integers; should be unsigned #536

Open
smolkaj opened this issue Dec 14, 2016 · 1 comment
Open

NetKAT parses signed 32/64bit integers; should be unsigned #536

smolkaj opened this issue Dec 14, 2016 · 1 comment

Comments

@smolkaj
Copy link
Member

smolkaj commented Dec 14, 2016

The parser currently uses Int64.of_string and Int32.of_string to parse 64 bit and 32 bit integers, respectively. However, these functions parse signed integers in the range [-2^(x-1), 2^(x-1)-1] for x = 32,64. What we want are unsigned integers in the range [0,2^x-1]. The functions to_int and to_int32 in Frenetic_Fdd.ml suffer from a similar problem, see @calebvoss's comment in #517.

The deeper issue here is that we're using signed types int, int32, and int64 throughout the code base when really we should be using uint, uint32, and uint64. This would avoid bugs of this nature. Unfortunately, OCaml does not support these types natively, so we will need to resort to some library.

@smolkaj smolkaj changed the title NetKAT parses *signed* 32/64bit integers; should be *unsigned* NetKAT parses signed 32/64bit integers; should be unsigned Dec 14, 2016
@smolkaj smolkaj mentioned this issue Dec 14, 2016
7 tasks
@smolkaj
Copy link
Member Author

smolkaj commented Dec 15, 2016

The stdint packages provides various unsigned integer types together with parsing functions etc., but they currently don't have support for s-expressions, see andrenth/ocaml-stdint#10.

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

1 participant