[CVE-2018-5146] Prevent out-of-bounds write in codebook decoding.