Search code examples
c++crash-dumps

Application crashes, because of a high input


My application is terminating with signal 11 - segmentation fault.

Core dump has been generated, and it say the following:

#0  Players::shareExperience (this=0x7fd3f8187600,
    experience=401912970206.76483154296875, m=<value optimized out>,
    multiplied=<value optimized out>) at players.cpp:130
130                     (*it)->gainSharedExperience(tmpExperience, m                                                                                                                               , multiplied);

This happends, when player is killing a monster, and get high amount of experience.

In my opinion, it shouldn't crash, because the expierience on 130 line is a long double , so it should handle that.

Is there any way, to handle that big amount of numbers? This is probably the expierience that player get when monster it killed: experience=401912970206.76483154296875 isnt long double enough for that?


Solution

  • That fault is not from the large long double value, it is most likely from dereferencing an invalid iterator in it (or an iterator with an invalid pointer value).