Fix interpolation/STRFMT overflow issues (#838)

Widths and fractional widths greater than 255 would overflow a
uint8_t and wrap around to smaller values.

Total formatted lengths greater than the avilable buffer size
would overflow it and potentially corrupt memory.

Fixes #830
Closes #831
This commit is contained in:
Rangi
2021-04-17 00:52:55 -04:00
committed by GitHub
parent 503c3b5364
commit ee5da4468d
9 changed files with 122 additions and 36 deletions

View File

@@ -28,9 +28,9 @@ struct FormatSpec {
bool prefix;
bool alignLeft;
bool padZero;
uint8_t width;
size_t width;
bool hasFrac;
uint8_t fracWidth;
size_t fracWidth;
int type;
bool valid;
};