Skip to content

Commit

Permalink
Windows: backport fix for asan range error
Browse files Browse the repository at this point in the history
  • Loading branch information
nhmall committed Mar 23, 2023
1 parent 557e186 commit eff7cfb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/fixes36.7
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ none
Fixes to 3.6.7 Post-release Problems and other Post-release changes
-------------------------------------------------------------------
extend the fix for build failure with newer c library headers to macOS (pr #988)
Windows: fix range error detected by address sanitizer in plselInitDialog()



4 changes: 3 additions & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ graphicschk
nhdat
o
nhdat*

#address san
*.exp
*.lib
3 changes: 3 additions & 0 deletions util/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ xpm2ppm.ttp
# dev tool for analyzing data collected by nethack's #define MONITOR_HEAP
heaputil
heaputil.c
#address san
*.exp
*.lib
10 changes: 6 additions & 4 deletions win/win32/mhdlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ plselInitDialog(struct plsel_data * data)
{
TCHAR wbuf[BUFSZ];
LVCOLUMN lvcol;
control_t *control;

SetWindowLongPtr(data->dialog, GWLP_USERDATA, (LONG_PTR) data);

Expand Down Expand Up @@ -654,10 +655,11 @@ plselInitDialog(struct plsel_data * data)
plselAdjustSelections(data->dialog);

/* set tab order */
control_t * control = &data->controls[psc_quit_button];
for(int i = psc_quit_button; i >= psc_name_box; i--, control++)
SetWindowPos(control->hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

for(int i = psc_quit_button; i >= psc_name_box; i--) {
control = &data->controls[i];
SetWindowPos(control->hWnd, NULL, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
}
do_player_selector_layout(data);

center_dialog(data->dialog);
Expand Down

0 comments on commit eff7cfb

Please sign in to comment.