diff --git a/0001-Deprecate-usage-of-GLib-memory-profiler-on-2.46-and-.patch b/0001-Deprecate-usage-of-GLib-memory-profiler-on-2.46-and-.patch deleted file mode 100644 index 16fc192..0000000 --- a/0001-Deprecate-usage-of-GLib-memory-profiler-on-2.46-and-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2bc19bd22efa7d8c1c11cfee32dd385b012a6de7 Mon Sep 17 00:00:00 2001 -From: Mamoru TASAKA -Date: Mon, 28 May 2018 15:09:51 +0900 -Subject: [PATCH 1/2] Deprecate usage of GLib memory profiler on 2.46 and above -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-mem-set-vtable -https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-mem-profile - -GLib独自の profiler 機能は、2.46でdeprecatedになり、 -それ以降のGLibでは警告が出るだけで何もしないので、 -使用しないようにする ---- - src/main.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/main.cpp b/src/main.cpp -index 61a37b47..4a7c5a1e 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -481,6 +481,7 @@ int main( int argc, char **argv ) - } - #endif - -+#if ! GLIB_CHECK_VERSION(2, 46, 0) - #ifdef _DEBUG_MEM_PROFILE - g_mem_set_vtable( glib_mem_profiler_table ); - atexit( g_mem_profile ); -@@ -494,6 +495,7 @@ int main( int argc, char **argv ) - vtable.try_malloc = malloc; - vtable.try_realloc = realloc; - g_mem_set_vtable( &vtable ); -+#endif - #endif - - Gtk::Main m( &argc, &argv ); --- -2.17.1 - diff --git a/0007-MISC-remove_space-handle-the-case-str-consists-of-ju.patch b/0007-MISC-remove_space-handle-the-case-str-consists-of-ju.patch new file mode 100644 index 0000000..27a5fe6 --- /dev/null +++ b/0007-MISC-remove_space-handle-the-case-str-consists-of-ju.patch @@ -0,0 +1,44 @@ +From 01cff84b8ea1221c3bd0a2f3017b75fc79ba823a Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Fri, 31 Jan 2020 20:51:09 +0900 +Subject: [PATCH 07/11] MISC::remove_space: handle the case str consists of + just spaces (#176) + +In the funcion MISC::remove_space , when the input str consists of just spaces, +the current implementation causes invalid access against str because +the variable i2 can be (size_t)-1. +When compiled with -Wp,-D_GLIBCXX_ASSERTIONS, this actually causes abort like: + +/usr/include/c++/9/bits/basic_string.h:1048: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference = const char&; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]: Assertion '__pos <= size()' failed. + +Note that for this case, i finally becomes lng (== str.length()), and +str.substr(pos, len) returns empty string when pos == str.length(), so +this patch should behave as the previous behavior. +--- + src/jdlib/miscutil.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/jdlib/miscutil.cpp b/src/jdlib/miscutil.cpp +index a7d3dd34..ccd71e45 100644 +--- a/src/jdlib/miscutil.cpp ++++ b/src/jdlib/miscutil.cpp +@@ -304,7 +304,7 @@ std::string MISC::remove_space( const std::string& str ) + + // 前 + size_t i = 0; +- while( 1 ){ ++ while( i < lng ){ + + // 半角 + if( str[ i ] == ' ' ) ++i; +@@ -315,6 +315,7 @@ std::string MISC::remove_space( const std::string& str ) + str[ i +2 ] == str_space[ 2 ] ) i += lng_space; + else break; + } ++ if (i >= lng) return ""; + + // 後 + size_t i2 = lng -1; +-- +2.24.1 + diff --git a/jd.spec b/jd.spec index 941b392..ec9e0cc 100644 --- a/jd.spec +++ b/jd.spec @@ -26,7 +26,7 @@ ########################################## # Defined by vendor # -%define vendor_rel 0.100 +%define vendor_rel 0.101 %define extra_rel %{nil} # Tag name changed from vendor to vendorname so as not to # overwrite Vendor entry in Summary @@ -49,7 +49,7 @@ ########################################## Name: jd -Epoch: 1 +Epoch: 1 Version: %{main_ver}%{?strtag:.%{strtag}} Release: %{rel} Summary: A 2ch browser @@ -62,6 +62,8 @@ Source0: JDim-%{tarballdate}T%{tarballtime}.tar.gz Source1: create-JD-git-bare-tarball.sh Patch0: jdim-0.3.0-env-pkg-distro-specific.patch +# Upstream patch +Patch1007: 0007-MISC-remove_space-handle-the-case-str-consists-of-ju.patch BuildRequires: gcc-c++ BuildRequires: %{gtkmmdevel} @@ -101,7 +103,7 @@ git config user.name "%{name} Fedora maintainer" git config user.email "%{name}-owner@fedoraproject.org" #git checkout -b %{version}-fedora %{gitcommit} -git checkout -b %{version}-fedora %{reponame}-v%{main_ver} +git checkout -b %{version}-fedora-local %{reponame}-v%{main_ver} cp -a [A-Z]* .. @@ -110,6 +112,11 @@ if ( uname -n | grep -q 'fedoraproject\.org' ) ; then %patch0 -p2 -b .env_fedora git commit -m "apply Fedora specific config" -a fi +cat %PATCH1007 | git am + +# reset to base, as git information is embedded in the source +git checkout -b %{version}-fedora +git reset %{reponame}-v%{main_ver} autoreconf -i