Bug#861788: unblock: libosmium/2.11.3-1

Bas Couwenberg sebastic at xs4all.nl
Thu May 4 05:10:46 UTC 2017


Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock

Please unblock package libosmium

Upstream has only fixed bugs for this release in line with the freeze
policy.

(include/attach the debdiff against the package in testing)

unblock libosmium/2.11.3-1

Kind Regards,

Bas
-------------- next part --------------
diff -Nru libosmium-2.11.1/CHANGELOG.md libosmium-2.11.3/CHANGELOG.md
--- libosmium-2.11.1/CHANGELOG.md	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/CHANGELOG.md	2017-05-03 14:01:48.000000000 +0200
@@ -8,6 +8,24 @@
 
 ### Fixed
 
+## [2.11.3] - 2017-05-03
+
+### Fixed
+
+- Two bugs in area assembler affecting very complex multipolygons and
+  multipolygons with overlapping or nearly overlapping lines.
+- Invalid use of iterators leading to undefined behaviour in area assembler
+  code.
+- Read OPL file correctly even if trailing newline in file is missing.
+
+
+## [2.11.2] - 2017-04-10
+
+### Fixed
+
+- Use minimum size of 64 bytes for buffers. This fixes an infinite loop
+  when buffer size is zero.
+
 
 ## [2.11.1] - 2017-03-07
 
@@ -531,7 +549,9 @@
   Doxygen (up to version 1.8.8). This version contains a workaround to fix
   this.
 
-[unreleased]: https://github.com/osmcode/libosmium/compare/v2.11.1...HEAD
+[unreleased]: https://github.com/osmcode/libosmium/compare/v2.11.3...HEAD
+[2.11.3]: https://github.com/osmcode/libosmium/compare/v2.11.2...v2.11.3
+[2.11.2]: https://github.com/osmcode/libosmium/compare/v2.11.1...v2.11.2
 [2.11.1]: https://github.com/osmcode/libosmium/compare/v2.11.0...v2.11.1
 [2.11.0]: https://github.com/osmcode/libosmium/compare/v2.10.3...v2.11.0
 [2.10.3]: https://github.com/osmcode/libosmium/compare/v2.10.2...v2.10.3
diff -Nru libosmium-2.11.1/CMakeLists.txt libosmium-2.11.3/CMakeLists.txt
--- libosmium-2.11.1/CMakeLists.txt	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/CMakeLists.txt	2017-05-03 14:01:48.000000000 +0200
@@ -25,7 +25,7 @@
 
 set(LIBOSMIUM_VERSION_MAJOR 2)
 set(LIBOSMIUM_VERSION_MINOR 11)
