- backport patch from upstream to avoid segfault when data phase is skipped

for certain devices (#435413)
- initial build
This commit is contained in:
Jindrich Novy 2008-04-18 10:23:40 +00:00
parent cbbdca8514
commit e60acaf57f
2 changed files with 37 additions and 1 deletions

29
gphoto2-data-phase.patch Normal file
View File

@ -0,0 +1,29 @@
diff -up gphoto2-2.4.0/libgphoto2-2.4.0/camlibs/ptp2/ptp.c.data-phase gphoto2-2.4.0/libgphoto2-2.4.0/camlibs/ptp2/ptp.c
--- libgphoto2-2.4.0/camlibs/ptp2/ptp.c.data-phase 2007-07-27 02:35:37.000000000 +0200
+++ libgphoto2-2.4.0/camlibs/ptp2/ptp.c 2008-04-17 06:19:34.000000000 +0200
@@ -2775,13 +2775,23 @@ ptp_mtp_getobjectreferences (PTPParams*
PTPContainer ptp;
uint16_t ret;
unsigned char* dpv=NULL;
+ unsigned int dpvlen = 0;
PTP_CNT_INIT(ptp);
ptp.Code=PTP_OC_MTP_GetObjectReferences;
ptp.Param1=handle;
ptp.Nparam=1;
- ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, NULL);
- if (ret == PTP_RC_OK) *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
+ ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &dpvlen);
+ if (ret == PTP_RC_OK) {
+ /* Sandisk Sansa skips the DATA phase, but returns OK as response.
+ * this will give us a NULL here. Handle it. -Marcus */
+ if ((dpv == NULL) || (dpvlen == 0)) {
+ *arraylen = 0;
+ *ohArray = NULL;
+ } else {
+ *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
+ }
+ }
free(dpv);
return ret;
}

View File

@ -1,7 +1,7 @@
Summary: Library for accessing digital cameras
Name: libgphoto2
Version: 2.4.0
Release: 0.2%{?dist}
Release: 1%{?dist}
# GPLV2+ for the main lib (due to exif.c) and most plugins, some plugins GPLv2
License: GPLv2+ and GPLv2
Group: Development/Libraries
@ -11,6 +11,7 @@ Patch1: gphoto2-pkgcfg.patch
Patch2: gphoto2-storage.patch
Patch3: gphoto2-ixany.patch
Patch4: gphoto2-norpath.patch
Patch5: gphoto2-data-phase.patch
Url: http://www.gphoto.org/
Requires: lockdev
BuildRequires: libusb-devel >= 0.1.5
@ -47,6 +48,7 @@ use libgphoto2.
%patch2 -p1 -b .storage
%patch3 -p1 -b .ixany
%patch4 -p1 -b .norpath
%patch5 -p1 -b .data-phase
cat > gphoto2.pc.in << EOF
prefix=@prefix@
@ -137,6 +139,11 @@ rm -rf "${RPM_BUILD_ROOT}"
%{_mandir}/man3/*
%changelog
* Fri Apr 18 2008 Jindrich Novy <jnovy@redhat.com> 2.4.0-1
- backport patch from upstream to avoid segfault when
data phase is skipped for certain devices (#435413)
- initial build
* Mon Apr 14 2008 Jindrich Novy <jnovy@redhat.com> 2.4.0-0.2
- review fixes, thanks to Hans de Goede: (#437285)
- remove unused macro