Fix off-by-one and invalid array dereference in libnsgif
Fix last frame of non-infinite animated gifs being invalid