kpcyrd pushed to branch main at Arch Linux / Packaging / Packages / 
libtorrent-rasterbar


Commits:
aff3cf8c by kpcyrd at 2023-09-16T01:01:34+02:00
upgpkg: 1:2.0.9-3: remove usage of malloc_usable_size for _FORTIFY_SOURCE=3 
compatibility

- - - - -


2 changed files:

- PKGBUILD
- + fortify-source-3.patch


Changes:

=====================================
PKGBUILD
=====================================
@@ -4,7 +4,7 @@
 
 pkgname=libtorrent-rasterbar
 pkgver=2.0.9
-pkgrel=2
+pkgrel=3
 epoch=1
 pkgdesc="A C++ BitTorrent library that aims to be a good alternative to all 
the other implementations around"
 url="https://www.rasterbar.com/products/libtorrent/";
@@ -13,8 +13,17 @@ license=('BSD')
 depends=('boost-libs' 'openssl')
 makedepends=('boost' 'cmake' 'ninja' 'python-setuptools')
 options=('!emptydirs')
-source=(https://github.com/arvidn/libtorrent/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz)
-sha512sums=('c252dbe1e2a246769017b8a622bb3418527e2bc2615115ac2bff9662afb53759bc7b2cbf6657438c515ba6de0140fc1c388b340c48b3dd9f7e6202ec0df1aec7')
+source=(https://github.com/arvidn/libtorrent/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz
+        fortify-source-3.patch)
+sha512sums=('c252dbe1e2a246769017b8a622bb3418527e2bc2615115ac2bff9662afb53759bc7b2cbf6657438c515ba6de0140fc1c388b340c48b3dd9f7e6202ec0df1aec7'
+            
'0687883a84f4395afaa824f5a2a9ee5366d654d84f546045b202297084ff24c445e4b95e92df63a8d9d2cd28cbd665933f3c649de91ab13334507f7a7d2c3c5d')
+
+prepare() {
+  # remove usage of malloc_usable_size for _FORTIFY_SOURCE=3 compatibility
+  # https://github.com/arvidn/libtorrent/issues/7519
+  cd $pkgname-$pkgver
+  patch -Np1 -i ../fortify-source-3.patch
+}
 
 build() {
   cmake -B build -S $pkgname-$pkgver \


=====================================
fortify-source-3.patch
=====================================
@@ -0,0 +1,22 @@
+diff --git a/include/libtorrent/aux_/buffer.hpp 
b/include/libtorrent/aux_/buffer.hpp
+index 7d8fe0da2..ce6cf21d4 100644
+--- a/include/libtorrent/aux_/buffer.hpp
++++ b/include/libtorrent/aux_/buffer.hpp
+@@ -87,17 +87,7 @@ public:
+               m_begin = 
static_cast<char*>(std::malloc(static_cast<std::size_t>(size)));
+               if (m_begin == nullptr) aux::throw_ex<std::bad_alloc>();
+ 
+-              // the actual allocation may be larger than we requested. If 
so, let the
+-              // user take advantage of every single byte
+-#if (defined __GLIBC__ && !defined __UCLIBC__) || defined __FreeBSD__
+-              m_size = 
static_cast<difference_type>(::malloc_usable_size(m_begin));
+-#elif defined _MSC_VER
+-              m_size = static_cast<difference_type>(::_msize(m_begin));
+-#elif defined __APPLE__
+-              m_size = static_cast<difference_type>(::malloc_size(m_begin));
+-#else
+               m_size = size;
+-#endif
+       }
+ 
+       // allocate an uninitialized buffer of the specified size



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/libtorrent-rasterbar/-/commit/aff3cf8caa0df1ef1252ad6dd8d731d42a13428b

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/libtorrent-rasterbar/-/commit/aff3cf8caa0df1ef1252ad6dd8d731d42a13428b
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to