It’s not infinite. At some agreed-upon point in time the trader must return the “borrowed” shares to the broker. If the timing is off and the price is higher rather than the bet-upon lower when it’s time to return the shares the short-seller is screwed. That’s what happened to Melvin Capital thanks to the reddit group.
The stock market is legal gambling. Some people like to play riskier games than others. Here’s my earlier explanation of what happened, if it helps clarify: