EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   Possible Invalid Pointer Bug... (https://www.eqemulator.org/forums/showthread.php?t=38283)

Uleat 05-11-2014 09:22 PM

Possible Invalid Pointer Bug...
 
This thread is the result of this crash: http://wiki.eqemulator.org/i?M=Pastebin&Paste=ftJoFBpe

Plain and simple..I believe the cause is related to an early access of a Client property before it has been initialized.


The failure (most likely an 'Access Violation' error):

Code:

if(this->aa) {
    for (i = 0; i < MAX_PP_AA_ARRAY; i++) {        //iterate through all of the client's AAs
        if (this->aa[i]) {        // make sure aa exists or we'll crash zone
            aa_AA = this->aa[i]->AA;        //same as aaid from the aa_effects table
            aa_value = this->aa[i]->value;        //how many points in it
            if (aa_AA > 0 || aa_value > 0) {        //do we have the AA? if 1 of the 2 is set, we can assume we do
                //slots = database.GetTotalAALevels(aa_AA);        //find out how many effects from aa_effects table
                slots = zone->GetTotalAALevels(aa_AA);        //find out how many effects from aa_effects, which is loaded into memory
                if (slots > 0)        //and does it have any effects? may be able to put this above, not sure if it runs on each iteration
                    ApplyAABonuses(aa_AA, slots, newbon);        //add the bonuses
            }
        }
    }
}

The crash occurs on access to the structure pointer in the array.

This array ('aa') has not been assigned when this code tries to access the pointer. This only appears to occur when an AE spell goes off
in the vicinty of a client that has not 'FinishedLoading' (i.e., someone who has made contact with the zone server..but, not yet in-game.)

There may be some other occurrences where this happens..but, I did attempt a fix for this and am awaiting feedback.

If this does indeed fix the issue, we will probably need to address all of the entity list AE functions.


This entire check is the fix..I had to change the method checked in this commit due to a misunderstanding of the connection vs. client load state
naming conventions... (client load state = 'conn_state'; connection state = 'client_state' - go figure...)
https://github.com/EQEmu/Server/comm...4004a0ecd31801

vsab 05-12-2014 03:46 AM

How much of a ballache would it be to rename those variables to something that won't catch someone out at a later date?

Uleat 05-30-2014 09:51 PM

Maybe KLS can rename those when he reworks the mob classes :P

Uleat 08-16-2014 10:16 PM

Ok..I did receive some feedback on this fix today...

It looks like it may have helped..though, I imagine there are some other places that similar changes need to be made.


Please keep this post in mind when tracing pointer-related crashes.


All times are GMT -4. The time now is 05:11 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.