Merge pull request #515 from mapbox/vector-bounds

Fix out-of-bounds error when no threads were needed for a zoom level
This commit is contained in:
Eric Fischer 2018-01-19 10:27:20 -08:00 committed by GitHub
commit 21b9b1993f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1950 additions and 17 deletions

View File

@ -43,7 +43,7 @@ matrix:
# debug+leak+address-sanitizer build
- os: linux
compiler: clang
env: CLANG_VERSION='3.8.0' BUILDTYPE=Debug ASAN_OPTIONS=detect_leaks=1 CC="clang-3.8" CXX="clang++-3.8" CXXFLAGS="-fsanitize=address" CFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" FEWER=true
env: CLANG_VERSION='3.8.0' BUILDTYPE=Debug ASAN_OPTIONS=detect_leaks=1 CC="clang-3.8" CXX="clang++-3.8" CXXFLAGS="-fsanitize=address,undefined" CFLAGS="-fsanitize=address,undefined" LDFLAGS="-fsanitize=address,undefined" FEWER=true
addons:
apt:
sources: ['ubuntu-toolchain-r-test' ]

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

@ -0,0 +1,13 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-180.000000,0.800000,180.000000,1.000000",
"center": "-179.989014,1.000000,14",
"description": "tests/onefeature/-zg_--drop-densest-as-needed.json.check.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 14, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
"maxzoom": "14",
"minzoom": "0",
"name": "tests/onefeature/-zg_--drop-densest-as-needed.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
] }

1
tests/onefeature/in.json Normal file
View File

@ -0,0 +1 @@
{"":"","":[{"":"","":{"":[]},"":{"":""}},{"":"","type":"LineString","coordinates":[[1000,0.8],[900,1]]}

View File

@ -2363,6 +2363,9 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
if (threads >= (1U << 30)) {
threads = 1U << 30;
}
if (threads < 1) {
threads = 1;
}
// Assign temporary files to threads

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);