Sunday, October 31, 2021

llvm13: fix lang/tcl

tim@ mentioned that the databases/sqlcipher build failure with llvm13
looks like source code corruption. x11/tkhtml also fails with garbage
in the source file. Both ports uses Tcl to generate source files.

sthen@ has found this upstream bug report and fix:

Fix unsafe buffer lifetime
https://core.tcl-lang.org/tcl/info/24b9181478

Applying this to our lang/tcl/8.[56] ports fixes the corruption seen
in sqlcipher and tkhtml with llvm13.

OK?

Index: 8.5/Makefile
===================================================================
RCS file: /cvs/ports/lang/tcl/8.5/Makefile,v
retrieving revision 1.45
diff -u -p -r1.45 Makefile
--- 8.5/Makefile 12 Jul 2019 20:47:23 -0000 1.45
+++ 8.5/Makefile 31 Oct 2021 20:38:08 -0000
@@ -5,7 +5,7 @@ COMMENT = Tool Command Language
DISTNAME = tcl8.5.19
PKGNAME = tcl-8.5.19
PKGSTEM = tcl-8.5
-REVISION = 4
+REVISION = 5
SHARED_LIBS = tcl85 1.8
CATEGORIES = lang lang/tcl
HOMEPAGE = http://www.tcl.tk/
Index: 8.5/patches/patch-generic_tclIO_c
===================================================================
RCS file: 8.5/patches/patch-generic_tclIO_c
diff -N 8.5/patches/patch-generic_tclIO_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 8.5/patches/patch-generic_tclIO_c 31 Oct 2021 20:38:08 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Fix unsafe buffer lifetime
+https://core.tcl-lang.org/tcl/info/24b9181478
+
+Index: generic/tclIO.c
+--- generic/tclIO.c.orig
++++ generic/tclIO.c
+@@ -3765,6 +3765,7 @@ Write(
+ /* State info for channel */
+ char *nextNewLine = NULL;
+ int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0;
++ char safe[BUFFER_PADDING];
+
+ if (srcLen) {
+ WillWrite(chanPtr);
+@@ -3783,7 +3784,7 @@ Write(
+
+ while (srcLen + saved + endEncoding > 0) {
+ ChannelBuffer *bufPtr;
+- char *dst, safe[BUFFER_PADDING];
++ char *dst;
+ int result, srcRead, dstLen, dstWrote, srcLimit = srcLen;
+
+ if (nextNewLine) {
Index: 8.6/Makefile
===================================================================
RCS file: /cvs/ports/lang/tcl/8.6/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- 8.6/Makefile 12 Jul 2019 20:47:23 -0000 1.23
+++ 8.6/Makefile 31 Oct 2021 20:38:08 -0000
@@ -10,7 +10,7 @@ SHARED_LIBS = tcl86 1.${P}
CATEGORIES = lang lang/tcl
HOMEPAGE = http://www.tcl.tk/
MAINTAINER = Stuart Cassoff <stwo@users.sourceforge.net>
-REVISION = 2
+REVISION = 3

# BSD
PERMIT_PACKAGE = Yes
Index: 8.6/patches/patch-generic_tclIO_c
===================================================================
RCS file: 8.6/patches/patch-generic_tclIO_c
diff -N 8.6/patches/patch-generic_tclIO_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 8.6/patches/patch-generic_tclIO_c 31 Oct 2021 20:38:08 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Fix unsafe buffer lifetime
+https://core.tcl-lang.org/tcl/info/24b9181478
+
+Index: generic/tclIO.c
+--- generic/tclIO.c.orig
++++ generic/tclIO.c
+@@ -4242,6 +4242,7 @@ Write(
+ /* State info for channel */
+ char *nextNewLine = NULL;
+ int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0;
++ char safe[BUFFER_PADDING];
+
+ if (srcLen) {
+ WillWrite(chanPtr);
+@@ -4260,7 +4261,7 @@ Write(
+
+ while (srcLen + saved + endEncoding > 0) {
+ ChannelBuffer *bufPtr;
+- char *dst, safe[BUFFER_PADDING];
++ char *dst;
+ int result, srcRead, dstLen, dstWrote, srcLimit = srcLen;
+
+ if (nextNewLine) {
--
Christian "naddy" Weisgerber naddy@mips.inka.de

No comments:

Post a Comment