Q: Given the following code slice:
```
1 get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
4   bmp_source_ptr source = (bmp_source_ptr) sinfo;
5   register JSAMPARRAY colormap = source->colormap;
6   JSAMPARRAY image_ptr;
9   register JDIMENSION col;
12   source->source_row--;
13   image_ptr = (*cinfo->mem->access_virt_sarray)
18   inptr = image_ptr[0];
20   for (col = cinfo->image_width; col > 0; col--) {
21     t = GETJSAMPLE(*inptr++);
22     *outptr++ = colormap[0][t]; /* colormap[x] has size cmaplen */```
which has a CWE-125 vulnerability at line:
```
22     *outptr++ = colormap[0][t]; /* colormap[x] has size cmaplen */
```
Please analyze the root cause of the vulnerability.