Skip to content

Commit

Permalink
Port fix for array index out of bounds in decimal conversion
Browse files Browse the repository at this point in the history
miloyip/dtoa-benchmark#7

commit fe550f38669fe0f488926c1ef0feb6c101f586d6
Author: Eli Fidler <[email protected]>
Date:   Tue May 31 11:51:37 2016 -0400

    avoid array index out-of-bounds

    UBSAN gave "runtime error: index 13 out of bounds for type 'const uint32_t [10]'"
  • Loading branch information
e-n-f committed Nov 2, 2017
1 parent dc42c7c commit 41c0267
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.26.4

* Array bounds bug fix in binary to decimal conversion library

## 1.26.3

* Guard against impossible coordinates when decoding tilesets
Expand Down
3 changes: 2 additions & 1 deletion milo/dtoa_milo.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, std::strin
kappa--;
if (p2 < delta) {
*K += kappa;
GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * kPow10[-kappa]);
int index = -static_cast<int>(kappa);
GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 9 ? kPow10[-static_cast<int>(kappa)] : 0));
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define VERSION "tippecanoe v1.26.3\n"
#define VERSION "tippecanoe v1.26.4\n"

#endif

0 comments on commit 41c0267

Please sign in to comment.