rpms/gphoto2/devel gphoto2-data-phase.patch, NONE, 1.1 gphoto2.spec, 1.88, 1.89

Jindrich Novy (jnovy) fedora-extras-commits at redhat.com
Thu Apr 17 04:26:57 UTC 2008


Author: jnovy

Update of /cvs/extras/rpms/gphoto2/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7265

Modified Files:
	gphoto2.spec 
Added Files:
	gphoto2-data-phase.patch 
Log Message:
* Thu Apr 17 2008 Jindrich Novy <jnovy at redhat.com> 2.4.0-7
- backport patch from upstream to avoid segfault when
  data phase is skipped for certain devices (#435413)


gphoto2-data-phase.patch:

--- NEW FILE gphoto2-data-phase.patch ---
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
--- gphoto2-2.4.0/libgphoto2-2.4.0/camlibs/ptp2/ptp.c.data-phase	2007-07-27 02:35:37.000000000 +0200
+++ gphoto2-2.4.0/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;
 }


Index: gphoto2.spec
===================================================================
RCS file: /cvs/extras/rpms/gphoto2/devel/gphoto2.spec,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- gphoto2.spec	25 Feb 2008 05:51:10 -0000	1.88
+++ gphoto2.spec	17 Apr 2008 04:26:20 -0000	1.89
@@ -8,7 +8,7 @@
 %define libpkg libgphoto2
 %define libver 2.4.0
 Version: %{pkgver}
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2 and LGPLv2+
 Group: Applications/Multimedia
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -17,6 +17,7 @@
 Patch1: gphoto2-pkgcfg.patch
 Patch2: gphoto2-storage.patch
 Patch3: gphoto2-ixany.patch
+Patch4: gphoto2-data-phase.patch
 Url: http://www.gphoto.org/
 ExcludeArch: s390 s390x
 Provides: libgphoto2 = %{libver}
@@ -72,6 +73,7 @@
 %patch1 -p1 -b .pkgcfg
 %patch2 -p1 -b .storage
 %patch3 -p1 -b .ixany
+%patch4 -p1 -b .data-phase
 
 # write pkg-config stuff 
 cat > gphoto2.pc.in << EOF
@@ -201,6 +203,10 @@
 # ChangeLog
 ########################################################################
 %changelog
+* Thu Apr 17 2008 Jindrich Novy <jnovy at redhat.com> 2.4.0-7
+- backport patch from upstream to avoid segfault when
+  data phase is skipped for certain devices (#435413)
+
 * Mon Feb 25 2008 Jindrich Novy <jnovy at redhat.com> 2.4.0-6
 - fix gphoto2 build on alpha arch (#416941)
 - manual rebuild because of gcc-4.3 (#434187)




More information about the fedora-extras-commits mailing list