func (d *partialArray) add(key string, val *lazyNode) error {
	if key == "-" {
		*d = append(*d, val)
		return nil
	}

	idx, err := strconv.Atoi(key)
	if err != nil {
		return err
	}

	ary := make([]*lazyNode, len(*d)+1)

	cur := *d

	if idx < 0 {
		idx *= -1

		if idx > len(ary) {
			return fmt.Errorf("Unable to access invalid index: %d", idx)
		}
		idx = len(ary) - idx
	}
	if idx < 0 || idx >= len(ary) || idx > len(cur) {
		return fmt.Errorf("Unable to access invalid index: %d", idx)
	}
	copy(ary[0:idx], cur[0:idx])
	ary[idx] = val
	copy(ary[idx+1:], cur[idx:])

	*d = ary
	return nil
}
The software writes data past the end, or before the beginning, of the intended buffer.