linear-assignment: fix potential out of bounds memory access