Author Topic: Yet another overflow bug from Testlund  (Read 2535 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Yet another overflow bug from Testlund
« on: January 12, 2014, 12:14:28 PM »
I know where this one is @
Don't know if I fixed it yet.
Running a sim until Tuesday.

Testlund, I have no idea what we will do without you man. You find such weird crazy bugs that I would not even think of where possible.

edit: On the flip side, my last employer says I do not do a good job debugging my code.
« Last Edit: January 12, 2014, 12:19:40 PM by Botsareus »

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Yet another overflow bug from Testlund
« Reply #1 on: January 12, 2014, 12:34:23 PM »
Does the last employer mean you aren't good at writing bugfree code? (as noone can)
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #2 on: January 12, 2014, 12:36:23 PM »
lol I actually know people that can write reasonably bug free code.

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Yet another overflow bug from Testlund
« Reply #3 on: January 12, 2014, 01:02:29 PM »
I think I'll look for a certification "how to write bugfree code", I need to learn that magic.
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #4 on: January 12, 2014, 01:11:05 PM »
Ns, but I was watching the master at work:

Take your code line by line, plug in all possible values (Did I check all inputs that the end user may do?) for each line, does the next line after that work correctly? Take about 10 lines, do these lines together work correctly? (Usually he brakes them up into sections based loops or conditional code) Take the whole thing after that, does that work correctly?

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Yet another overflow bug from Testlund
« Reply #5 on: January 12, 2014, 04:16:56 PM »
Like in the sense of defensive programming. The mindset of everything that can go wrong, will go wrong. So that should be avoided.

Is there something like API Sanity Checker for VB? API SC throws junk at all functions and shows when a function can't handle everything.
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #6 on: January 14, 2014, 10:57:46 AM »
What do you mean by "SC" ? edit: Ah source code...

No, but there is API don't be lazy like Botsareus and properly unit test your code (if you can recall all of it at one time) :P
« Last Edit: January 14, 2014, 11:22:49 AM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #7 on: January 14, 2014, 11:47:00 AM »
Also, if by sanity you mean performance, try very sleepy profiler. .NET should have a native profiler I think.

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Yet another overflow bug from Testlund
« Reply #8 on: January 14, 2014, 11:51:25 AM »
Nah, I mean the program API Sanity Checker. You could see it as a unit test generator that will attempt to crash the program. Actual unit testing is better of course, but it can help for reliability.

Also, unit tests take more time, but will certainly pay back their time with avoiding bugs. It's a good habit to write them.
« Last Edit: January 14, 2014, 11:54:14 AM by Peter »
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #9 on: January 14, 2014, 11:54:19 AM »
lol cool, had no idea it was a real thing.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #10 on: January 14, 2014, 12:23:36 PM »
I don't know the .NET package or optional components well enough to answer the question(s) actually. I would love to read Numsgil's take on this.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #11 on: January 14, 2014, 01:31:54 PM »
More reasons to hate vb6, it does not have any of this stuff, I just looked.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #12 on: January 14, 2014, 02:13:05 PM »
On a final point, I do unit test my code, just no very well I guess.

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Yet another overflow bug from Testlund
« Reply #13 on: January 14, 2014, 02:44:48 PM »
Where are the unit tests located? Didn't notice them when I had a look at the code.
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Yet another overflow bug from Testlund
« Reply #14 on: January 14, 2014, 03:21:48 PM »
Dude, I do not leave them as comments in the code.
By unit tests I mean I usually visually confirm that what I put in is happening:
Most of the time I just break the execution and/or throw break points and see what kind of values I am dealing with.