Date: Saturday, May 16, 2020 @ 10:20:58 Author: arojas Revision: 384085
Fix segfault (FS#66605) Added: lensfun/trunk/lensfun-segfault.patch Modified: lensfun/trunk/PKGBUILD ------------------------+ PKGBUILD | 13 +++++++-- lensfun-segfault.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2020-05-16 10:20:56 UTC (rev 384084) +++ PKGBUILD 2020-05-16 10:20:58 UTC (rev 384085) @@ -2,7 +2,7 @@ pkgname=lensfun pkgver=0.3.95 -pkgrel=1 +pkgrel=2 pkgdesc="Database of photographic lenses and a library that allows advanced access to the database" arch=(x86_64) url="https://lensfun.github.io/" @@ -10,9 +10,16 @@ depends=('glib2') makedepends=('python' 'libpng' 'doxygen' 'cmake') optdepends=('python: for lensfun-update-data and lensfun-add-adapter') -source=("https://sourceforge.net/projects/lensfun/files/${pkgver}/${pkgname}-${pkgver}.tar.gz") -sha256sums=('82c29c833c1604c48ca3ab8a35e86b7189b8effac1b1476095c0529afb702808') +source=("https://sourceforge.net/projects/lensfun/files/${pkgver}/${pkgname}-${pkgver}.tar.gz" + lensfun-segfault.patch) +sha256sums=('82c29c833c1604c48ca3ab8a35e86b7189b8effac1b1476095c0529afb702808' + '090804382c134b813693770383d21289a74f2b7e221127f2634abf3d24b003da') +prepare() { + cd $pkgname-$pkgver + patch -p1 -i ../lensfun-segfault.patch # Fix null pointer dereference # https://github.com/lensfun/lensfun/issues/1132 +} + build() { cd $pkgname-$pkgver cmake . \ Added: lensfun-segfault.patch =================================================================== --- lensfun-segfault.patch (rev 0) +++ lensfun-segfault.patch 2020-05-16 10:20:58 UTC (rev 384085) @@ -0,0 +1,63 @@ +diff --git a/libs/lensfun/lens.cpp b/libs/lensfun/lens.cpp +index 52b76658..b8430609 100644 +--- a/libs/lensfun/lens.cpp ++++ b/libs/lensfun/lens.cpp +@@ -66,9 +66,10 @@ lfLens::lfLens (const lfLens &other) + Mounts = NULL; + MountNames.clear(); + const char* const* otherMounts = other.GetMountNames(); +- for (int i = 0; otherMounts[i]; i++) +- AddMount(otherMounts[i]); +- ++ if (otherMounts) { ++ for (int i = 0; otherMounts[i]; i++) ++ AddMount(otherMounts[i]); ++ } + for (auto *calibset : other.Calibrations) + Calibrations.push_back(new lfLensCalibrationSet(*calibset)); + +@@ -96,9 +97,10 @@ lfLens &lfLens::operator = (const lfLens &other) + Mounts = NULL; + MountNames.clear(); + const char* const* otherMounts = other.GetMountNames(); +- for (int i = 0; otherMounts[i]; i++) +- AddMount(otherMounts[i]); +- ++ if (otherMounts) { ++ for (int i = 0; otherMounts[i]; i++) ++ AddMount(otherMounts[i]); ++ } + for (auto *calibset : Calibrations) + delete calibset; + Calibrations.clear(); +diff --git a/libs/lensfun/mount.cpp b/libs/lensfun/mount.cpp +index bd875baa..86f667cb 100644 +--- a/libs/lensfun/mount.cpp ++++ b/libs/lensfun/mount.cpp +@@ -28,8 +28,10 @@ lfMount::lfMount (const lfMount &other) + + MountCompat.clear(); + const char* const* otherMounts = other.GetCompats(); +- for (int i = 0; otherMounts[i]; i++) +- AddCompat(otherMounts[i]); ++ if (otherMounts) { ++ for (int i = 0; otherMounts[i]; i++) ++ AddCompat(otherMounts[i]); ++ } + } + + lfMount &lfMount::operator = (const lfMount &other) +@@ -40,9 +42,10 @@ lfMount &lfMount::operator = (const lfMount &other) + + MountCompat.clear(); + const char* const* otherMounts = other.GetCompats(); +- for (int i = 0; otherMounts[i]; i++) +- AddCompat(otherMounts[i]); +- ++ if (otherMounts) { ++ for (int i = 0; otherMounts[i]; i++) ++ AddCompat(otherMounts[i]); ++ } + return *this; + } +