Compare commits

...

3 Commits
v8.2.2 ... main

Author SHA1 Message Date
Daniel Lemire
011763f31c adding tests 2025-12-31 13:46:53 -05:00
Daniel Lemire
d5bc4e1b2e
Merge pull request #358 from shikharish/uint8-base-fix
add base check for uint8
2025-12-31 13:44:12 -05:00
Shikhar
4dc5225797 add base check for uint8 parsing
Signed-off-by: Shikhar <shikharish05@gmail.com>
2025-12-31 22:07:45 +05:30
2 changed files with 82 additions and 80 deletions

View File

@ -24,7 +24,7 @@ jobs:
apt-get update -q -y apt-get update -q -y
apt-get install -y cmake make g++ apt-get install -y cmake make g++
run: | run: |
cmake -DCMAKE_BUILD_TYPE=Release -B build cmake -DCMAKE_BUILD_TYPE=Release -B build -DFASTFLOAT_TEST=ON
cmake --build build -j=2 cmake --build build -j=2
ctest --output-on-failure --test-dir build ctest --output-on-failure --test-dir build

View File

@ -515,6 +515,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
UC const *const start_digits = p; UC const *const start_digits = p;
FASTFLOAT_IF_CONSTEXPR17((std::is_same<T, std::uint8_t>::value)) { FASTFLOAT_IF_CONSTEXPR17((std::is_same<T, std::uint8_t>::value)) {
if (base == 10) {
const size_t len = (size_t)(pend - p); const size_t len = (size_t)(pend - p);
if (len == 0) { if (len == 0) {
if (has_leading_zeros) { if (has_leading_zeros) {
@ -603,6 +604,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
answer.ptr = p + nd; answer.ptr = p + nd;
return answer; return answer;
} }
}
uint64_t i = 0; uint64_t i = 0;
if (base == 10) { if (base == 10) {