Fix crash when dealing with PTP devices without a memory card (rhbz#915688)

This commit is contained in:
Hans de Goede 2013-05-04 11:29:44 +02:00
parent fbbe8e12aa
commit 9f458992d1
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,17 @@
http://sourceforge.net/p/gphoto/bugs/945/
diff -up libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c~ libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c
--- libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c~ 2013-01-27 19:17:03.000000000 +0100
+++ libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c 2013-05-04 11:21:32.558255859 +0200
@@ -1877,6 +1877,11 @@ ptp_canon_eos_getobjectinfoex (
if (ret != PTP_RC_OK)
return ret;
+ if (!data) {
+ *nrofentries = 0;
+ return PTP_RC_OK;
+ }
+
*nrofentries = dtoh32a(data);
*entries = malloc(*nrofentries * sizeof(PTPCANONFolderEntry));
if (!*entries)

View File

@ -2,7 +2,7 @@
Name: libgphoto2 Name: libgphoto2
Version: 2.5.1.1 Version: 2.5.1.1
Release: 3%{?dist} Release: 4%{?dist}
Summary: Library for accessing digital cameras Summary: Library for accessing digital cameras
Group: Development/Libraries Group: Development/Libraries
# GPLV2+ for the main lib (due to exif.c) and most plugins, some plugins GPLv2 # GPLV2+ for the main lib (due to exif.c) and most plugins, some plugins GPLv2
@ -14,6 +14,7 @@ Patch2: gphoto2-storage.patch
Patch3: gphoto2-ixany.patch Patch3: gphoto2-ixany.patch
Patch4: gphoto2-device-return.patch Patch4: gphoto2-device-return.patch
Patch5: libgphoto2-ptp-usb3.patch Patch5: libgphoto2-ptp-usb3.patch
Patch6: libgphoto2-ptp-crash-on-no-card.patch
BuildRequires: libusb1-devel, libusb-devel >= 0.1.5 BuildRequires: libusb1-devel, libusb-devel >= 0.1.5
BuildRequires: lockdev-devel BuildRequires: lockdev-devel
BuildRequires: libexif-devel BuildRequires: libexif-devel
@ -57,6 +58,7 @@ use libgphoto2.
%patch3 -p1 -b .ixany %patch3 -p1 -b .ixany
%patch4 -p1 -b .device-return %patch4 -p1 -b .device-return
%patch5 -p1 %patch5 -p1
%patch6 -p1
for i in AUTHORS ChangeLog COPYING libgphoto2_port/AUTHORS libgphoto2_port/COPYING.LIB `find -name 'README.*'`; do for i in AUTHORS ChangeLog COPYING libgphoto2_port/AUTHORS libgphoto2_port/COPYING.LIB `find -name 'README.*'`; do
mv ${i} ${i}.old mv ${i} ${i}.old
@ -159,6 +161,9 @@ cat libgphoto2*.lang >> %{name}.lang
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Sat May 4 2013 Hans de Goede <hdegoede@redhat.com> - 2.5.1.1-4
- Fix crash when dealing with PTP devices without a memory card (rhbz#915688)
* Thu May 2 2013 Hans de Goede <hdegoede@redhat.com> - 2.5.1.1-3 * Thu May 2 2013 Hans de Goede <hdegoede@redhat.com> - 2.5.1.1-3
- Fix PTP devices not working in USB-3 ports (rhbz#819918) - Fix PTP devices not working in USB-3 ports (rhbz#819918)
- Cleanup spec-file - Cleanup spec-file