bugFreeciv - Bugs: bug #22083, apply_disaster() can reference...

 
 
Show feedback again

bug #22083: apply_disaster() can reference city after it's freed

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Sun 25 May 2014 11:27:18 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Jacob Nevins <jtn>Open/Closed: Closed
Release: S2_5 r24940Operating System: Any
Planned Release: 2.5.0, 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 02 Jun 2014 09:28:49 PM UTC, SVN revision 25027:

Reorder disaster effects code for consistency with trunk, and so that if
assertion fails, NULL pointer isn't dereferenced.

See gna bug #22083.

(Browse SVN revision 25027)

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.
Mon 02 Jun 2014 09:27:13 PM UTC, SVN revision 25023:

Reorder disaster effects so that city destroyed by population loss is
not subsequently referenced.

See gna bug #22083.

(Browse SVN revision 25023)

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.
Sat 31 May 2014 09:34:30 PM UTC, comment #3:

Patch written assuming patch #4719 gets committed first.
With that patch, this becomes less important on S2_5, but I plan to commit there for the sake of keeping the code similar.

(file #20893, file #20894)

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.
Sun 25 May 2014 12:18:28 PM UTC, comment #2:

> Having DE_REDUCE_POP able to destroy cities seems very fierce

Discussion of this tangent moved to new bug #22084.

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.
Sun 25 May 2014 11:46:17 AM UTC, comment #1:

> I'm inclined to add a similar disaster effect that can only
> reduce population, not destroy a city.

Wait, we can do that with reqs. Never mind.

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.
Sun 25 May 2014 11:27:18 AM UTC, original submission:

I think that a disaster which has the ReducePopulation effect and some other effect (such as 'Nuclear Accident' in the classic ruleset), if the city was size 1 and thus destroyed, can cause pcity to be referenced after being freed. (Untested.)

Disaster effects after ReducePopulation should check city_or_null (or possibly pcity should become NULL) before doing their thing.

Also, disaster effects should be reordered. It's silly saying a building is destroyed when the whole city is then lost. On the other hand, pollution/fallout effects can sensibly occur simultaneously with city loss, so should be moved before DE_REDUCE_POP.

(Having DE_REDUCE_POP able to destroy cities seems very fierce for a random disaster. I'm inclined to add a similar disaster effect that can only reduce population, not destroy a city. But that's a new ticket. Too late for 2.5?)

Jacob Nevins <jtn>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #20893:  trunk-disaster-effect-rearrange.patch added by jtn (4kB - text/x-patch - trunk/S2_5 r24989 + patch #4719)
file #20894:  S2_5-disaster-effect-rearrange.patch added by jtn (4kB - text/x-patch - trunk/S2_5 r24989 + patch #4719)

 

Digest:
   patch dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jtn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 02 Jun 2014 09:31:48 PM UTCjtnStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Sat 31 May 2014 09:34:30 PM UTCjtnAttached File-=>Added trunk-disaster-effect-rearrange.patch, #20893
      Attached File-=>Added S2_5-disaster-effect-rearrange.patch, #20894
      StatusIn Progress=>Ready For Test
      Dependencies-=>Depends on patch #4719
    Sun 25 May 2014 05:49:33 PM UTCjtnStatusNone=>In Progress
      Assigned toNone=>jtn
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup