lensfun-segfault.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. diff --git a/libs/lensfun/lens.cpp b/libs/lensfun/lens.cpp
  2. index 52b76658..b8430609 100644
  3. --- a/libs/lensfun/lens.cpp
  4. +++ b/libs/lensfun/lens.cpp
  5. @@ -66,9 +66,10 @@ lfLens::lfLens (const lfLens &other)
  6. Mounts = NULL;
  7. MountNames.clear();
  8. const char* const* otherMounts = other.GetMountNames();
  9. - for (int i = 0; otherMounts[i]; i++)
  10. - AddMount(otherMounts[i]);
  11. -
  12. + if (otherMounts) {
  13. + for (int i = 0; otherMounts[i]; i++)
  14. + AddMount(otherMounts[i]);
  15. + }
  16. for (auto *calibset : other.Calibrations)
  17. Calibrations.push_back(new lfLensCalibrationSet(*calibset));
  18. @@ -96,9 +97,10 @@ lfLens &lfLens::operator = (const lfLens &other)
  19. Mounts = NULL;
  20. MountNames.clear();
  21. const char* const* otherMounts = other.GetMountNames();
  22. - for (int i = 0; otherMounts[i]; i++)
  23. - AddMount(otherMounts[i]);
  24. -
  25. + if (otherMounts) {
  26. + for (int i = 0; otherMounts[i]; i++)
  27. + AddMount(otherMounts[i]);
  28. + }
  29. for (auto *calibset : Calibrations)
  30. delete calibset;
  31. Calibrations.clear();
  32. diff --git a/libs/lensfun/mount.cpp b/libs/lensfun/mount.cpp
  33. index bd875baa..86f667cb 100644
  34. --- a/libs/lensfun/mount.cpp
  35. +++ b/libs/lensfun/mount.cpp
  36. @@ -28,8 +28,10 @@ lfMount::lfMount (const lfMount &other)
  37. MountCompat.clear();
  38. const char* const* otherMounts = other.GetCompats();
  39. - for (int i = 0; otherMounts[i]; i++)
  40. - AddCompat(otherMounts[i]);
  41. + if (otherMounts) {
  42. + for (int i = 0; otherMounts[i]; i++)
  43. + AddCompat(otherMounts[i]);
  44. + }
  45. }
  46. lfMount &lfMount::operator = (const lfMount &other)
  47. @@ -40,9 +42,10 @@ lfMount &lfMount::operator = (const lfMount &other)
  48. MountCompat.clear();
  49. const char* const* otherMounts = other.GetCompats();
  50. - for (int i = 0; otherMounts[i]; i++)
  51. - AddCompat(otherMounts[i]);
  52. -
  53. + if (otherMounts) {
  54. + for (int i = 0; otherMounts[i]; i++)
  55. + AddCompat(otherMounts[i]);
  56. + }
  57. return *this;
  58. }