logoalt Hacker News

ekiddyesterday at 11:42 PM1 replyview on HN

For security reasons, the correct answer on how process invalid UTF-8 is (and needs to be) "throw away the data like it's radioactive, and return an error." Otherwise you leave yourself wide open to validation bypass attacks at many layers of your stack.


Replies

modelessyesterday at 11:48 PM

This is only true because the interpretation is not defined, so different implementations do different things.