apache / apache/arrow-rs

Parsing Decimal With Negative Exponent And Zero Scale Can Overflow

Open
#5,762 4 comments 0 reactions 1 assignee Claimed by @neilconway View on GitHub
bug
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 14h
Merged PRs (30d)
167

Description

**Describe the bug**

This passes as expected
```
let v = parse_decimal::("99999999999999999999999999999999999999", 38, 0).unwrap();
assert_eq!(v, 99999999999999999999999999999999999999);
```

But if we add an additional `9` followed by `e-1` we get overflow

```
let v = parse_decimal::("999999999999999999999999999999999999999e-1", 38, 0).unwrap();
assert_eq!(v, 99999999999999999999999999999999999999);
```

**To Reproduce**

**Expected behavior**

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.