Commit 4b82977
committed
public/schema: bound fractional digits in canonical decimal parser
len(fracPart) is a 64-bit int. The downstream casts to int32 (the scale
type) in ParseDecimal and ParseBigDecimal would wrap silently on a
fractional part longer than math.MaxInt32 — the BigDecimal path would
return a negative scale and the Decimal path would short-circuit its
"exceeds scale" check.
Bound the fractional length in parseCanonicalDecimal with an explicit
error so both parsers fail loudly rather than returning corrupt output.1 parent 9b6f8c4 commit 4b82977
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
| |||
0 commit comments