LT-15309: Handle case when end tag spans buffer boundary

Change-Id: I76178be9c91ae610286d49a670033bf3e3b44c68