[x265] Backport a fix for crashes when encoding with variable length SEI