gpulib: fix out-of-bounds reads in do_cmd_buffer()