In trying to print debugging information to diagnose a problem with an rpc call, I stumbled upon a printf-of-death. I have narrowed down at least two independent surprise behaviors with printf:
- printf's format string argument cannot exceed 1000 characters.
- printf's output length cannot exceed 1023 characters.
These lead not just a "Crash in script".
In Windows this is a hard crash-to-desktop. A message box says "Zorro Automaton has stopped working".
In wine i get
wine: Unhandled exception 0xc000000d in thread 18 at address 0x514658 (thread 0018), starting debugger...
winedbg: Internal crash at 0x7ed2b0b5
Verbose/diag log is empty.
Example of first bug
#define BUFFSIZE 4000
char response[BUFFSIZE];
function main() {
int i;
for (i = 0; i < 1023; i++) {
response[i] = 'x';
}
response[1023] = 0;
printf("\n%s", response);
}
(Crash)
Please let me know if you need a script example for the first one. (Just print a string literal longer than 1000 chars and you'll see it.)