memesearch
How to Turn Integer Comparison Nondeterministic

How to Turn Integer Comparison Nondeterministic

Download Find similar pictures
Text on the meme
How to turn integer comparison non-deterministic I've been spamming this bug here and there, because it's just that delicious. A step-by-step guide: 1. Allocate some stuff on the stack. Save the pointer somewhere, and immediately deallocate it. 2. Repeat immediately, so as to ensure that the data gets allocated in the same position. Save the pointer somewhere else, immediately deallocate the data. 3. You now have two dangling pointers. Cast them to suitable integers such as usize. If you're feeling really fancy, enable strict provenance and use `expose_addr()`; it makes no difference. 4. Compare them for equality and print the result. Print the two integers, compare them again, and print the result again. 5. Enjoy seeing the comparison evaluate to false the first time and true the second one. Playground link, Github issue, motive, explanation. what now?
What it means

A screenshot shows a dark-themed programming post explaining how to make integer comparison in Rust behave nondeterministically by using dangling pointers and deallocated stack data. The punchline is that the comparison prints false once and true again, highlighting undefined or unsafe behavior with mock-serious enthusiasm. “what now?” adds a bewildered reaction to the absurd programming bug, making it useful for reacting to confusing technical failures. EN: A screenshot shows a dark-themed programming post explaining how to make integer comparison in Rust behave nondeterministically by using dangling pointers and deallocated stack data. The punchline is that the comparison prints false once and true again, highlighting undefined or unsafe behavior with mock-serious enthusiasm. “what now?” adds a bewildered reaction to the absurd programming bug, making it useful for reacting to confusing technical failures.

Objects
Tags
Source
Type
image
Size
800×659 · 88.4 KiB
Mood
absurd, confused
Language
en
Added