summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2020-09-12 22:10:22 (GMT)
committermarc_culler <marc.culler@gmail.com>2020-09-12 22:10:22 (GMT)
commit0e615addeecefdcb56a2623a7a6fe871bb2d4c05 (patch)
treea332cdff7e97f9d87b1fd206ed3f83b52ca38a9d
parentcd9987e74b4772140be98620c89fde03aac58ea2 (diff)
downloadtk-0e615addeecefdcb56a2623a7a6fe871bb2d4c05.zip
tk-0e615addeecefdcb56a2623a7a6fe871bb2d4c05.tar.gz
tk-0e615addeecefdcb56a2623a7a6fe871bb2d4c05.tar.bz2
Apply patch from Christopher Chavez to address UBSan warnings about alignment in ttkMacOSXTheme.c
-rw-r--r--macosx/ttkMacOSXTheme.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index e999fc2..316d52e 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -2144,10 +2144,13 @@ static void TrackElementDraw(
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
factor = RangeToFactor(to);
+ // HIThemeTrackDrawInfo uses 2-byte alignment; assign to separate
+ // bounds variable to avoid UBSan (-fsanitize=alignment) complaint.
+ CGRect bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind = data->kind,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = from * factor,
.max = to * factor,
.value = value * factor,
@@ -2282,13 +2285,16 @@ static void PbarElementDraw(
Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
factor = RangeToFactor(maximum);
+ // HIThemeTrackDrawInfo uses 2-byte alignment; assign to separate
+ // bounds variable to avoid UBSan (-fsanitize=alignment) complaint.
+ CGRect bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind =
(!strcmp("indeterminate",
Tcl_GetString(pbar->modeObj)) && value) ?
kThemeIndeterminateBar : kThemeProgressBar,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = 0,
.max = maximum * factor,
.value = value * factor,