From f17979d6c0613d087a44764aa9bb7306d47aaf6b696c2b66f59f76245bb067d8 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 25 Jul 2016 11:40:19 +0000 Subject: [PATCH 1/5] Accepting request 402674 from home:jirislaby:branches:network:telephony - port patches from home:jirislaby:statica * add baselibs.conf to have 32bit libs too * add fix-LIST-memory-leak.patch * add fix-hash-double-free.patch - use standard library versioning and obsolete the old packages OBS-URL: https://build.opensuse.org/request/show/402674 OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=9 --- antlr-libversion.diff | 24 ++++++++++++++------ antlr3c.changes | 9 ++++++++ antlr3c.spec | 10 +++++++-- baselibs.conf | 1 + fix-LIST-memory-leak.patch | 45 ++++++++++++++++++++++++++++++++++++++ fix-hash-double-free.patch | 33 ++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 9 deletions(-) create mode 100644 baselibs.conf create mode 100644 fix-LIST-memory-leak.patch create mode 100644 fix-hash-double-free.patch diff --git a/antlr-libversion.diff b/antlr-libversion.diff index b87b13d..d220135 100644 --- a/antlr-libversion.diff +++ b/antlr-libversion.diff @@ -4,19 +4,29 @@ From: Jan Engelhardt "-avoid-version" does not count for compatibility guarantees. Use one of -version-info, -release or -Wl,--version-script! --- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Makefile.am | 2 +- + configure.ac | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) -Index: libantlr3c-3.4/Makefile.am -=================================================================== ---- libantlr3c-3.4.orig/Makefile.am -+++ libantlr3c-3.4/Makefile.am +--- a/Makefile.am ++++ b/Makefile.am @@ -62,7 +62,7 @@ include_HEADERS = include/antlr3.h include/antlr3treeparser.h \ antlr3config.h -libantlr3c_la_LDFLAGS = -avoid-version -+libantlr3c_la_LDFLAGS = -release ${PACKAGE_VERSION} ++libantlr3c_la_LDFLAGS = -version-info @LIB_VERSION@ INCLUDES = -Iinclude +--- a/configure.ac ++++ b/configure.ac +@@ -34,6 +34,8 @@ AC_COPYRIGHT([ + ]) + AC_CONFIG_SRCDIR(src/antlr3parser.c) + ++LIB_VERSION=`echo $PACKAGE_VERSION|sed 's@\.@:@g'` ++AC_SUBST([LIB_VERSION]) + + AC_ARG_ENABLE([debuginfo], + [AS_HELP_STRING([--enable-debuginfo], [Compiles debug info into the library (default --disable-debuginfo)])], diff --git a/antlr3c.changes b/antlr3c.changes index 19bbdca..fd0ace2 100644 --- a/antlr3c.changes +++ b/antlr3c.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Jun 16 07:23:25 UTC 2016 - jslaby@suse.com + +- port patches from home:jirislaby:statica + * add baselibs.conf to have 32bit libs too + * add fix-LIST-memory-leak.patch + * add fix-hash-double-free.patch +- use standard library versioning and obsolete the old packages + ------------------------------------------------------------------- Sat Feb 6 12:00:03 UTC 2016 - mpluskal@suse.com diff --git a/antlr3c.spec b/antlr3c.spec index 95756fc..b244600 100644 --- a/antlr3c.spec +++ b/antlr3c.spec @@ -17,7 +17,7 @@ # -%define soname libantlr3c-3_4 +%define soname libantlr3c3 Name: antlr3c Version: 3.4 Release: 0 @@ -26,8 +26,10 @@ License: BSD-3-Clause Group: Development/Libraries/C and C++ Url: http://www.antlr3.org/ Source: http://www.antlr3.org/download/C/lib%{name}-%{version}.tar.gz +Patch0: fix-LIST-memory-leak.patch Patch1: antlr-64bit.diff Patch2: antlr-libversion.diff +Patch3: fix-hash-double-free.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc @@ -48,6 +50,8 @@ Group: System/Libraries # From 13.3/TW201501 onwards Obsoletes: libantlr3c3_4 < %{version} Provides: libantlr3c3_4 = %{version} +Obsoletes: libantlr3c-3_4 < %{version} +Provides: libantlr3c-3_4 = %{version} %description -n %{soname} ANTLR, ANother Tool for Language Recognition, is a language tool that provides a @@ -73,8 +77,10 @@ develop programs using the antlr3c library. %prep %setup -q -n lib%{name}-%{version} +%patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build autoreconf -fiv @@ -91,7 +97,7 @@ find %{buildroot} -type f -name "*.la" -delete -print %files -n %{soname} %defattr(-,root,root) -%{_libdir}/libantlr3c-%{version}.so +%{_libdir}/libantlr3c.so.* %files devel %defattr(-,root,root,-) diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..2600f33 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1 @@ +libantlr3c-3_4 diff --git a/fix-LIST-memory-leak.patch b/fix-LIST-memory-leak.patch new file mode 100644 index 0000000..501bf0c --- /dev/null +++ b/fix-LIST-memory-leak.patch @@ -0,0 +1,45 @@ +From 26aaa0f97e45025c48139bd39adc8808f9b4e697 Mon Sep 17 00:00:00 2001 +From: Jiri Slaby +Date: Thu, 17 Feb 2011 21:26:57 +0100 +Subject: [PATCH] collections: fix a LIST memory leak + +When using antlr3 lists, Valgrind reports leaks like this: +==30092== HEAP SUMMARY: +==30092== in use at exit: 80 bytes in 2 blocks +==30092== total heap usage: 286 allocs, 284 frees, 1,781,381 bytes allocated +==30092== +==30092== 40 bytes in 1 blocks are definitely lost in loss record 1 of 2 +==30092== at 0x4C2659D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) +==30092== by 0x4E333B8: antlr3HashPutI (antlr3collections.c:569) + +It's because we use HASH as a representation for LIST. The LIST +abstracts from HASH, so a user doesn't see a hash 'entry' itself. +Hence if the user do list->remove, the HASH returns an 'entry' to us +and we return entry->data to the user. But nobody frees the entry +itself. + +So free the entry from now on. + +Signed-off-by: Jiri Slaby +--- + src/antlr3collections.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/src/antlr3collections.c b/src/antlr3collections.c +index 48ffe18..01f3f7e 100644 +--- a/src/antlr3collections.c ++++ b/src/antlr3collections.c +@@ -946,7 +946,9 @@ antlr3ListRemove (pANTLR3_LIST list, ANTLR3_INTKEY key) + + if (entry != NULL) + { +- return entry->data; ++ void *data = entry->data; ++ ANTLR3_FREE(entry); ++ return data; + } + else + { +-- +1.7.3.4 + diff --git a/fix-hash-double-free.patch b/fix-hash-double-free.patch new file mode 100644 index 0000000..4515c08 --- /dev/null +++ b/fix-hash-double-free.patch @@ -0,0 +1,33 @@ +From 6f5dad7d06620b4665303c542549d4c14f9fe784 Mon Sep 17 00:00:00 2001 +From: Jiri Slaby +Date: Sat, 19 Feb 2011 13:26:35 +0100 +Subject: [PATCH] collections: hash, fix double free + +We should not free the hash entry in antlr3HashFree when we didn't +strdup on that earlier. + +I.e. make the free depend on table->doStrdup. + +Signed-off-by: Jiri Slaby +--- + src/antlr3collections.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/src/antlr3collections.c b/src/antlr3collections.c +index 01f3f7e..3e32dc3 100644 +--- a/src/antlr3collections.c ++++ b/src/antlr3collections.c +@@ -237,7 +237,9 @@ antlr3HashFree(pANTLR3_HASH_TABLE table) + */ + if (entry->keybase.type == ANTLR3_HASH_TYPE_STR && entry->keybase.key.sKey != NULL) + { +- ANTLR3_FREE(entry->keybase.key.sKey); ++ if (table->doStrdup == ANTLR3_TRUE) { ++ ANTLR3_FREE(entry->keybase.key.sKey); ++ } + } + + /* Free this entry +-- +1.7.3.4 + From 088c4b7c8f21891ab84e4a47a1caac81771d1818eef7f3b336427492fff95c6a Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 25 Jul 2016 12:24:49 +0000 Subject: [PATCH 2/5] OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=10 --- antlr3c.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/antlr3c.spec b/antlr3c.spec index b244600..babf2e4 100644 --- a/antlr3c.spec +++ b/antlr3c.spec @@ -26,6 +26,7 @@ License: BSD-3-Clause Group: Development/Libraries/C and C++ Url: http://www.antlr3.org/ Source: http://www.antlr3.org/download/C/lib%{name}-%{version}.tar.gz +Source1: baselibs.conf Patch0: fix-LIST-memory-leak.patch Patch1: antlr-64bit.diff Patch2: antlr-libversion.diff From 4a6135b01cc05079d7a9f241398d318b61e43ae948b857ea39b2d2774192628a Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 25 Jul 2016 13:04:44 +0000 Subject: [PATCH 3/5] OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=11 --- baselibs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baselibs.conf b/baselibs.conf index 2600f33..006d948 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1 +1 @@ -libantlr3c-3_4 +libantlr3c3 From 408552755886bc6c73875f41744a6bd695da4fa92452d1e70fd86d7cc754abe2 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 1 Aug 2016 08:17:06 +0000 Subject: [PATCH 4/5] OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=12 --- antlr3c.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/antlr3c.spec b/antlr3c.spec index babf2e4..0ae9b89 100644 --- a/antlr3c.spec +++ b/antlr3c.spec @@ -48,11 +48,6 @@ translation, error recovery, and error reporting. %package -n %{soname} Summary: C runtime for the ANTLR parsing library Group: System/Libraries -# From 13.3/TW201501 onwards -Obsoletes: libantlr3c3_4 < %{version} -Provides: libantlr3c3_4 = %{version} -Obsoletes: libantlr3c-3_4 < %{version} -Provides: libantlr3c-3_4 = %{version} %description -n %{soname} ANTLR, ANother Tool for Language Recognition, is a language tool that provides a From ce10b129cc4fbbc464b362bd729b587881abf3db7ea7e6ca90b7a814be94c812 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 1 Aug 2016 08:17:50 +0000 Subject: [PATCH 5/5] OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=13 --- antlr3c.changes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/antlr3c.changes b/antlr3c.changes index fd0ace2..35f32ea 100644 --- a/antlr3c.changes +++ b/antlr3c.changes @@ -5,7 +5,8 @@ Thu Jun 16 07:23:25 UTC 2016 - jslaby@suse.com * add baselibs.conf to have 32bit libs too * add fix-LIST-memory-leak.patch * add fix-hash-double-free.patch -- use standard library versioning and obsolete the old packages +- use standard library versioning. We do not obsolete the old + libraries as they are removed via weakremovers. ------------------------------------------------------------------- Sat Feb 6 12:00:03 UTC 2016 - mpluskal@suse.com