-set(LIBOSMIUM_VERSION_PATCH 1)
+set(LIBOSMIUM_VERSION_PATCH 3)
 
 set(LIBOSMIUM_VERSION
     "${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
diff -Nru libosmium-2.11.1/debian/changelog libosmium-2.11.3/debian/changelog
--- libosmium-2.11.1/debian/changelog	2017-03-07 18:31:00.000000000 +0100
+++ libosmium-2.11.3/debian/changelog	2017-05-03 18:44:44.000000000 +0200
@@ -1,3 +1,17 @@
+libosmium (2.11.3-1) unstable; urgency=medium
+
+  * New upstream bugfix release.
+    - Use minimum size of 64 bytes for buffers. This fixes an infinite
+      loop when buffer size is zero.
+    - Two bugs in area assembler affecting very complex multipolygons and
+      multipolygons with overlapping or nearly overlapping lines.
+    - Invalid use of iterators leading to undefined behaviour in area
+      assembler code.
+    - Read OPL file correctly even if trailing newline in file is missing.
+  * Update watch file to limit results to 2.11.x releases.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 03 May 2017 18:44:44 +0200
+
 libosmium (2.11.1-1) unstable; urgency=medium
 
   * New upstream bugfix release.
diff -Nru libosmium-2.11.1/debian/watch libosmium-2.11.3/debian/watch
--- libosmium-2.11.1/debian/watch	2017-03-07 18:23:24.000000000 +0100
+++ libosmium-2.11.3/debian/watch	2017-05-03 18:38:25.000000000 +0200
@@ -4,4 +4,4 @@
 uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
 filenamemangle=s/(?:.*\/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/libosmium-$1.$2/ \
 https://github.com/osmcode/libosmium/releases \
-(?:.*/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+(?:.*/)?(?:rel|v|libosmium)[\-\_]?(2\.11\.\d[\d\-\.]*)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff -Nru libosmium-2.11.1/include/osmium/area/assembler.hpp libosmium-2.11.3/include/osmium/area/assembler.hpp
--- libosmium-2.11.1/include/osmium/area/assembler.hpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/include/osmium/area/assembler.hpp	2017-05-03 14:01:48.000000000 +0200
@@ -474,17 +474,17 @@
 
             class rings_stack_element {
 
-                int32_t m_y;
+                double m_y;
                 detail::ProtoRing* m_ring_ptr;
 
             public:
 
-                rings_stack_element(int32_t y, detail::ProtoRing* ring_ptr) :
+                rings_stack_element(double y, detail::ProtoRing* ring_ptr) :
                     m_y(y),
                     m_ring_ptr(ring_ptr) {
                 }
 
-                int32_t y() const noexcept {
+                double y() const noexcept {
                     return m_y;
                 }
 
@@ -504,7 +504,7 @@
                     return m_y < rhs.m_y;
                 }
 
-            }; // class ring_stack_element
+            }; // class rings_stack_element
 
             using rings_stack = std::vector<rings_stack_element>;
 
@@ -592,7 +592,7 @@
                                 if (debug()) {
                                     std::cerr << "        Segment belongs to outer ring\n";
                                 }
-                                const int32_t y = int32_t(ay + (by - ay) * (lx - ax) / (bx - ax));
+                                const double y = ay + (by - ay) * (lx - ax) / double(bx - ax);
                                 outer_rings.emplace_back(y, segment->ring());
                             }
                         }
@@ -859,8 +859,8 @@
             }
 
             void merge_two_rings(open_ring_its_type& open_ring_its, const location_to_ring_map& m1, const location_to_ring_map& m2) {
-                auto& r1 = *m1.ring_it;
-                auto& r2 = *m2.ring_it;
+                std::list<detail::ProtoRing>::iterator r1 = *m1.ring_it;
+                std::list<detail::ProtoRing>::iterator r2 = *m2.ring_it;
 
                 if (r1->get_node_ref_stop().location() == r2->get_node_ref_start().location()) {
                     r1->join_forward(*r2);
@@ -876,11 +876,11 @@
                     assert(false);
                 }
 
+                open_ring_its.erase(std::find(open_ring_its.begin(), open_ring_its.end(), r2));
                 m_rings.erase(r2);
-                open_ring_its.remove(r2);
 
                 if (r1->closed()) {
-                    open_ring_its.remove(r1);
+                    open_ring_its.erase(std::find(open_ring_its.begin(), open_ring_its.end(), r1));
                 }
             }
 
@@ -988,6 +988,7 @@
                             }
                             loc_done.insert(c.stop_location);
                             find_candidates(candidates, loc_done, xrings, c);
+                            loc_done.erase(c.stop_location);
                             if (debug()) {
                                 std::cerr << "          ...back\n";
                             }
@@ -1085,12 +1086,13 @@
                 // Join all (open) rings in the candidate to get one closed ring.
                 assert(chosen_cand->rings.size() > 1);
                 const auto& first_ring = chosen_cand->rings.front().first;
-                for (auto it = chosen_cand->rings.begin() + 1; it != chosen_cand->rings.end(); ++it) {
+                const detail::ProtoRing& remaining_ring = first_ring.ring();
+                for (auto it = std::next(chosen_cand->rings.begin()); it != chosen_cand->rings.end(); ++it) {
                     merge_two_rings(open_ring_its, first_ring, it->first);
                 }
 
                 if (debug()) {
-                    std::cerr << "    Merged to " << first_ring.ring() << "\n";
+                    std::cerr << "    Merged to " << remaining_ring << "\n";
                 }
 
                 return true;
diff -Nru libosmium-2.11.1/include/osmium/io/detail/opl_input_format.hpp libosmium-2.11.3/include/osmium/io/detail/opl_input_format.hpp
--- libosmium-2.11.1/include/osmium/io/detail/opl_input_format.hpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/include/osmium/io/detail/opl_input_format.hpp	2017-05-03 14:01:48.000000000 +0200
@@ -123,6 +123,11 @@
                         rest = input.substr(ppos);
                     }
 
