The Election and Signed Integers

A colleague sent me a link to an interesting article that looks just like an integer overflow issue:

Broward machines count backward
By Eliot Kleinberg

Palm Beach Post Staff Writer

Friday, November 05, 2004

FORT LAUDERDALE β€” It had to happen. Things were just going too smoothly.

Early Thursday, as Broward County elections officials wrapped up after a long day of canvassing votes, something unusual caught their eye. Tallies should go up as more votes are counted. That’s simple math. But in some races, the numbers had gone . . . down.
Officials found the software used in Broward can handle only 32,000 votes per precinct. After that, the system starts counting backward.

Methinks the software used 16-bit signed ints!

Comments (10)

  1. Brendan says:

    I guess unsigned __int64’s just aren’t that popular eh?

    Here’s to overkill when counting with little fear of overflow (within reason of course)!!!

  2. anonymous says:

    would it *really* have been that difficult to have a locally-attached laser printer spit out a page with the votes on it?

    I’m sure you’re right about the cause, but how do they even know how many times it wrapped? They don’t for sure (although they probably can guess). Worthless results.

    Sigh… I guess it’s only an election, and not something really important like GTA…

  3. Mike Dunn says:

    Lovely. Heck, even a plain UINT would have been fine, unless the US population crossed 4 billion when I wasn’t looking…

  4. Mike Dimmick says:

    Probably written in VB6… by idiots.

  5. Michael Howard says:

    Actually, Basic (including Visual Basic) will raise an exception on overflow!

  6. Terry Denham says:

    This just raised my BS meeter. I can’t imaging a programmers would be that stupid to use a 16bit integer as a counter and only assume that there are only 32000 voters in a precinct.

  7. Michael Howard says:

    >>raised my BS meeter (sic)

    I hope you’re right!

  8. anonymous says:

    did your BS meter overflow on raising?

  9. Ilya Birman says:

    Coool πŸ™‚

    Well, after 32767 it’s -32768 there, then -32767, -32766, so it’s actually _still_ going up πŸ™‚ So actually if you have result of -1, you can be rather safe in saying there were 65535 votes.

    If the software was really counting down, it might have rounded the result, which appears even more… more strange, then stupid signed 16bit int usage πŸ™‚

    (BTW, looks like no one here is in any doubt that those 32,000 is == 32,767 πŸ™‚

  10. Yeah, probably was written in ClassicVB. Probably by some C-dweeb "too sexy for his shirt" (ie, too dumb to RTFM), who didn’t even know the difference between an Integer and a Long. Definitely not the sort of mistake long-term VB users would’ve made, but exactly the "programmer" Microsoft chose to break the language for by doubling the size of intrinsic datatypes. Heh, but he was "smart" enough to turn on all the Advanced Optimizations, so that Integer Overflow checks were disabled. Perfect candidate for .NET — clueless to a fault! πŸ˜‰