4 ms·
I have a story kind of similar to the one called "...Or is it over here!?" A friend of mine was having crashes with a program. When debugging it he found that
by Negitivefrags 11y ago
I have a story kind of similar to the one called "...Or is it over here!?"
A friend of mine was having crashes with a program. When debugging it he found that a bunch of his local variables had weird values. He suspected that there might be a buffer overflow elsewhere that was trampling over the memory.
The fix? Just add "char buffer[ 1000 ];" to the function to absorb the damage. It fixed the crash and it shipped like that.
- shoo 11y agoThis reminds me of an older "dirty trick" where a buffer was sacrificed, instead of added, at the end of the project in order to ship. See "The Programming Antihero"[1]. [1]. http://www.gamasutra.com/view/feature/132500/dirty_coding_tricks.php?page=4 http://www.gamasutra.com/view/feature/132500/dirty_coding_tr...
- tfigment 11y agoI've done something like this on a production data base server before. Maybe not the same thing but I allocated a really big file because mysql would occasionally grow its ibdata file to full the disk before we could handle the alert. Deleting this file allowed room to maneuver after restarting the database and dealing with this run away journal file. The other similar urban legend is the enterprise teams which have for(int i=0;i<10000000;++i); loops in code which they can remove a zero when performance boost is needed and they can quickly provide a fix.
- bananaboy 11y agoNow this is a dirty coding trick!
- ygra 11y agoThere's even a compat shim in Windows for that kind of thing where the memory manager would allocate a few bytes more than requested so that subsequent code (that ran fine in Win 95, for example) could overrun the allocated buffer without crashing. Back in Vista there were around 5000 applications that had shims applied by Windows to make them run correctly. I wonder how the count would look like today ...