Rule 7-5-7 says that a non-designated spot throw-in must be made from "any point outside the end line". Rule 1-2 says that the end line is as shown on the court diagam at the front of the rule book. That diagram shows that the end lines terminate at the sidelines.
Ergo, it's a violation if the thrower goes past the point where the end line and sideline meet and then makes the throw-in from there. The thrower would no longer be outside the endline.
However, I don't know if there is a violation if the thrower goes past a sideline, but then returns behind the end line before making the throw-in. That play isn't covered
afaik.