diff
25   for (i = 0; i < cinfo->num_components; i++)
---
25   for (i = 0; i < MIN(cinfo->num_components, MAX_COMPS_IN_SCAN); i++)
