Add check for below array bounds

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>