rpms/libgphoto2/devel gphoto2-data-phase.patch, NONE, 1.1 libgphoto2.spec, 1.1, 1.2

Jindrich Novy (jnovy) fedora-extras-commits at redhat.com
Fri Apr 18 10:24:17 UTC 2008


Author: jnovy

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

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


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
--- 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;
 }


Index: libgphoto2.spec
===================================================================
RCS file: /cvs/extras/rpms/libgphoto2/devel/libgphoto2.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libgphoto2.spec	18 Apr 2008 06:10:29 -0000	1.1
+++ libgphoto2.spec	18 Apr 2008 10:23:40 -0000	1.2
@@ -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 @@
 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 @@
 %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 @@
 %{_mandir}/man3/*
 
 %changelog
+* Fri Apr 18 2008 Jindrich Novy <jnovy at 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 at redhat.com> 2.4.0-0.2
 - review fixes, thanks to Hans de Goede: (#437285)
   - remove unused macro




More information about the fedora-extras-commits mailing list