Navy gunners unphased by “integer overflow bug” concerns

We get unusual messages from time to time here at Naked Security.

There was the Ukrainian bloke (well, he said he was Ukrainian, and said he was a bloke, for that matter) who kindly offered us part of his liver.

We had forum spammers who unleashed on us all the canned comments from their database in one giant, if incomprehensible, spew of spam.

Today, however, we had a much more cheerful, albeit out-of-the-ordinary, message from the sort of source we’d really love to hear from more often.

A vacationing coder with a penchant for fitting geekiness into regular life!

Jonathan Molteno describes himself as an “old school, round-peg assembler programmer currently jammed into a square hole called AJAX.”

He comes, he says, from somewhere “notoriously rainy, where the North Sea is considered an ocean and a bunch of mudflats a beach.”

Seeking a temporary respite from the weather, Jonathan found himself with some coding colleagues taking a team-building trip to Cape Town.

It seems they chose Cape Town on the inescapably logical grounds (to a bunch of programmers, anyway) that it was about as far from the North Sea as they could get, literally and figuratively, on a single overnight flight using only air miles.

As Jonathan tells it:

Being the old one out in the group, I decided to give the Whale Watching tour a miss, because of the 4 hour minibus trip to a place called Hermanus. I bet they have a lot of trouble with their road signs. I went for a walk instead, up a prominence behind the hotel called Signal Hill. More of a mountain at my age.

After taking a wrong turning I came to a chain link fence with barbed wire on it, apparently just short of the summit. There was a much-used hole in it so I slipped through, past a giant red flag that I probably should have paid more attention to...and suddenly I was looking down the twin barrels of two cannons, both of them looking dangerously old - they were covered in verdigrease - but rigged up as though to fire.

Apparently, I'd stumbled on the Noon Guns - they have two in case the first one doesn't go off, or the 300-year-old smooth-bore barrel finally bursts, or something. The South African Navy has fired a Noon Gun every day for close on 200 years, and despite everyone having precise time on their phones these days thanks to GPS there was a big crowd out to watch. The cannons blast out a huge puff of very smoky gunpowder so ships in the harbour can see exactly when it's noon, because the sound takes a few seconds to reach the city and the water's edge below.

My geek interest was aroused: according to the blurb, the time signal to fire the gun comes from the Astronomical Observatory offices about 8km away. Does the Astronomical Observatory set its time clocks in turn from the Noon Gun? Apparently not, they use NTP, which sounds like cheating to me.

Then I noticed that yesterday, according to a signboard, was the Navy's 65,535th firing of the gun. Just shy of 180 years [*], then, assuming they've never missed a day. (There was a very shipshape Navy officer in attendance with a super-shiny belt buckle. Somehow I didn't want to ask him if they'd ever forgotten to fire it.)

Suddenly I was nerdily nervous, though I didn't dare ask him this question either, "What about integer overflow?"

Today was going to be the 216th firing! There was nothing for it but to sit in the sunshine, gazing out to sea - there's a great view of Robben Island from up there - waiting for noon and daydreaming about whether any other daily military traditions from the 19th century are also heading to that 16-bit flipover point.

Then, at 12:00:00 precisely, BANG! (Huge puff of smoke.)

I thought I'd better take a photo of the updated signboard.

Like we said, we get some great stories here at Naked Security, and we loved this one, plus the picture to prove that it all ended well.

But we couldn’t help but wonder, of all the things a concerned observer might worry about at the firing of the Noon Gun, if integer overflow was really the big one.

We think we’d have been more concerned about problems such as, “Has anyone ever inadvertently put a cannon ball down the muzzle when loading it, out of habit?”

Oh, and, “What kind of programmer ignores a giant red flag?”

[*] Apparently, the Noon Gun is not fired on Sundays. So 65535 firings is actually just over 200 years, and since the practice was started by the British, that ties in with the British takeover of the Cape in 1806.

PS.You can follow the Noon Gun on Twitter. There’s a certain rhythm to its tweets, in a repetitious sort of way. But it will raise the alarm if anyone ever forgets.