What it does
- Every byte is an op
- All 256 byte values do something. A text file, a photo or a damaged download is a valid program, and there is nothing to reject.
- Nothing can fail
- No syntax errors and no runtime errors. Popping an empty stack gives 0, dividing by zero gives 0, and a run just ends when it reaches the last byte.
- Programs corrupt themselves
- Op
0overwrites the next program byte with a null and skips it, so a looping program rewrites its own code as it runs. - Undefined behavior, on purpose
- Op
3makes the next op undefined: it can become another op, truncate the stack, skip ahead or corrupt a random byte. It is seeded withT, so a run can be repeated exactly. - Run any file
- Point it at an ELF binary, a
.wasmmodule or a photo and it runs the file’s own bytes as instructions. The same file always gives the same output. - Corrupt a file
-c outsaves the program as it looked after its own corruption. It never overwrites the input.- One C file, no flags
- No lexer, parser or syntax tree, because the source is already the instruction list. It builds with plain
gcc, and the interpreter ran clean under ASAN and UBSAN fuzzing.
Run it here
Loading corru…
Try it
gcc corru.c -o corru ./corru -e 104p101p108p108p111p. # prints hello ./corru -g 64 > noise.cou; ./corru noise.cou ./corru -c broken.bin some.file # save the corrupted copy
Flags: -e run a string, -s N step limit, -g N make N random bytes, -c OUT save the corrupted program, -t trim a trailing newline.