avcodec/htmlsubtitles: Check for string truncation and return error