import libpmemobj-cpp-1.12-8.el9
This commit is contained in:
parent
a9bca8eca0
commit
641084a666
73
SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch
Normal file
73
SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch
Normal file
@ -0,0 +1,73 @@
|
||||
diff --git a/include/libpmemobj++/container/vector.hpp b/include/libpmemobj++/container/vector.hpp
|
||||
--- a/include/libpmemobj++/container/vector.hpp
|
||||
+++ b/include/libpmemobj++/container/vector.hpp
|
||||
@@ -668,7 +668,7 @@ vector<T>::assign(size_type count, const_reference value)
|
||||
add_data_to_tx(0, size_old);
|
||||
|
||||
std::fill_n(
|
||||
- &_data[0],
|
||||
+ _data.get(),
|
||||
(std::min)(count,
|
||||
static_cast<size_type>(size_old)),
|
||||
value);
|
||||
@@ -1600,7 +1600,7 @@ vector<T>::insert(const_iterator pos, size_type count, const value_type &value)
|
||||
single_element_iterator<value_type>(&value, count));
|
||||
});
|
||||
|
||||
- return iterator(&_data[static_cast<difference_type>(idx)]);
|
||||
+ return iterator(_data.get() + static_cast<difference_type>(idx));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1843,7 +1843,7 @@ typename vector<T>::iterator
|
||||
vector<T>::erase(const_iterator first, const_iterator last)
|
||||
{
|
||||
size_type idx = static_cast<size_type>(
|
||||
- std::distance(const_iterator(&_data[0]), first));
|
||||
+ std::distance(const_iterator(_data.get()), first));
|
||||
size_type count = static_cast<size_type>(std::distance(first, last));
|
||||
|
||||
if (count == 0)
|
||||
@@ -2306,10 +2306,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
|
||||
auto count = static_cast<size_type>(std::distance(first, last));
|
||||
|
||||
if (_capacity >= size() + count) {
|
||||
- pointer dest =
|
||||
- &_data[static_cast<difference_type>(size() + count)];
|
||||
- pointer begin = &_data[static_cast<difference_type>(idx)];
|
||||
- pointer end = &_data[static_cast<difference_type>(size())];
|
||||
+ pointer dest = _data.get() +
|
||||
+ static_cast<difference_type>(size() + count);
|
||||
+ pointer begin = _data.get() + static_cast<difference_type>(idx);
|
||||
+ pointer end =
|
||||
+ _data.get() + static_cast<difference_type>(size());
|
||||
|
||||
add_data_to_tx(idx, size() - idx + count);
|
||||
|
||||
@@ -2327,9 +2328,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
|
||||
|
||||
auto old_data = _data;
|
||||
auto old_size = _size;
|
||||
- pointer old_begin = &_data[0];
|
||||
- pointer old_mid = &_data[static_cast<difference_type>(idx)];
|
||||
- pointer old_end = &_data[static_cast<difference_type>(size())];
|
||||
+ pointer old_begin = _data.get();
|
||||
+ pointer old_mid =
|
||||
+ _data.get() + static_cast<difference_type>(idx);
|
||||
+ pointer old_end =
|
||||
+ _data.get() + static_cast<difference_type>(size());
|
||||
|
||||
_data = nullptr;
|
||||
_size = _capacity = 0;
|
||||
@@ -2397,7 +2400,7 @@ vector<T>::realloc(size_type capacity_new)
|
||||
|
||||
auto old_data = _data;
|
||||
auto old_size = _size;
|
||||
- pointer old_begin = &_data[0];
|
||||
+ pointer old_begin = _data.get();
|
||||
pointer old_end = capacity_new < _size
|
||||
? &_data[static_cast<difference_type>(capacity_new)]
|
||||
: &_data[static_cast<difference_type>(size())];
|
||||
--
|
||||
2.27.0
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Name: libpmemobj-cpp
|
||||
Version: 1.12
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: C++ bindings for libpmemobj
|
||||
# Note: tests/external/libcxx is dual licensed using University of Illinois "BSD-Like" license and the MIT license. It's used only during development/testing and is NOT part of the binary RPM.
|
||||
License: BSD
|
||||
@ -13,6 +13,7 @@ URL: http://pmem.io/pmdk/cpp_obj/
|
||||
Source0: https://github.com/pmem/%{name}/archive/%{upstreamversion}.tar.gz#/%{name}-%{upstreamversion}.tar.gz
|
||||
|
||||
Patch0: 0001-vector-Fix-undefined-behaviour-on-realloc.patch
|
||||
Patch1: 0002-vector-fix-referencing-empty-array-rhel90.patch
|
||||
|
||||
BuildRequires: libpmemobj-devel >= %{min_libpmemobj_ver}
|
||||
BuildRequires: cmake >= 3.3
|
||||
@ -99,6 +100,8 @@ HTML documentation for libpmemobj++.
|
||||
|
||||
%prep
|
||||
%setup -q -n libpmemobj-cpp-%{upstreamversion}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
mkdir build
|
||||
@ -112,6 +115,11 @@ cd build
|
||||
%make_install
|
||||
|
||||
%changelog
|
||||
* Mon Feb 28 2022 Bryan Gurney <bgurney@redhat.com> - 1.12-8
|
||||
- Apply patch to fix undefined behavior on realloc
|
||||
- Also add and apply patch to fix referencing empty array
|
||||
- Related: rhbz#2034641
|
||||
|
||||
* Mon Jan 24 2022 Bryan Gurney <bgurney@redhat.com> - 1.12-7
|
||||
- Add patch to fix undefined behavior on realloc
|
||||
- Related: rhbz#2034641
|
||||
|
Loading…
Reference in New Issue
Block a user