Fix 1381767

epel8
Mystro256 8 years ago
parent 84f8915874
commit e523d939e9

@ -0,0 +1,62 @@
commit 3b047b58ceb4a0bf11a607b3a5a47697d70de946
Author: Tim Kosse <tim.kosse@filezilla-project.org>
Date: Mon Sep 14 11:42:38 2015 +0200
Escape filenames in wxFileDataObject::GetDataSize/GetDataHere
On wxGTK, wxFileDataObject::SetData calls g_filename_from_uri which
percent-decodes URIs. No corresponding percent-encoding was done in
wxFileDataObject::GetDataSize/GetDataHere. Use g_filename_to_uri instead in so
that filenames are properly escaped.
This commit also fixes the data being truncated if it contains non-ASCII
characters on wide-character builds, see the memcpy arguments in the original
code.
diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
index d786257..1754d6c 100644
--- a/src/gtk/dataobj.cpp
+++ b/src/gtk/dataobj.cpp
@@ -235,16 +235,21 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats,
bool wxFileDataObject::GetDataHere(void *buf) const
{
- wxString filenames;
+ char* out = reinterpret_cast<char*>(buf);
for (size_t i = 0; i < m_filenames.GetCount(); i++)
{
- filenames += wxT("file:");
- filenames += m_filenames[i];
- filenames += wxT("\r\n");
+ char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0);
+ if (uri)
+ {
+ size_t const len = strlen(uri);
+ strcpy(out, uri);
+ out += len;
+ *(out++) = '\r';
+ *(out++) = '\n';
+ }
}
-
- memcpy( buf, filenames.mbc_str(), filenames.length() + 1 );
+ *out = 0;
return true;
}
@@ -255,9 +260,11 @@ size_t wxFileDataObject::GetDataSize() const
for (size_t i = 0; i < m_filenames.GetCount(); i++)
{
- // This is junk in UTF-8
- res += m_filenames[i].length();
- res += 5 + 2; // "file:" (5) + "\r\n" (2)
+ char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0);
+ if (uri) {
+ res += strlen(uri) + 2; // Including "\r\n"
+ g_free(uri);
+ }
}
return res + 1;

@ -11,7 +11,7 @@
Name: %{wxgtkname} Name: %{wxgtkname}
Version: 3.0.2 Version: 3.0.2
Release: 24%{?dist} Release: 25%{?dist}
Summary: GTK port of the wxWidgets GUI library Summary: GTK port of the wxWidgets GUI library
License: wxWidgets License: wxWidgets
Group: System Environment/Libraries Group: System Environment/Libraries
@ -85,6 +85,10 @@ Patch16: %{name}-%{version}-wxgetkeystate.patch
# For more details, see the upstream commit: # For more details, see the upstream commit:
# https://github.com/wxWidgets/wxWidgets/commit/148971013ee48926dfe153ca39c94be92acde37c # https://github.com/wxWidgets/wxWidgets/commit/148971013ee48926dfe153ca39c94be92acde37c
Patch17: %{name}-%{version}-draw-elliptic-arc-crash.patch Patch17: %{name}-%{version}-draw-elliptic-arc-crash.patch
# Fixes drag and drop issues with filenames containing percent symbols
# For more details, see the upstream commit:
# https://github.com/wxWidgets/wxWidgets/commit/3b047b58ceb4a0bf11a607b3a5a47697d70de946
Patch18: %{name}-%{version}-fix-percent-dnd.patch
BuildRequires: gtk%{gtkver}-devel BuildRequires: gtk%{gtkver}-devel
#Note webkitgtk (GTK2) does not appear to be supported #Note webkitgtk (GTK2) does not appear to be supported
@ -199,25 +203,7 @@ This package provides XML documentation for the %{srcname} library.
%prep %prep
%setup -q -n %{srcname}-%{version} -a 1 %autosetup -n %{srcname}-%{version} -a 1 -p1
%patch0 -p1 -b .abicheck
%patch1 -p1 -b .upstreamfixes
%patch2 -p1 -b .spinbutt
%patch3 -p1 -b .checkradio
%patch4 -p1 -b .wayland
%patch5 -p1 -b .stc-gcc6
%patch6 -p1 -b .strings-tests-gcc6
%patch7 -p1 -b .getbestsize
%patch8 -p1 -b .wayland-window-sizing1
%patch9 -p1 -b .wayland-window-sizing2
%patch10 -p1 -b .media-docs
%patch11 -p1 -b .size-alloc-fix
%patch12 -p1 -b .font-enumerator-stop
%patch13 -p1 -b .init-from-font
%patch14 -p1 -b .gtk-show-uri
%patch15 -p1 -b .gtk-show-uri1
%patch16 -p1 -b .wxgetkeystate
%patch17 -p1 -b .draw-elliptic-arc-crash
# patch some installed files to avoid conflicts with 2.8.* # patch some installed files to avoid conflicts with 2.8.*
sed -i -e 's|aclocal)|aclocal/wxwin3.m4)|' Makefile.in sed -i -e 's|aclocal)|aclocal/wxwin3.m4)|' Makefile.in
@ -374,6 +360,10 @@ fi
%doc docs/doxygen/out/xml/* %doc docs/doxygen/out/xml/*
%changelog %changelog
* Tue Oct 04 2016 Jeremy Newton <alexjnewt AT hotmail DOT com> - 3.0.2-25
- Add patch to fix bug 1381767
- Clean up spec file with autosetup
* Sat Sep 24 2016 Scott Talbert <swt@techie.net> - 3.0.2-24 * Sat Sep 24 2016 Scott Talbert <swt@techie.net> - 3.0.2-24
- Add patch to fix crash in wxGCDC::DrawEllipticArc() - Add patch to fix crash in wxGCDC::DrawEllipticArc()

Loading…
Cancel
Save