[Git][debian-gis-team/osmpbf][master] 6 commits: New upstream version 1.7.0

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sun Jul 26 18:34:33 BST 2026



Bas Couwenberg pushed to branch master at Debian GIS Project / osmpbf


Commits:
a5f887bc by Bas Couwenberg at 2026-07-26T19:07:21+02:00
New upstream version 1.7.0
- - - - -
007f8ecf by Bas Couwenberg at 2026-07-26T19:07:21+02:00
Update upstream source from tag 'upstream/1.7.0'

Update to upstream version '1.7.0'
with Debian dir d730d11e589fa5ce459f1368eafde55818264014
- - - - -
e97d8088 by Bas Couwenberg at 2026-07-26T19:08:56+02:00
New upstream release.

- - - - -
4d284ceb by Bas Couwenberg at 2026-07-26T19:10:38+02:00
Drop java-version.patch, applied upstream.

- - - - -
758670c9 by Bas Couwenberg at 2026-07-26T19:23:06+02:00
Drop osmpbf-bin package, osmpbf-outline no longer installed.

- - - - -
4949240b by Bas Couwenberg at 2026-07-26T19:23:06+02:00
Set distribution to unstable.

- - - - -


18 changed files:

- CHANGELOG.md
- CMakeLists.txt
- README.md
- build.xml
- debian/changelog
- debian/control
- − debian/osmpbf-bin.install
- − debian/patches/java-version.patch
- − debian/patches/series
- debian/tests/control
- debian/tests/java
- − debian/tests/osmpbf-outline
- tools/.gitignore → demo/.gitignore
- tools/CMakeLists.txt → demo/CMakeLists.txt
- tools/osmpbf-outline.1 → demo/osmpbf-outline.1
- tools/osmpbf-outline.cpp → demo/osmpbf-outline.cpp
- include/osmpbf/osmpbf.h
- pom.xml


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,5 +1,13 @@
 ## Unreleased
 
