empserver/tests
Markus Armbruster 2b80ce93da edit: Fix integer argument range checking
Upper bounds corrected:

    cmd  key  struct member   wrong   correct   notes
    -------------------------------------------------
    edit l m  sct_mobil         255       127      1
           t  sct_ptime         255     32767
    edit c b  nat_btu          1024  max_btus
    edit p m  pln_mobil         255       127      1
    edit u F  lnd_harden        255       127	   1

Missing bounds supplied, arguments out of bounds are silently clipped
unless noted otherwise:

    cmd  key     struct member   bounds           notes
    ---------------------------------------------------
    edit c t     nat_tgms        0   USHRT_MAX       2
           m     nat_reserve     0   INT_MAX
           T...  nat_level[]     0   infinity
    edit s a     shp_pstage      0   PLG_EXPOSED     3
           b     shp_ptime       0   32767
           M     shp_mobil    -127   127
           c...  shp_item[]      0   load limit      4
    edit u Y     lnd_land       -1   size of table   5
           M     lnd_mobil    -127   127
           S     lnd_ship       -1   size of table   5
           Z     lnd_retreat     0   100
           c...  lnd_item[]      0   load limit      4
    edit p r     pln_range       0   max range
           s     pln_ship       -1   size of table   5
           y     pln_land       -1   size of table   5

Notes:

1. Values between SCHAR_MAX and 255 were cast to signed char, changing
the sign.

2. The real upper bound is the number of telegrams in the mailbox, but
counting them isn't worth it.

3. This check is particularly important, because values out of bounds
make the server refuse to start without -F, and empdump -x warn
"export has errors, not importable as is".

4. Values outside 0..ITEM_MAX got caught and clipped by
item_prewrite().  This check avoids the oops, and tightens the upper
bound for units.

5. Argument out-of-bounds are rejected.  This check is particularly
important, because unit numbers beyond the size of the table trigger
oopses.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-06-06 19:52:26 +02:00
..
actofgod edit: Fix integer argument range checking 2013-06-06 19:52:26 +02:00
fairland Change fairland island size probability distribution 2013-05-08 06:57:55 +02:00
files Use int instead of signed char for pln_flags 2013-05-08 06:57:54 +02:00
smoke tests: Capture player output via journal instead of client 2013-05-31 10:52:50 +02:00
actofgod-test tests/actofgod: New, disabled for now because it oopses 2013-06-06 19:52:20 +02:00
fairland-test Switch PRNG from BSD random() to Mersenne Twister 2013-05-08 06:55:21 +02:00
files-test Add files test to make check 2013-05-08 06:55:18 +02:00
normalize.pl tests: Cut off log file timestamp instead of normalizing it 2013-05-31 09:54:50 +02:00
smoke-test tests: Capture player output via journal instead of client 2013-05-31 10:52:50 +02:00
test-common.sh tests: Capture player output via journal instead of client 2013-05-31 10:52:50 +02:00