URL:
  <http://gna.org/bugs/?18673>

                 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
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: 

    _______________________________________________________

Details:

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
first.

Contrived (unplayable) example attached, with the following settings
section:


[settings]
set={"name","value","gamestart"
; Test validation
; This would fit in 2048000 tiles, but ysize defaults to 64, which combined
; with this xsize, is too big
"mapsize","XYSIZE","XYSIZE"
"xsize",32767,32767
"ysize",32,32
}
set_count=3
gamestart_valid=TRUE


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:

  <http://gna.org/bugs/?18673>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to