5 ms·
> Of course, this should never happen but can be difficult to guarantee when the limits are derived from user inputs. Sounds to me like you are missing a valid
by lpapez 3y ago
> Of course, this should never happen but can be difficult to guarantee when the limits are derived from user inputs.
Sounds to me like you are missing a validation step before calling your logic. When it comes to parsing, trusting user input is a recipe for disaster in the form of buffer overruns and potential exploits.
As they used to say in the Soviet Union: "trust, but verify".
- PaulDavisThe1st 3y agoThat was what Reagan said about the Soviet Union, not what was said in the Soviet Union. Correct me if I'm wrong.
- deleted 3y ago[deleted]
- usefulcat 3y agoAccording to wikipedia you're right (about Reagan) but it's also a Russion proverb.
- plucas 3y agohttps://en.wikipedia.org/wiki/Trust,_but_verify https://en.wikipedia.org/wiki/Trust,_but_verify > Trust, but verify (Russian: доверяй, но проверяй, tr. doveryay, no proveryay, IPA: [dəvʲɪˈrʲæj no prəvʲɪˈrʲæj]) is a Russian proverb, which is rhyming in Russian. The phrase became internationally known in English after Suzanne Massie, a scholar of Russian history, taught it to Ronald Reagan, then president of the United States, the latter of whom used it on several occasions in the context of nuclear disarmament discussions with the Soviet Union. Memorably referenced in "Chernobyl": https://youtu.be/9Ebah_QdBnI?t=79 https://youtu.be/9Ebah_QdBnI?t=79
- PaulDavisThe1st 3y agoThanks for the clarification/explanation!
- fl0ki 3y agoAlso referenced in the Metro Exodus "Sam's Story" DLC because of the backstory of the two characters speaking, and nuclear weapons once again being part of the scenario.
- dekhn 3y agoWhen I hear the phrase, I rewrite it to "don't trust, verify."
- deleted 3y ago[deleted]
- protomolecule 3y agoRussian here. We use that expression from time to time: https://ya.ru/search/?text="доверяй%2C+но+проверяй" https://ya.ru/search/?text="доверяй%2C+но+проверяй"
- deleted 3y ago[deleted]
- iknowstuff 3y agoThe answer is of course clamp(min(a,b), max(a,b)) classic c++