Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-10-28 19:49:59 +0300
committerSimon Tatham <anakin@pobox.com>2022-10-28 19:49:59 +0300
commit475c23875e459525bad449b328e4a455e60a9178 (patch)
tree8cbe2aeab24ff66cbd13cd41b1fc5f6e43cb679a
parenta7106d8eb26981a372ce7462d70d81a870a2a592 (diff)
Unix: stop accessing ctrl->fileselect for font selectors.
The setup code for CTRL_FILESELECT and CTRL_FONTSELECT is shared, which means it's a mistake to test ctrl->fileselect.just_button in it without first checking which control type we're actually dealing with. UBsan picks this up by complaining that the just_button field contains some byte value that's illegal for a boolean. I think it's also the cause of an intermittent assertion failure reported recently, in which dlg_fontsel_set finds that uc->entry is NULL when it never ought to be. If the byte from the wrong union branch happened to be 0 by sheer bad luck, that could give rise to exactly that failure.
-rw-r--r--unix/dialog.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/unix/dialog.c b/unix/dialog.c
index 7e9051be..5846466a 100644
--- a/unix/dialog.c
+++ b/unix/dialog.c
@@ -2143,7 +2143,10 @@ GtkWidget *layout_ctrls(
case CTRL_FONTSELECT: {
GtkWidget *ww;
- if (!ctrl->fileselect.just_button) {
+ bool just_button = (ctrl->type == CTRL_FILESELECT &&
+ ctrl->fileselect.just_button);
+
+ if (!just_button) {
const char *browsebtn =
(ctrl->type == CTRL_FILESELECT ?
"Browse..." : "Change...");