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

UInt parsing is too permissive #609

Closed
porcuquine opened this issue Aug 15, 2023 · 1 comment
Closed

UInt parsing is too permissive #609

porcuquine opened this issue Aug 15, 2023 · 1 comment
Labels
bug Something isn't working DX-DevEx Developer Experience track

Comments

@porcuquine
Copy link
Contributor

Parsing of literal U64 seems to now accept out-of-range values, which it should not. See before and after examples. 'Before' is lurkrs, after is lurk:

➜  lurk-rs git:(master) lurkrs    
Lurk REPL welcomes you.
> 12345678901234567890123456789u64
Read error: Syntax("Number too large for u64.")
> 
Exiting...
➜  lurk-rs git:(master) lurk      
Lurk REPL welcomes you.
> 12345678901234567890123456789u64
[1 iteration] => 0x000000000000000000000000000000000000000027e41b3246bec9b16e398115
> 

The same problem exists for U32, though seems to also have been in lurkrs:

➜  lurk-rs git:(master) lurkrs
Lurk REPL welcomes you.
> 12345678901234567890123456789u32
[1 iterations] => 0x000000000000000000000000000000000000000027e41b3246bec9b16e398115
> 
Exiting...
➜  lurk-rs git:(master) lurk  
Lurk REPL welcomes you.
> 12345678901234567890123456789u32
[1 iteration] => 0x000000000000000000000000000000000000000027e41b3246bec9b16e398115
> 
@porcuquine porcuquine added the bug Something isn't working label Aug 15, 2023
@arthurpaulino arthurpaulino removed their assignment Aug 15, 2023
@arthurpaulino arthurpaulino added the DX-DevEx Developer Experience track label Aug 15, 2023
johnchandlerburnham added a commit that referenced this issue Feb 24, 2024
- merges previous parse_num and parse_uint into a single parse_numeric
- removes bounds check on Num, so that parsing numbers larger than the
  field will modularly wrap
- corrects uint parsing so that we never accidentally parse uints as
  nums
- implements a placeholder syntax for i64 for parsing twos-complement
  numbers (i.e. -1i64 parses to u64::MAX). In future this syntax should
  parse to a new literal type
- add placeholder parsing for u8, u16, u32, u128, i8, i16, i32, i128
  literals so that we correctly error that these have yet to be
  implemented
- adds unit tests to ensure correctness of the above
github-merge-queue bot pushed a commit that referenced this issue Feb 25, 2024
* new numeric parser, closes #609, #1161, #1169

- merges previous parse_num and parse_uint into a single parse_numeric
- removes bounds check on Num, so that parsing numbers larger than the
  field will modularly wrap
- corrects uint parsing so that we never accidentally parse uints as
  nums
- implements a placeholder syntax for i64 for parsing twos-complement
  numbers (i.e. -1i64 parses to u64::MAX). In future this syntax should
  parse to a new literal type
- add placeholder parsing for u8, u16, u32, u128, i8, i16, i32, i128
  literals so that we correctly error that these have yet to be
  implemented
- adds unit tests to ensure correctness of the above

* clippy

* clippy part II: revenge of the linter

* remove unused byte parsers and associated tests

* comment out printlns
@arthurpaulino
Copy link
Member

Closed by #1171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DX-DevEx Developer Experience track
Projects
None yet
Development

No branches or pull requests

2 participants