# 漏洞总结 ## 漏洞概述 - **漏洞名称**: ParseCube 整数溢出漏洞 - **漏洞描述**: 在 LUT(查找表)分配过程中,由于整数溢出导致内存分配错误。 - **修复提交**: 提交 ID `6a68601`,由用户 `mm2` 于 2019 年 2 月 19 日提交。 ## 影响范围 - **受影响文件**: `src/cmscags.c` - **具体位置**: 文件中的 `cms2190` 函数部分。 ## 修复方案 - **修复代码**: ```c if (lut_size > 60) { int nodes = lut_size * lut_size * lut_size; int nodes; /* * Professional LUT-generation tools (e.g., Nobe LutBake) list 65x65x65 as their highest supported */ if (lut_size > 60) return PyErr_Format(PyExc_ValueError, "LUT size '%d' is over maximum of 60", lut_size); nodes = lut_size * lut_size * lut_size; } cmsFloat32Number* lut_table = (cmsFloat32Number*) _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number)); if (lut_table == NULL) return FALSE; ``` - **修复内容**: - 增加了对 `lut_size` 的检查,确保其不超过 60。 - 如果 `lut_size` 超过 60,则抛出 `PyExc_ValueError` 异常。 - 确保在分配内存前进行正确的计算和检查,避免整数溢出。