+                    if (!rest.empty()) {
+                        m_data = rest.data();
+                        parse_line();
+                    }
+
                     if (m_buffer.committed() > 0) {
                         send_to_output_queue(std::move(m_buffer));
                     }
diff -Nru libosmium-2.11.1/include/osmium/memory/buffer.hpp libosmium-2.11.3/include/osmium/memory/buffer.hpp
--- libosmium-2.11.1/include/osmium/memory/buffer.hpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/include/osmium/memory/buffer.hpp	2017-05-03 14:01:48.000000000 +0200
@@ -119,6 +119,15 @@
             auto_grow m_auto_grow{auto_grow::no};
             std::function<void(Buffer&)> m_full;
 
+            static size_t calculate_capacity(size_t capacity) noexcept {
+                // The majority of all Nodes will fit into this size.
+                constexpr static const size_t min_capacity = 64;
+                if (capacity < min_capacity) {
+                    return min_capacity;
+                }
+                return capacity;
+            }
+
         public:
 
             /**
@@ -198,13 +207,13 @@
              *         of the alignment.
              */
             explicit Buffer(size_t capacity, auto_grow auto_grow = auto_grow::yes) :
-                m_memory(new unsigned char[capacity]),
+                m_memory(new unsigned char[calculate_capacity(capacity)]),
                 m_data(m_memory.get()),
-                m_capacity(capacity),
+                m_capacity(calculate_capacity(capacity)),
                 m_written(0),
                 m_committed(0),
                 m_auto_grow(auto_grow) {
-                if (capacity % align_bytes != 0) {
+                if (m_capacity % align_bytes != 0) {
                     throw std::invalid_argument("buffer capacity needs to be multiple of alignment");
                 }
             }
diff -Nru libosmium-2.11.1/include/osmium/version.hpp libosmium-2.11.3/include/osmium/version.hpp
--- libosmium-2.11.1/include/osmium/version.hpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/include/osmium/version.hpp	2017-05-03 14:01:48.000000000 +0200
@@ -35,8 +35,8 @@
 
 #define LIBOSMIUM_VERSION_MAJOR 2
 #define LIBOSMIUM_VERSION_MINOR 11
-#define LIBOSMIUM_VERSION_PATCH 1
+#define LIBOSMIUM_VERSION_PATCH 3
 
-#define LIBOSMIUM_VERSION_STRING "2.11.1"
+#define LIBOSMIUM_VERSION_STRING "2.11.3"
 
 #endif // OSMIUM_VERSION_HPP
diff -Nru libosmium-2.11.1/test/CMakeLists.txt libosmium-2.11.3/test/CMakeLists.txt
--- libosmium-2.11.1/test/CMakeLists.txt	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/test/CMakeLists.txt	2017-05-03 14:01:48.000000000 +0200
@@ -170,7 +170,7 @@
 add_unit_test(io test_reader_fileformat ENABLE_IF ${Threads_FOUND} LIBS ${CMAKE_THREAD_LIBS_INIT})
 add_unit_test(io test_reader_with_mock_decompression ENABLE_IF ${Threads_FOUND} LIBS ${OSMIUM_XML_LIBRARIES})
 add_unit_test(io test_reader_with_mock_parser ENABLE_IF ${Threads_FOUND} LIBS ${CMAKE_THREAD_LIBS_INIT})
-add_unit_test(io test_opl_parser)
+add_unit_test(io test_opl_parser ENABLE_IF ${Threads_FOUND} LIBS ${CMAKE_THREAD_LIBS_INIT})
 add_unit_test(io test_output_utils)
 add_unit_test(io test_output_iterator ENABLE_IF ${Threads_FOUND} LIBS ${CMAKE_THREAD_LIBS_INIT})
 add_unit_test(io test_string_table)
diff -Nru libosmium-2.11.1/test/t/io/data-nonl.opl libosmium-2.11.3/test/t/io/data-nonl.opl
--- libosmium-2.11.1/test/t/io/data-nonl.opl	1970-01-01 01:00:00.000000000 +0100
+++ libosmium-2.11.3/test/t/io/data-nonl.opl	2017-05-03 14:01:48.000000000 +0200
@@ -0,0 +1 @@
+n1 v1 dV c1 t2014-01-01T00:00:00Z i1 utest T x1.02 y1.02
\ No newline at end of file
diff -Nru libosmium-2.11.1/test/t/io/data.opl libosmium-2.11.3/test/t/io/data.opl
--- libosmium-2.11.1/test/t/io/data.opl	1970-01-01 01:00:00.000000000 +0100
+++ libosmium-2.11.3/test/t/io/data.opl	2017-05-03 14:01:48.000000000 +0200
@@ -0,0 +1 @@
+n1 v1 dV c1 t2014-01-01T00:00:00Z i1 utest T x1.02 y1.02
diff -Nru libosmium-2.11.1/test/t/io/test_opl_parser.cpp libosmium-2.11.3/test/t/io/test_opl_parser.cpp
--- libosmium-2.11.1/test/t/io/test_opl_parser.cpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/test/t/io/test_opl_parser.cpp	2017-05-03 14:01:48.000000000 +0200
@@ -3,8 +3,10 @@
 #include <cstring>
 
 #include "catch.hpp"
+#include "utils.hpp"
 
 #include <osmium/io/detail/opl_input_format.hpp>
+#include <osmium/io/opl_input.hpp>
 #include <osmium/opl.hpp>
 
 namespace oid = osmium::io::detail;
@@ -1073,3 +1075,23 @@
 
 }
 
