Avoid array-bounds warnings with gcc 4.8.2

The asserts fix RelWithAssert build and for Relase
build the warning is suppressed.

Change-Id: I0a7e6576014bd32648a1e2f08d88e1f2eef3335e