aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbland <bland@FreeBSD.org>2010-02-06 08:55:44 +0800
committerbland <bland@FreeBSD.org>2010-02-06 08:55:44 +0800
commitaceb11b13310dda537151a492c4f5ff1593c3ce5 (patch)
tree9d065fa513061c4870cc1000070517a00e7d44ec
parent6e464e34205daaadb4e32cc2968a6f1cf5e9f04b (diff)
downloadfreebsd-ports-gnome-aceb11b13310dda537151a492c4f5ff1593c3ce5.tar.gz
freebsd-ports-gnome-aceb11b13310dda537151a492c4f5ff1593c3ce5.tar.zst
freebsd-ports-gnome-aceb11b13310dda537151a492c4f5ff1593c3ce5.zip
Apply patch from the upstream to prevent endless loop triggered by
incomplete UTF-8 sequence. PR: 143575
-rw-r--r--converters/libiconv/Makefile1
-rw-r--r--converters/libiconv/files/patch-endless-wchar_t-loop32
2 files changed, 33 insertions, 0 deletions
diff --git a/converters/libiconv/Makefile b/converters/libiconv/Makefile
index 657f2b62dba6..a6ee6b89099d 100644
--- a/converters/libiconv/Makefile
+++ b/converters/libiconv/Makefile
@@ -7,6 +7,7 @@
PORTNAME= libiconv
PORTVERSION= 1.13.1
+PORTREVISION= 1
CATEGORIES= converters devel
MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= ${PORTNAME}
diff --git a/converters/libiconv/files/patch-endless-wchar_t-loop b/converters/libiconv/files/patch-endless-wchar_t-loop
new file mode 100644
index 000000000000..5882ce0ce498
--- /dev/null
+++ b/converters/libiconv/files/patch-endless-wchar_t-loop
@@ -0,0 +1,32 @@
+--- lib/loop_wchar.h
++++ lib/loop_wchar.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2000-2002, 2005-2006, 2008 Free Software Foundation, Inc.
++ * Copyright (C) 2000-2002, 2005-2006, 2008-2009 Free Software Foundation, Inc.
+ * This file is part of the GNU LIBICONV Library.
+ *
+ * The GNU LIBICONV Library is free software; you can redistribute it
+@@ -321,7 +321,8 @@ static size_t wchar_to_loop_convert (iconv_t icd,
+ size_t result = 0;
+ while (*inbytesleft > 0) {
+ size_t incount;
+- for (incount = 1; incount <= *inbytesleft; incount++) {
++ for (incount = 1; ; ) {
++ /* Here incount <= *inbytesleft. */
+ char buf[BUF_SIZE];
+ const char* inptr = *inbuf;
+ size_t inleft = incount;
+@@ -403,6 +404,12 @@ static size_t wchar_to_loop_convert (iconv_t icd,
+ break;
+ }
+ }
++ incount++;
++ if (incount > *inbytesleft) {
++ /* Incomplete input. */
++ errno = EINVAL;
++ return -1;
++ }
+ }
+ }
+ return result;