2009-01-05

(malware bugs) Zune hang explained...

Recently a Microsoft eqvt of the "iPod" (called the Zune), was found to
hang if it was booted on December 31st of 2008. The only solution was
to let the battery die, wait for the next day, and then reboot.

You'd think the cause might be something complex, deep in some really
arcane bit of the software, right?

Wrong! It's a piece of code that is so utterly simple even first year
college kids barely starting "C" should be able to understand the problem.

http://www.aeroxp.org/2009/01/lesson-on-infinite-loops/ explains the
cause of the hang is very nicely. The actual code is very simple: given
the "number of days since Jan 1, 1980" as input, return the current year
and the day-number within the current year. That's it. It even has a
helper function called "IsLeapYear()" to help it decide, so it's a very
simple, short, piece of code. Yet it got it wrong...

No comments: