Package init

This commit is contained in:
overweight 2019-09-30 10:56:38 -04:00
commit 2683f1c8a1
6 changed files with 317 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From bd4d04075fa126552b31cd11aaa50dad72119e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Fri, 6 Jul 2018 13:05:56 +0200
Subject: [PATCH 2/3] Check codepoint validity in punycode_decode() and
punycode_decode()
These functions were able to generate invalid unicode values resp.
invalid punycode. This is undocumented/unexpected behavior that can
lead to security vulns.
Reported-by: Mike Schiffman (Farsight Security, Inc.)
---
lib/punycode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/punycode.c b/lib/punycode.c
index d475b6d..f7c63e6 100644
--- a/lib/punycode.c
+++ b/lib/punycode.c
@@ -228,6 +228,8 @@ punycode_encode (size_t input_length,
output[out++] = case_flags ?
encode_basic (input[j], case_flags[j]) : (char) input[j];
}
+ else if (input[j] > 0x10FFFF)
+ return punycode_bad_input;
/* else if (input[j] < n) return punycode_bad_input; */
/* (not needed for Punycode with unsigned code points) */
}
@@ -418,6 +420,8 @@ punycode_decode (size_t input_length,
if (i / (out + 1) > maxint - n)
return punycode_overflow;
n += i / (out + 1);
+ if (n > 0x10FFFF)
+ return punycode_bad_input;
i %= (out + 1);
/* Insert n at position i of the output: */
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From c0374862fc911c88febfab36aedfceaa9e5d7d50 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue, 10 Jul 2018 16:09:19 +0200
Subject: [PATCH 3/3] Fix unlikely memory leak in idna_to_unicode_4z4z
---
lib/idna.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/idna.c b/lib/idna.c
index 91e34f5..fae707c 100644
--- a/lib/idna.c
+++ b/lib/idna.c
@@ -658,7 +658,10 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags)
buflen = (size_t) (end - start);
buf = malloc (sizeof (buf[0]) * (buflen + 1));
if (!buf)
- return IDNA_MALLOC_ERROR;
+ {
+ free (out);
+ return IDNA_MALLOC_ERROR;
+ }
/* don't check return code as per specification! */
idna_to_unicode_44i (start, (size_t) (end - start),
--
1.8.3.1

View File

@ -0,0 +1,68 @@
From fc03b00ddf68ef2075aa56dbaa0d1bbb19c5f7e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Fri, 24 May 2019 13:03:11 +0200
Subject: Fix build failure in csharp/
---
csharp/Makefile.am | 6 +++---
lib/punycode.c | 7 +++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/csharp/Makefile.am b/csharp/Makefile.am
index 7afdea9..4625738 100644
--- a/csharp/Makefile.am
+++ b/csharp/Makefile.am
@@ -59,15 +59,15 @@ GenerateTables.exe: $(SOURCES_GENERATE)
`for src in $(SOURCES_GENERATE); do echo $(srcdir)/$$src; done`
if ! test -f rfc3454.txt; then \
ln -s $(SPEC)/rfc3454.txt . \
- || cp $(SPEC)/rfc3454.txt .; \
+ || cp $(SPEC)/rfc3454.txt . || true; \
fi
if ! test -f UnicodeData.txt; then \
ln -s $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt \
- || cp $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt; \
+ || cp $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt || true; \
fi
if ! test -f CompositionExclusions.txt; then \
ln -s $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt \
- || cp $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt; \
+ || cp $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt || true; \
fi
RFC3454.cs CombiningClass.cs DecompositionKeys.cs DecompositionMappings.cs Composition.cs: $(GEN_SOURCES)
diff --git a/lib/punycode.c b/lib/punycode.c
index f7c63e6..bb5f34b 100644
--- a/lib/punycode.c
+++ b/lib/punycode.c
@@ -228,7 +228,7 @@ punycode_encode (size_t input_length,
output[out++] = case_flags ?
encode_basic (input[j], case_flags[j]) : (char) input[j];
}
- else if (input[j] > 0x10FFFF)
+ else if (input[j] > 0x10FFFF || (input[j] >= 0xD800 && input[j] <= 0xDBFF))
return punycode_bad_input;
/* else if (input[j] < n) return punycode_bad_input; */
/* (not needed for Punycode with unsigned code points) */
@@ -378,6 +378,9 @@ punycode_decode (size_t input_length,
return punycode_bad_input;
output[out++] = input[j];
}
+ for (j = b + (b > 0); j < input_length; ++j)
+ if (!basic (input[j]))
+ return punycode_bad_input;
/* Main decoding loop: Start just after the last delimiter if any */
/* basic code points were copied; start at the beginning otherwise. */
@@ -420,7 +423,7 @@ punycode_decode (size_t input_length,
if (i / (out + 1) > maxint - n)
return punycode_overflow;
n += i / (out + 1);
- if (n > 0x10FFFF)
+ if (n > 0x10FFFF || (n >= 0xD800 && n <= 0xDBFF))
return punycode_bad_input;
i %= (out + 1);
--
cgit v1.0-41-gc330

View File

@ -0,0 +1,61 @@
From d011a6ae00ce9abd445d6d01ce9131a7b97ef5bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 3 Oct 2017 10:04:18 +0200
Subject: [PATCH] Allow disabling Emacs support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch adds --disable-emacs configure option to disable installing
LISP scripts for Emacs.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
configure.ac | 9 ++++++++-
src/Makefile.am | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 649ddcd..a6dc9ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,6 @@ AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
AM_GNU_GETTEXT(external)
AM_GNU_GETTEXT_VERSION(0.19.3)
AM_ICONV
-AM_PATH_LISPDIR
if test "$am_cv_func_iconv" != "yes"; then
AC_MSG_NOTICE([
@@ -100,6 +99,14 @@ AM_CONDITIONAL(JAVA, test "$enable_java" != "no")
AC_MSG_CHECKING([if implementation in Java should be built])
AC_MSG_RESULT($enable_java)
+# Check for Emacs
+AC_ARG_ENABLE(emacs, AC_HELP_STRING([--disable-emacs], [disable Emacs support]),
+ enable_emacs=$enableval, enable_emacs=yes)
+AM_CONDITIONAL(EMACS, test "$enable_emacs" != "no")
+if test "$enable_emacs" != "no"; then
+ AM_PATH_LISPDIR
+fi
+
# Check for C#
if test -n "$HAVE_CSHARPCOMP"; then
gt_CSHARPEXEC
diff --git a/src/Makefile.am b/src/Makefile.am
index 6832c20..ec99560 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,9 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib -I$(top_srcdir)/gl -I../gl
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"
+if EMACS
dist_lisp_DATA = punycode.el idna.el
+endif
bin_PROGRAMS = idn
idn_SOURCES = idn.c
--
2.13.6

BIN
libidn-1.35.tar.gz Normal file

Binary file not shown.

122
libidn.spec Normal file
View File

@ -0,0 +1,122 @@
Name: libidn
Version: 1.35
Release: 5
Summary: GNU IDN Library - Libidn
License: LGPLv2+ and GPLv3+ and GFDL
URL: http://www.gnu.org/software/libidn/
Source0: http://ftp.gnu.org/gnu/libidn/libidn-%{version}.tar.gz
#patch from RedHat add --disable-emacs
Patch0: libidn-1.33-Allow-disabling-Emacs-support.patch
Patch6000: 0002-Check-codepoint-validity-in-punycode_decode-and-puny.patch
#patch from RedHat fix memory leak
Patch6001: 0003-Fix-unlikely-memory-leak-in-idna_to_unicode_4z4z.patch
Patch6002: 0004-Fix-build-failure-in-csharp.patch
BuildRequires: autoconf autoconf-archive automake libtool texinfo
BuildRequires: gcc gettext gettext-devel pkgconfig help2man emacs
Provides: bundled(gnulib)
Obsoletes: emacs-libidn < 1.30-4
Provides: emacs-libidn < 1.30-4
Requires: emacs-filesystem >= %{_emacs_version}
%description
GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA 2003 specifications.
Libidn's purpose is to encode and decode internationalized domain names.
%package devel
Summary: Development files for the libidn library
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
%description devel
This package includes header files and libraries necessary for
developing programs which use the GNU libidn library.
%package java
Summary: Java port of the GNU Libidn library
BuildRequires: java-devel javapackages-local
BuildRequires: mvn(com.google.code.findbugs:annotations)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(junit:junit)
BuildArch: noarch
%description java
This package contains the native Java port of the library.
%package javadoc
Summary: Javadoc for %{name}-java
BuildArch: noarch
%description javadoc
This package contains javadoc for %{name}-java.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
autoreconf -vif
touch src/idn_cmd.c src/idn_cmd.h
%build
%configure --disable-csharp --enable-java --enable-emacs
%make_build
%install
%make_install
rm -rf %{buildroot}%{_datadir}/info/dir
rm -rf %{buildroot}%{_libdir}/*.la \
%{buildroot}%{_datadir}/info/*.png
rm -rf doc/java/*
%javadoc -source 1.6 -d doc/java $(find java/src/main/java -name "*.java")
rm -rf $RPM_BUILD_ROOT%{_javadir}/libidn*.jar
%mvn_artifact java/pom.xml java/libidn-%{version}.jar
%mvn_file org.gnu.inet:libidn libidn
%mvn_install -J doc/java
%find_lang %{name}
%ldconfig_scriptlets
%files -f %{name}.lang
%license COPYING*
%doc AUTHORS NEWS FAQ THANKS README
%{_bindir}/idn
%{_libdir}/libidn.so.12*
%{_datadir}/emacs/site-lisp/*.el
%files devel
%{_libdir}/libidn.so
%{_libdir}/*.a
%{_includedir}/*.h
%{_libdir}/pkgconfig/*.pc
%files java -f .mfiles
%license COPYING* java/LICENSE-2.0.txt
%files javadoc -f .mfiles-javadoc
%license COPYING* java/LICENSE-2.0.txt
%files help
%{_mandir}/man1/idn.1*
%{_mandir}/man3/*
%{_infodir}/%{name}.info.gz
%changelog
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.35-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Fix build failure in csharp
* Mon Sep 2 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.35-4
- Package init