diff --git a/gphoto2-data-phase.patch b/gphoto2-data-phase.patch new file mode 100644 index 0000000..d21c2af --- /dev/null +++ b/gphoto2-data-phase.patch @@ -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 +--- 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; + } diff --git a/gphoto2.spec b/gphoto2.spec index e16f257..47aaf47 100644 --- a/gphoto2.spec +++ b/gphoto2.spec @@ -8,7 +8,7 @@ Name: gphoto2 %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 @@ Source1: http://prdownloads.sourceforge.net/gphoto/%{libpkg}-%{libver}.tar.bz2 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 @@ use libgphoto2. %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 @@ rm -rf "${RPM_BUILD_ROOT}" # ChangeLog ######################################################################## %changelog +* Thu Apr 17 2008 Jindrich Novy 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 2.4.0-6 - fix gphoto2 build on alpha arch (#416941) - manual rebuild because of gcc-4.3 (#434187)