Tíquete #39619

Autopick crash with no preference files

: 2019-09-29 04:44 Última Atualização: 2021-01-01 23:02

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
(Nenhum)
Prioridade:
3
Gravidade:
3
Resolução:
Fixed
Arquivo:
1

Details

In the English version compiled for Mac OS X (based on the 2.2.1.7 master branch), if neither of the autopick preference files are present and the player selects 'Auto' when destroying an object, the game crashes with a segmentation fault. The top of the call stack at the point of the crash is:

libsystem_c.dylib`flockfile + 18
libsystem_c.dylib`fgets + 42
hengband`my_fgets(fff=0x0000000000000000, buf="\x90Ϳ??", n=1024) at util.c:445:6
hengband`autopick_autoregister(o_ptr=0x0000000109e5fec4) at autopick.c:1959:7
hengband`do_cmd_destroy at cmd-item.c:694:9

In that situation, the first two my_fopen(pref_file, 'r') calls in autopick_autoregister() return a null pointer so pref_fff is null when my_fgets() is called in the while loop. The attached patch resolves the problem by skipping the while loop and close if neither of the preference files could be opened. It does try to append to the preference file (i.e. create it if necessary) in that situation.

Ticket History (3/7 Histories)

2019-09-29 04:44 Updated by: backwardseric
  • New Ticket "Autopick crash with no preference files" created
2019-10-25 01:22 Updated by: deskull
2020-01-20 22:10 Updated by: hourier
Comentário

本件修正し、feature/Refactoring-Hourierブランチにてコミットしました。 後ほどマージ願います

(Edited, 2020-01-20 22:36 Updated by: hourier)
2020-01-21 00:27 Updated by: deskull
  • Estado Update from Aberto to Fechado
Comentário

修正ありがとうございました。チケット閉じます。

2020-01-25 18:05 Updated by: deskull
  • Dono Update from deskull to hourier
2021-01-01 23:02 Updated by: deskull

Attachment File List

Editar

Please login to add comment to this ticket » Login