Fix potential out-of-bounds read (coverity) (#844)