]> git.pond.sub.org Git - empserver/commit - src/util/fairland.c
Fix an out-of-bounds subscript in fairland
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 5 May 2012 11:46:15 +0000 (13:46 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 5 May 2012 11:46:15 +0000 (13:46 +0200)
commit3464a4a9d000923815c752ea3a2ab5c7dd702dee
treee1cd839e0c47609fb95c17b5687f685f3429466e
parentb4b38bf859a4447c411b12da7e54aae11e2a7550
Fix an out-of-bounds subscript in fairland

elevate_land() tests for capital sector in three places.  The third
one is broken: half of the test is done even for islands, subscripting
capx[] and possibly capy[] out of bounds.  This could screw up
elevation (unlikely) or crash (even less likely).  Diagnosed with
valgrind.

Broken since the test was added in Chainsaw 3.12.  Parenthesis were
added blindly 4.0.11 to shut up the compiler.  Reindentation (commit
9b7adfbe and ef383c06, v4.2.13) made the bug stand out more, but it
still managed to hide in the general ugliness of fairland's code.
src/util/fairland.c