Author Topic: Worst bug you had?  (Read 79797 times)

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Worst bug you had?
« on: October 14, 2007, 02:42:35 PM »
This must be it. This is the third day I try to find it and no luck this far. It's probably buffer overrun (with random crashes) so it can be almost anywhere.. I'm going through all raw arrays, I have quite a lot of them. This bug has existed for some time now so it's not obvious that it's a result of recent changes.

corremn

  • Rogueliker
  • ***
  • Posts: 700
  • Karma: +0/-0
  • SewerJack Extraordinaire
    • View Profile
    • Demise RogueLike Games
Re: Worst bug you had?
« Reply #1 on: October 14, 2007, 03:03:42 PM »
Buffer overruns, a plague of c/c++ coding.  Probably a result of using too much c code in you c++ program.
I have a habit of using things like char buf[64] embedding in my code because I am too lazy to write using streams or strings.

Good luck, null pointers and stack corruption are nightmares indeed.
corremn's Roguelikes. To admit defeat is to blaspheme against the Emperor.  Warhammer 40000 the Roguelike

Ex

  • IRC Communications Delegate
  • Rogueliker
  • ***
  • Posts: 313
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #2 on: October 14, 2007, 04:17:34 PM »
The worst bugs I've had have been with dangling pointers invalidating other parts of my code. These are a nightmare because they wreck some completely unrelated piece of code.

Robson

  • Newcomer
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #3 on: October 15, 2007, 07:10:08 PM »
My worst bugs are ones that other people find and I can't replicate. Usually these types of bugs have no obvious reason for them occuring, which makes them just a bit more difficult to work out.

What's happened to your blog, Krice? It's been 404'd for a couple of days.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Worst bug you had?
« Reply #4 on: October 16, 2007, 05:36:17 AM »
What's happened to your blog, Krice? It's been 404'd for a couple of days.

Deleted it completely.

Anvilfolk

  • Rogueliker
  • ***
  • Posts: 374
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #5 on: October 16, 2007, 01:08:35 PM »
Why? :\
"Get it hot! Hit it harder!!!"
 - The tutor warcry

One of They Who Are Too Busy

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Worst bug you had?
« Reply #6 on: October 17, 2007, 06:43:53 AM »
Why? :\

I'm writing too much stuff anyway.

Tarindel

  • Newcomer
  • Posts: 24
  • Karma: +0/-0
    • View Profile
    • Subterrane
Re: Worst bug you had?
« Reply #7 on: October 18, 2007, 05:27:26 AM »
For me, most of the worst bugs have been related to uninitialized variables.  They're one of the hardest kind of bugs to find, because they produce intermittent behavior, AND they act differently in the debugger (where they typically get initialized to 0) as opposed to release, which makes finding them super difficult.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Worst bug you had?
« Reply #8 on: October 19, 2007, 01:02:38 PM »
they act differently in the debugger (where they typically get initialized to 0) as opposed to release, which makes finding them super difficult.

Can't you make the compiler warn about uninitialized variables? You can do that in VC++ which has W3 by default, but when you turn on W4 you get warnings from even potential uninitialized variables (along with zillions of type conversions..).

Anvilfolk

  • Rogueliker
  • ***
  • Posts: 374
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #9 on: October 19, 2007, 07:15:39 PM »
-Wall for gcc does it also.

And best of all: good practice! ;)
"Get it hot! Hit it harder!!!"
 - The tutor warcry

One of They Who Are Too Busy

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Worst bug you had?
« Reply #10 on: November 11, 2007, 10:35:50 AM »
Fixed one buffer overrun and the bug seems to be gone, at least doesn't appear that often. This buffer overrun wasn't from for-loop but adding pos+offset where offset had too big values (actually the offset was using a wrong variable so I fixed that).

elsairon

  • Newcomer
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #11 on: January 04, 2008, 02:50:57 AM »
Worst bug I had was also the stupidest ever... Game was crashing randomly for some unknown reason, but usually it didn't.

Eventually I found (by implementing more movement AI) that movement code was not being checked and creatures sometimes tried to move off the map edges.

The display code then tried to draw them .. and crash.

Lesson: assert that values of parameters and return values for functions are in the allowable range before using them.

Gamer_2k4

  • Rogueliker
  • ***
  • Posts: 86
  • Karma: +0/-0
    • View Profile
Re: Worst bug you had?
« Reply #12 on: January 07, 2008, 11:28:15 PM »
This bug has existed for some time now so it's not obvious that it's a result of recent changes.

I suppose you've figured this out by now, but it is CRUCIAL to fix random crashes immediately.  It saves so much time, since you have a fairly good idea of what might've caused the crash.
Gamer_2k4

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Worst bug you had?
« Reply #13 on: January 10, 2008, 11:35:33 AM »
I suppose you've figured this out by now, but it is CRUCIAL to fix random crashes immediately.

I believe everything can be fixed later, also fatal bugs. I just can't spend weeks finding one damn bug, the content development must go on. Besides there are still some bad procedural constructions like raw arrays and I'm planning to fix them as I proceed in the development so hopefully that will fix the bug.

Slash

  • Creator of Roguetemple
  • Administrator
  • Rogueliker
  • *****
  • Posts: 1203
  • Karma: +4/-1
    • View Profile
    • Slashie.net
    • Email
Re: Worst bug you had?
« Reply #14 on: January 10, 2008, 12:46:40 PM »
The keyword here is Random, not Fatal; if you push on development the codebase will grow bigger and thus the bug will be harder to find.