Summary: Savegame setting loading can reject valid setting
combinations in contrived circumstances
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Sat Sep 17 16:15:25 2011
                Category: None
                Severity: 2 - Minor
                Priority: 3 - Low
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



In settings_game_load(), care is taken to only run setting action functions
once all settings are loaded to avoid dependency issues, but setting
validation functions are run one at a time during loading. Since some of these
functions do cross-checks (xsize/ysize, timeout/unitwaittime), depending on
the order of settings in the save file, it is possible for a setting to be
rejected even if it would have been valid had other settings been loaded

Contrived (unplayable) example attached, with the following settings

; Test validation
; This would fit in 2048000 tiles, but ysize defaults to 64, which combined
; with this xsize, is too big

which generates an error when loaded with trunk (r20250):

1: Savegame: error restoring 'xsize' . (The map size (32767 * 64 = 2097088)
must be lower than 2048000 tiles.)

but not if ysize is moved before xsize.

This is unlikely to bite anyone in practice at the moment, but if validation
functions get more cross-checking, it could become a problem.

This will be fiddly to fix, as the full set of new (or replaced) settings
will have to be held somewhere temporarily while the new set is validated, so
that settings that fail the validation at the end can be rolled back.

(Also, the non-setting-specific validation is not called, e.g.,
setting_int_validate() which does the range check.)


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to