Language: C
Label: safe
CWE: CWE-787 \u2014 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.

Code:
simple_upscale(j_decompress_ptr cinfo,
               JDIFFROW diff_buf, _JSAMPROW output_buf, JDIMENSION width)
{
  do {
#if BITS_IN_JSAMPLE == 12
    /* 12-bit is the only data precision for which the range of the sample data
     * type exceeds the valid sample range.  Thus, we need to range-limit the
     * samples, because other algorithms may try to use them as array indices.
     */
    *output_buf++ = (_JSAMPLE)((*diff_buf++ << cinfo->Al) & 0xFFF);
#else
    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
#endif
  } while (--width);
}