check string bounds

as demonstrated by fdo54887-1.ods

Change-Id: I2d5568126c58c831446b4c4b050ffed193f7921d