Report

CVE-2020-15900: Integer Underflow in Ghostscript rsearch Operator

2eebb72b-60aa-4e47-be3a-965598d1e60d

The 'rsearch' PostScript operator in Ghostscript 9.52 contains an integer underflow vulnerability in the search_impl function. When searching backward for a pattern within a string, the calculation of the remaining 'post' substring size uses a flawed formula: count + (size - 1). Since 'count' is decremented during the search loop, this formula can result in an unsigned integer underflow, causing a size that is too large to be set for the post substring. This leads to memory corruption when the oversized substring is later accessed.