+## Release notes for 1.7.0 (2026-07-26)
+
+- C++: Fix buffer overflow in osmpbf-outline tool [#95](https://github.com/openstreetmap/OSM-binary/pull/95)
+- C++: Various small code cleanups and modernizations
+- C++: osmpbf-outline tool moved to demo directory, it isn't installed by default any more. This tool was never really useful for normal users, it is more a demo/example showing how to use the library
+
+Note to packagers: You should remove the osmpbf-outline tool from packages.
+
 ## Release notes for 1.6.1 (2025-12-20)
 
 - Java: Update to latest protoc and protobuf runtime versions [#92](https://github.com/openstreetmap/OSM-binary/pull/92)


=====================================
CMakeLists.txt
=====================================
@@ -1,6 +1,8 @@
 cmake_minimum_required(VERSION 3.10)
 
-project(osmpbf VERSION 1.5.0)
+project(osmpbf VERSION 1.7.0)
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 include(GNUInstallDirs)
 
@@ -18,5 +20,5 @@ add_subdirectory(osmpbf)
 
 # The osmpbf-outline tool does not compile on Windows because getopt.h is missing
 if(NOT MSVC)
-    add_subdirectory(tools)
+    add_subdirectory(demo)
 endif()


=====================================
README.md
=====================================
@@ -70,11 +70,11 @@ To install:
 make install
 ```
 
-There is a tool named osmpbf-outline that shows a debug output of the contents
-of a PBF file. To run it:
+There is a demo tool named osmpbf-outline that shows a debug output of some of
+the contents of a PBF file. To run it:
 
 ```sh
-tools/osmpbf-outline osm-file.osm.pbf
+demo/osmpbf-outline osm-file.osm.pbf
 ```
 
 


=====================================
build.xml
=====================================
@@ -21,7 +21,7 @@
 		<exec executable="/bin/sh">
 			<arg value="./build.sh"/>
 		</exec>
-		<javac includeantruntime="false" destdir="${build.dir}">
+		<javac includeantruntime="false" destdir="${build.dir}" source="1.8" target="1.8">
 			<src path="${src.dir}"/>
 			<src path="${src.generated.dir}"/>
 			<classpath>


=====================================
debian/changelog
=====================================
@@ -1,8 +1,11 @@
-osmpbf (1.6.1-5) UNRELEASED; urgency=medium
+osmpbf (1.7.0-1) unstable; urgency=medium
 
+  * New upstream release.
   * Bump Standards-Version to 4.7.4, no changes.
+  * Drop java-version.patch, applied upstream.
+  * Drop osmpbf-bin package, osmpbf-outline no longer installed.
 
- -- Bas Couwenberg <sebastic at debian.org>  Sat, 04 Apr 2026 10:16:30 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Sun, 26 Jul 2026 19:21:31 +0200
 
 osmpbf (1.6.1-4) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -57,16 +57,3 @@ Description: C headers for OpenStreetMap PBF file format
  .
  This package provides the C headers to be used in third-party
  applications.
-
-Package: osmpbf-bin
-Architecture: any
-Section: utils
-Depends: ${shlibs:Depends},
-         ${misc:Depends}
-Description: OpenStreetMap PBF file format library - tools
- Osmpbf is a Java/C library to read and write OpenStreetMap PBF files.
- PBF (Protocol buffer Binary Format) is a binary file format for OpenStreetMap
- data that uses Google Protocol Buffers as low-level storage.
- .
- This package provides various tools to deal with OpenStreetMap PBF file
- format.


=====================================
debian/osmpbf-bin.install deleted
=====================================
@@ -1,2 +0,0 @@
-usr/bin/
-usr/share/man/man1/


=====================================
debian/patches/java-version.patch deleted
=====================================
@@ -1,16 +0,0 @@
-Description: Set Java version to 1.8 to match Maven build.
-Author: Bas Couwenberg <sebastic at debian.org>
-Forwarded: https://github.com/openstreetmap/OSM-binary/pull/93
-Applied-Upstream: https://github.com/openstreetmap/OSM-binary/commit/28f76c6bf0f341ab91fb3d62c28aeff1a0b62efe
-
---- a/build.xml
-+++ b/build.xml
-@@ -21,7 +21,7 @@
- 		<exec executable="/bin/sh">
- 			<arg value="./build.sh"/>
- 		</exec>
--		<javac includeantruntime="false" destdir="${build.dir}">
-+		<javac includeantruntime="false" destdir="${build.dir}" source="1.8" target="1.8">
- 			<src path="${src.dir}"/>
- 			<src path="${src.generated.dir}"/>
- 			<classpath>


=====================================
debian/patches/series deleted
=====================================
@@ -1 +0,0 @@
-java-version.patch


=====================================
debian/tests/control
=====================================
@@ -4,9 +4,3 @@ Depends: ca-certificates,
          libosmpbf-java,
          wget
 Restrictions: needs-internet
-
-Tests: osmpbf-outline
-Depends: ca-certificates,
-         osmpbf-bin,
-         wget
-Restrictions: needs-internet


=====================================
debian/tests/java
=====================================
@@ -6,8 +6,8 @@ CLASSPATH="."
 CLASSPATH="${CLASSPATH}:/usr/share/java/osmpbf.jar"
 CLASSPATH="${CLASSPATH}:/usr/share/java/protobuf.jar"
 
-DATASET_URL="https://download.geofabrik.de/europe/andorra-latest.osm.pbf"
-DATASET_FILE="andorra-latest.osm.pbf"
+DATASET_URL="https://download.geofabrik.de/europe/monaco-latest.osm.pbf"
+DATASET_FILE="monaco-latest.osm.pbf"
 
 JAVA_VERSION="$(javac --version | cut -d' ' -f2)"
 


=====================================
debian/tests/osmpbf-outline deleted
=====================================
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-DATASET_URL="https://download.geofabrik.de/europe/monaco-latest.osm.pbf"
-DATASET_FILE="monaco-latest.osm.pbf"
-
-TEMPDIR="$(mktemp -d)"
-
-cd "${TEMPDIR}" || exit 1
-
-CMD=("wget" "-q" "${DATASET_URL}" "-O" "${DATASET_FILE}")
-
-echo "Downloading dataset: ${CMD[@]}"
-${CMD[@]}
-RC=$?
-
-if [ "${RC}" -ne 0 ]; then
-    cd "${OLDPWD}" || exit 1
-    rm -rf "${TEMPDIR}"
-
-    exit "${RC}"
-fi
-
-CMD=("osmpbf-outline" "--color" "${DATASET_FILE}")
-
-echo -e "\nExecuting: ${CMD[@]}"
-${CMD[@]}
-RC=$?
-
-cd "${OLDPWD}" || exit 1
-rm -rf "${TEMPDIR}"
-
-exit "${RC}"


=====================================
tools/.gitignore → demo/.gitignore
=====================================


=====================================
tools/CMakeLists.txt → demo/CMakeLists.txt
=====================================
@@ -12,5 +12,5 @@ target_include_directories(osmpbf-outline SYSTEM PRIVATE ${ZLIB_INCLUDE_DIR})
 target_link_libraries(osmpbf-outline PRIVATE osmpbf ZLIB::ZLIB protobuf::libprotobuf)
 set_property(TARGET osmpbf-outline PROPERTY CXX_STANDARD 11)
 
-install(TARGETS osmpbf-outline RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-install(FILES osmpbf-outline.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+#install(TARGETS osmpbf-outline RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+#install(FILES osmpbf-outline.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)


=====================================
tools/osmpbf-outline.1 → demo/osmpbf-outline.1
=====================================


=====================================
tools/osmpbf-outline.cpp → demo/osmpbf-outline.cpp
=====================================
@@ -2,10 +2,10 @@
 #include <unistd.h>
 
 // used for va_list in debug-print methods
-#include <stdarg.h>
+#include <cstdarg>
 
 // file io lib
-#include <stdio.h>
+#include <cstdio>
 
 // getopt is used to check for the --color-flag
 #include <getopt.h>
@@ -23,47 +23,31 @@
 // this is the header to pbf format
 #include <osmpbf/osmpbf.h>
 
+namespace {
+
 // should the output use color?
 bool usecolor = false;
 
-// buffer for reading a compressed blob from file
-char buffer[OSMPBF::max_uncompressed_blob_size];
-
-// buffer for decompressing the blob
-char unpack_buffer[OSMPBF::max_uncompressed_blob_size];
-
-// pbf struct of a BlobHeader
-OSMPBF::BlobHeader blobheader;
-
-// pbf struct of a Blob
-OSMPBF::Blob blob;
-
-// pbf struct of an OSM HeaderBlock
-OSMPBF::HeaderBlock headerblock;
-
-// pbf struct of an OSM PrimitiveBlock
-OSMPBF::PrimitiveBlock primblock;
-
 // prints a formatted message to stdout, optionally color coded
 void msg(const char* format, int color, va_list args) {
     if (usecolor) {
-        fprintf(stdout, "\x1b[0;%dm", color);
+        std::fprintf(stdout, "\x1b[0;%dm", color);
     }
-    vfprintf(stdout, format, args);
+    std::vfprintf(stdout, format, args);
     if (usecolor) {
-        fprintf(stdout, "\x1b[0m\n");
+        std::fprintf(stdout, "\x1b[0m\n");
     } else {
-        fprintf(stdout, "\n");
+        std::fprintf(stdout, "\n");
     }
 }
 
 // prints a formatted message to stdout, color coded to red
-void err(const char* format, ...) {
+[[noreturn]] void err(const char* format, ...) {
     va_list args;
     va_start(args, format);
     msg(format, 31, args);
     va_end(args);
-    exit(1);
+    std::exit(1);
 }
 
 // prints a formatted message to stdout, color coded to yellow
@@ -90,23 +74,25 @@ void debug(const char* format, ...) {
     va_end(args);
 }
 
+} // anonymous namespace
+
 // application main method
 int main(int argc, char *argv[]) {
     // check if the output is a tty so we can use colors
 
 #ifdef WIN32
-    usecolor = 0;
+    usecolor = false;
 #else
     usecolor = isatty(1);
 #endif
 
-    static struct option long_options[] = {
-        {"color", no_argument, 0, 'c'},
-        {0, 0, 0, 0}
+    option const long_options[] = {
+        {"color", no_argument, nullptr, 'c'},
+        {nullptr, 0, nullptr, 0}
     };
 
-    while (1) {
-        int c = getopt_long(argc, argv, "c", long_options, 0);
+    while (true) {
+        int const c = getopt_long(argc, argv, "c", long_options, nullptr);
 
         if (c == -1) {
             break;
@@ -117,7 +103,7 @@ int main(int argc, char *argv[]) {
                 usecolor = true;
                 break;
             default:
-                exit(1);
+                return 1;
         }
     }
 
@@ -127,19 +113,25 @@ int main(int argc, char *argv[]) {
     }
 
     // open specified file
-    FILE *fp = fopen(argv[optind], "rb");
+    FILE *fp = std::fopen(argv[optind], "rb");
 
     if (!fp) {
         err("can't open file '%s'", argv[optind]);
     }
 
+    // buffer for reading a compressed blob from file
+    static char buffer[OSMPBF::max_uncompressed_blob_size];
+
+    // buffer for decompressing the blob
+    static char unpack_buffer[OSMPBF::max_uncompressed_blob_size];
+
     // read while the file has not reached its end
-    while (!feof(fp)) {
+    while (!std::feof(fp)) {
         // storage of size, used multiple times
-        int32_t sz;
+        std::uint32_t sz = 0;
 
         // read the first 4 bytes of the file, this is the size of the blob-header
-        if (fread(&sz, sizeof(sz), 1, fp) != 1) {
+        if (std::fread(&sz, sizeof(sz), 1, fp) != 1) {
             break; // end of file reached
         }
 
@@ -152,12 +144,15 @@ int main(int argc, char *argv[]) {
         }
 
         // read the blob-header from the file
-        if (fread(buffer, sz, 1, fp) != 1) {
+        if (std::fread(buffer, sz, 1, fp) != 1) {
             err("unable to read blob-header from file");
         }
 
+        // pbf struct of a BlobHeader
+        OSMPBF::BlobHeader blobheader;
+
         // parse the blob-header from the read-buffer
-        if (!blobheader.ParseFromArray(buffer, sz)) {
+        if (!blobheader.ParseFromArray(buffer, static_cast<int>(sz))) {
             err("unable to parse blob header");
         }
 
@@ -180,12 +175,15 @@ int main(int argc, char *argv[]) {
         }
 
         // read the blob from the file
-        if (fread(buffer, sz, 1, fp) != 1) {
+        if (std::fread(buffer, sz, 1, fp) != 1) {
             err("unable to read blob from file");
         }
 
+        // pbf struct of a Blob
+        OSMPBF::Blob blob;
+
         // parse the blob from the read-buffer
-        if (!blob.ParseFromArray(buffer, sz)) {
+        if (!blob.ParseFromArray(buffer, static_cast<int>(sz))) {
             err("unable to parse blob");
         }
 
@@ -204,15 +202,15 @@ int main(int argc, char *argv[]) {
             sz = blob.raw().size();
 
             // check that raw_size is set correctly
-            if (sz != blob.raw_size()) {
-                warn("  reports wrong raw_size: %u bytes", blob.raw_size());
+            if (sz != static_cast<std::uint32_t>(blob.raw_size())) {
+                warn("  reports wrong raw_size: %d bytes", blob.raw_size());
             }
 
             // tell about the blob-data
             debug("  contains uncompressed data: %u bytes", sz);
 
             // copy the uncompressed data over to the unpack_buffer
-            memcpy(unpack_buffer, buffer, sz);
+            std::memcpy(unpack_buffer, buffer, sz);
         }
 
         // if the blob has zlib-compressed data
@@ -232,6 +230,12 @@ int main(int argc, char *argv[]) {
             debug("  contains zlib-compressed data: %u bytes", sz);
             debug("  uncompressed size: %u bytes", blob.raw_size());
 
+            // ensure the raw_size fits into the unpack_buffer, otherwise
+            // zlib would inflate past the end of the fixed-size buffer
+            if (blob.raw_size() < 0 || blob.raw_size() > OSMPBF::max_uncompressed_blob_size) {
+                err("  raw_size is bigger then allowed (%d > %u)", blob.raw_size(), OSMPBF::max_uncompressed_blob_size);
+            }
+
             // zlib information
             z_stream z;
 
@@ -273,9 +277,6 @@ int main(int argc, char *argv[]) {
                 warn("  contains several data streams");
             }
 
-            // we have at least one datastream
-            found_data = true;
-
             // tell about the compressed data
             debug("  contains lzma-compressed data: %u bytes", blob.lzma_data().size());
             debug("  uncompressed size: %u bytes", blob.raw_size());
@@ -284,6 +285,36 @@ int main(int argc, char *argv[]) {
             err("  lzma-decompression is not supported");
         }
 
+        // if the blob has lz4-compressed data
+        if (blob.has_lz4_data()) {
+            // issue a warning if there is more than one data steam, a blob may only contain one data stream
+            if (found_data) {
+                warn("  contains several data streams");
+            }
+
+            // tell about the compressed data
+            debug("  contains lz4-compressed data: %u bytes", blob.lz4_data().size());
+            debug("  uncompressed size: %u bytes", blob.raw_size());
+
+            // issue a warning, lz4 compression is not yet supported
+            err("  lz4-decompression is not supported");
+        }
+
+        // if the blob has zstd-compressed data
+        if (blob.has_zstd_data()) {
+            // issue a warning if there is more than one data steam, a blob may only contain one data stream
+            if (found_data) {
+                warn("  contains several data streams");
+            }
+
+            // tell about the compressed data
+            debug("  contains zstd-compressed data: %u bytes", blob.zstd_data().size());
+            debug("  uncompressed size: %u bytes", blob.raw_size());
+
+            // issue a warning, zstd compression is not yet supported
+            err("  zstd-decompression is not supported");
+        }
+
         // check we have at least one data-stream
         if (!found_data) {
             err("  does not contain any known data stream");
@@ -294,28 +325,31 @@ int main(int argc, char *argv[]) {
             // tell about the OSMHeader blob
             info("  OSMHeader");
 
+            // pbf struct of an OSM HeaderBlock
+            OSMPBF::HeaderBlock headerblock;
+
             // parse the HeaderBlock from the blob
-            if (!headerblock.ParseFromArray(unpack_buffer, sz)) {
+            if (!headerblock.ParseFromArray(unpack_buffer, static_cast<int>(sz))) {
                 err("unable to parse header block");
             }
 
             // tell about the bbox
             if (headerblock.has_bbox()) {
-                OSMPBF::HeaderBBox bbox = headerblock.bbox();
+                OSMPBF::HeaderBBox const& bbox = headerblock.bbox();
                 debug("    bbox: %.7f,%.7f,%.7f,%.7f",
-                    (double)bbox.left() / OSMPBF::lonlat_resolution,
-                    (double)bbox.bottom() / OSMPBF::lonlat_resolution,
-                    (double)bbox.right() / OSMPBF::lonlat_resolution,
-                    (double)bbox.top() / OSMPBF::lonlat_resolution);
+                    static_cast<double>(bbox.left()) / OSMPBF::lonlat_resolution,
+                    static_cast<double>(bbox.bottom()) / OSMPBF::lonlat_resolution,
+                    static_cast<double>(bbox.right()) / OSMPBF::lonlat_resolution,
+                    static_cast<double>(bbox.top()) / OSMPBF::lonlat_resolution);
             }
 
             // tell about the required features
-            for (int i = 0, l = headerblock.required_features_size(); i < l; i++) {
+            for (int i = 0, l = headerblock.required_features_size(); i < l; ++i) {
                 debug("    required_feature: %s", headerblock.required_features(i).c_str());
             }
 
             // tell about the optional features
-            for (int i = 0, l = headerblock.optional_features_size(); i < l; i++) {
+            for (int i = 0, l = headerblock.optional_features_size(); i < l; ++i) {
                 debug("    optional_feature: %s", headerblock.optional_features(i).c_str());
             }
 
@@ -332,8 +366,11 @@ int main(int argc, char *argv[]) {
             // tell about the OSMData blob
             info("  OSMData");
 
+            // pbf struct of an OSM PrimitiveBlock
+            OSMPBF::PrimitiveBlock primblock;
+
             // parse the PrimitiveBlock from the blob
-            if (!primblock.ParseFromArray(unpack_buffer, sz)) {
+            if (!primblock.ParseFromArray(unpack_buffer, static_cast<int>(sz))) {
                 err("unable to parse primitive block");
             }
 
@@ -350,11 +387,11 @@ int main(int argc, char *argv[]) {
             debug("    primitivegroups: %u groups", primblock.primitivegroup_size());
 
             // iterate over all PrimitiveGroups
-            for (int i = 0, l = primblock.primitivegroup_size(); i < l; i++) {
+            for (int i = 0, l = primblock.primitivegroup_size(); i < l; ++i) {
                 // one PrimitiveGroup from the the Block
-                OSMPBF::PrimitiveGroup pg = primblock.primitivegroup(i);
+                OSMPBF::PrimitiveGroup const& pg = primblock.primitivegroup(i);
 
-                bool found_items=false;
+                bool found_items = false;
 
                 // tell about nodes
                 if (pg.nodes_size() > 0) {
@@ -409,7 +446,7 @@ int main(int argc, char *argv[]) {
     }
 
     // close the file pointer
-    fclose(fp);
+    std::fclose(fp);
 
     // clean up the protobuf lib
     google::protobuf::ShutdownProtobufLibrary();


=====================================
include/osmpbf/osmpbf.h
=====================================
@@ -18,7 +18,7 @@
 // this describes the high-level OSM objects
 #include <osmpbf/osmformat.pb.h> // IWYU pragma: export
 
-#define OSMPBF_VERSION "1.5.0"
+#define OSMPBF_VERSION "1.7.0"
 
 namespace OSMPBF {
 


=====================================
pom.xml
=====================================
@@ -6,7 +6,7 @@
   <groupId>org.openstreetmap.pbf</groupId>
   <artifactId>osmpbf</artifactId>
   <packaging>jar</packaging>
-  <version>1.6.1</version>
+  <version>1.7.0</version>
   <name>OSM-Binary</name>
   <description>Library for the OpenStreetMap PBF format</description>
   <url>https://github.com/openstreetmap/OSM-binary</url>



View it on GitLab: https://salsa.debian.org/debian-gis-team/osmpbf/-/compare/56edc7dd7f897bf1a72edad62b723950a80d7aa5...4949240b4d81adae665988d04c99d5c52ab54bea

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/osmpbf/-/compare/56edc7dd7f897bf1a72edad62b723950a80d7aa5...4949240b4d81adae665988d04c99d5c52ab54bea
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20260726/171ea126/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list