diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-13 08:02:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-13 08:02:20 (GMT) |
commit | a04d502e04339887f374b998d257324712fe50d4 (patch) | |
tree | 9c5788b6859ab61bffbc04394b65a514485f63ec | |
parent | 15dc2cfa976b10c2dcd29e446a331a7d7f04b790 (diff) | |
download | tk-a04d502e04339887f374b998d257324712fe50d4.zip tk-a04d502e04339887f374b998d257324712fe50d4.tar.gz tk-a04d502e04339887f374b998d257324712fe50d4.tar.bz2 |
Possible fix for [dacd18294b]: Undefined behavior in tkTextBTree.c (out of bounds access in array)
-rw-r--r-- | generic/tkText.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tkText.h b/generic/tkText.h index 9aa3282..50f2290 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -168,9 +168,11 @@ typedef struct TkTextSegment { int size; /* Size of this segment (# of bytes of index * space it occupies). */ union { - char chars[TCL_UTF_MAX]; /* Characters that make up character info. - * Actual length varies to hold as many - * characters as needed.*/ +#if defined(__GNUC__) && (__GNUC__ > 2) + char chars[0]; /* Characters that make up character info. */ +#else /* Actual length varies to hold as many */ + char chars[1]; /* characters as needed. See [dacd18294b] */ +#endif TkTextToggle toggle; /* Information about tag toggle. */ TkTextMark mark; /* Information about mark. */ TkTextEmbWindow ew; /* Information about embedded window. */ |