URL: <http://gna.org/bugs/?23956>
Summary: diplomats.c has many 'unit_alive(were_checking_if_this_is_illegal_ptr->id)' -constructs Project: Freeciv Submitted by: cazfi Submitted on: Wed 21 Oct 2015 12:48:34 AM EEST Category: None Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: S2_6 Discussion Lock: Any Operating System: None Planned Release: _______________________________________________________ Details: unit_alive() checks in diplomats.c may result in an illegal memory access for the very reason unit_alive() is supposed to protect against (using pointers to a dead unit). Unfortunately it's not obvious what to do to those cases. Are they kind of sanity checks that can simply be removed? Or do we need to get the 'id' from the time unit was certainly alive from somewhere? There's such uses in unithand.c too. By a quick look two of them are both completely safe and useless - the unit pointer is a result from a id based query just before those unit existence checks. _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?23956> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev