4 ms·
This is considered a minor security feature. When a program unexpectedly finds itself in a routine, or a routine ends abruptly, it's possible it was a code jump
by peterwwillis 11y ago
This is considered a minor security feature. When a program unexpectedly finds itself in a routine, or a routine ends abruptly, it's possible it was a code jump, or the after-effects of a payload... Neither of which are good things.
- TazeTSchnitzel 11y agoIf you use a switch(), have a default:, even if it's seemingly impossible.
- jakub_g 11y agoand print "call Brian" in it (anecdote from a HN thread a month ago): https://news.ycombinator.com/item?id=11397251 https://news.ycombinator.com/item?id=11397251
- StringyBob 11y agoYes - in hardware where faults are expected to be rare it's often a good idea to just detect that something went wrong. If you know something bad happened you can choose to re-run. (E.g. restart using a watchdog timer) Silently jumping back to a default state is sometimes useful, but could result in unpredictability or perhaps silent data corruption for some critical applications.