<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch release-2.7
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/b108c19396bf002a61f57f78863bdb974418c46a">https://github.com/macports/macports-base/commit/b108c19396bf002a61f57f78863bdb974418c46a</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b108c19396bf002a61f57f78863bdb974418c46a
</span>Author: Christopher Chavez <chrischavez@gmx.us>
AuthorDate: Sat Oct 2 15:01:04 2021 -0500
<span style='display:block; white-space:pre;color:#404040;'> Fix Tcl bug 98af80f133: unsafe buffer lifetime
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> (cherry picked from commit f1100f154cde2bc4d6568944bfd98fc5cbd6dceb)
</span>---
.../patches/tcl/fix-unsafe-buffer-lifetime.patch | 33 ++++++++++++++++++++++
vendor/tcl8.5.19/generic/tclIO.c | 3 +-
2 files changed, 35 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/vendor/patches/tcl/fix-unsafe-buffer-lifetime.patch b/vendor/patches/tcl/fix-unsafe-buffer-lifetime.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000..7e6cd408
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/vendor/patches/tcl/fix-unsafe-buffer-lifetime.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,33 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"Fix unsafe buffer lifetime" (Tcl bug exposed by LLVM Clang 13 optimization)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+https://core.tcl-lang.org/tcl/info/98af80f133
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Index: generic/tclIO.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+==================================================================
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/vendor/tcl8.5.19/generic/tclIO.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/vendor/tcl8.5.19/generic/tclIO.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -3811,10 +3811,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ChannelState *statePtr = chanPtr->state;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* State info for channel */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ char *nextNewLine = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char safe[BUFFER_PADDING];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (srcLen) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ WillWrite(chanPtr);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -3829,11 +3830,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ nextNewLine = memchr(src, '\n', srcLen);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ while (srcLen + saved + endEncoding > 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ChannelBuffer *bufPtr;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- char *dst, safe[BUFFER_PADDING];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char *dst;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int result, srcRead, dstLen, dstWrote, srcLimit = srcLen;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (nextNewLine) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ srcLimit = nextNewLine - src;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/vendor/tcl8.5.19/generic/tclIO.c b/vendor/tcl8.5.19/generic/tclIO.c
</span><span style='display:block; white-space:pre;color:#808080;'>index 7bc849e0..c2150bf7 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/vendor/tcl8.5.19/generic/tclIO.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/vendor/tcl8.5.19/generic/tclIO.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3765,6 +3765,7 @@ Write(
</span> /* State info for channel */
char *nextNewLine = NULL;
int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0;
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ char safe[BUFFER_PADDING];
</span>
if (srcLen) {
WillWrite(chanPtr);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3783,7 +3784,7 @@ Write(
</span>
while (srcLen + saved + endEncoding > 0) {
ChannelBuffer *bufPtr;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- char *dst, safe[BUFFER_PADDING];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ char *dst;
</span> int result, srcRead, dstLen, dstWrote, srcLimit = srcLen;
if (nextNewLine) {
</pre><pre style='margin:0'>
</pre>