Gatekeeper passing strange arguments on first launch after download?
Okay, found a way to test this on a debug build, and figured it out. My solution was to copy the com.apple.quarantine xattr onto the debug binary which XCode creates, and then test this via 'open'. (Launching via Terminal never showed the issue)

This reveals that when launched with the quarantine flag set, the command line contains a 'NULL' as the second arg; i.e argc=2, argv[0]=, argv[1]=0