|
|
|
|
|
by dale_glass
847 days ago
|
|
Unfortunately, UB has some extremely nasty characteristics, and even if it doesn't do anything nasty now, it's not a guarantee that it won't turn into a problem later. Making assumptions about what the code should be reasonably interpreted as is unfortunately not a good bet to make. At any time, a new compiler version may do something bizarre when it figures out the code is UB. |
|
"We assume 64 bit overflow is not going to happen because nobody can store that many bytes" could be valid if the existence of those bytes was required for reaching this code. But if user input can lead to UB being triggered here, fixing the code is indeed prudent, even if everyone were fully convinced that current compilers are not outsmarting themselves.