loading...

re: 🍿What was the most remarkable πŸ¦— bug you have ever had to fix πŸ‘©β€πŸ”§? VIEW POST

FULL DISCUSSION
 

There was a point in time where a particular function in MariaDB treated the value of 0 as invalid. Any other integer, positive or negative (within the bounds of the bit limitation) was fine. But 0 specifically would produce an error. And at that, only in certain circumstances.

This was due to the way MariaDB would compress some data. Values would be stored with length information. The value 0 required 0 bits to store, so length was set to 0, and since there was no length, the field was treated as completely invalid.

I opened a PR for the issue, and then the devs found another addition to the bug... It was possible to store either a signed or unsigned 0 (same value either way). So they had to update the code to support both cases.

 

Funniest, and one I'm probably most well known for on Twitter?

In my tired coding binge one night, I wrote the following in C++

x = x++;

I just wanted x++, but was too tired to realize what I had done. This is an undefined operation in C/C++. It just so happened that the compiler I was using at the time did what I expected. But then when I used the exact same, already "verified to work" code on another compiler, or even a different version of the same compiler, the code would fail.

That was also in the very early days of ARM embedded programming. There was little by way of ability to debug anything on the platform. Each iteration of the code required not only compiling it, but then flashing it to a custom flash drive, and then inserting that flash drive into the desired hardware. Development and testing was painfully slow!

Code of Conduct Report abuse