+TEST_CASE("Parse OPL using Reader") {
+    osmium::io::File file{with_data_dir("t/io/data.opl")};
+    osmium::io::Reader reader{file};
+
+    const auto buffer = reader.read();
+    REQUIRE(buffer);
+    const auto& node = buffer.get<osmium::Node>(0);
+    REQUIRE(node.id() == 1);
+}
+
+TEST_CASE("Parse OPL with missing newline using Reader") {
+    osmium::io::File file{with_data_dir("t/io/data-nonl.opl")};
+    osmium::io::Reader reader{file};
+
+    const auto buffer = reader.read();
+    REQUIRE(buffer);
+    const auto& node = buffer.get<osmium::Node>(0);
+    REQUIRE(node.id() == 1);
+}
+
diff -Nru libosmium-2.11.1/test/t/memory/test_buffer_basics.cpp libosmium-2.11.3/test/t/memory/test_buffer_basics.cpp
--- libosmium-2.11.1/test/t/memory/test_buffer_basics.cpp	2017-03-07 13:54:48.000000000 +0100
+++ libosmium-2.11.3/test/t/memory/test_buffer_basics.cpp	2017-05-03 14:01:48.000000000 +0200
@@ -6,8 +6,8 @@
 
     osmium::memory::Buffer invalid_buffer1;
     osmium::memory::Buffer invalid_buffer2;
-    osmium::memory::Buffer empty_buffer1(1024);
-    osmium::memory::Buffer empty_buffer2(2048);
+    osmium::memory::Buffer empty_buffer1{1024};
+    osmium::memory::Buffer empty_buffer2{2048};
 
     REQUIRE(!invalid_buffer1);
     REQUIRE(!invalid_buffer2);
@@ -32,3 +32,18 @@
 
 }
 
+TEST_CASE("Buffer with zero size") {
+    osmium::memory::Buffer buffer{0};
+    REQUIRE(buffer.capacity() == 64);
+}
+
+TEST_CASE("Buffer with less than minimum size") {
+    osmium::memory::Buffer buffer{63};
+    REQUIRE(buffer.capacity() == 64);
+}
+
+TEST_CASE("Buffer with minimum size") {
+    osmium::memory::Buffer buffer{64};
+    REQUIRE(buffer.capacity() == 64);
+}
+


More information about the Pkg-grass-devel mailing list