Fix opportunities for integer overflow

This commit is contained in:
Eric Fischer 2018-01-18 12:37:15 -08:00
parent e07a4dd51b
commit d49606babf
5 changed files with 1932 additions and 16 deletions

View File

@ -1,3 +1,7 @@
## 1.27.6
* Fix opportunities for integer overflow and out-of-bounds references
## 1.27.5
* Add --cluster-densest-as-needed to cluster features

View File

@ -473,7 +473,11 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
}
}
sf.extent = (long long) extent;
if (extent <= LLONG_MAX) {
sf.extent = (long long) extent;
} else {
sf.extent = LLONG_MAX;
}
if (!prevent[P_INPUT_ORDER]) {
sf.seq = 0;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "tippecanoe v1.27.5\n"
#define VERSION "tippecanoe v1.27.6\n"
#endif

View File

@ -118,19 +118,11 @@ void layer_to_geojson(FILE *fp, mvt_layer const &layer, unsigned z, unsigned x,
} else if (val.type == mvt_double) {
fprintq(fp, key);
double v = val.numeric_value.double_value;
if (v == (long long) v) {
fprintf(fp, ": %lld", (long long) v);
} else {
fprintf(fp, ": %s", milo::dtoa_milo(v).c_str());
}
fprintf(fp, ": %s", milo::dtoa_milo(v).c_str());
} else if (val.type == mvt_float) {
fprintq(fp, key);
double v = val.numeric_value.float_value;
if (v == (long long) v) {
fprintf(fp, ": %lld", (long long) v);
} else {
fprintf(fp, ": %s", milo::dtoa_milo(v).c_str());
}
fprintf(fp, ": %s", milo::dtoa_milo(v).c_str());
} else if (val.type == mvt_sint) {
fprintq(fp, key);
fprintf(fp, ": %lld", val.numeric_value.sint_value);