mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix crash on compiling a regular expression with more than 32k colors.
Throw an error instead. Backpatch to all supported branches.
This commit is contained in:
@ -247,7 +247,15 @@ newcolor(struct colormap * cm)
|
||||
/* oops, must allocate more */
|
||||
struct colordesc *newCd;
|
||||
|
||||
if (cm->max == MAX_COLOR)
|
||||
{
|
||||
CERR(REG_ECOLORS);
|
||||
return COLORLESS; /* too many colors */
|
||||
}
|
||||
|
||||
n = cm->ncds * 2;
|
||||
if (n > MAX_COLOR + 1)
|
||||
n = MAX_COLOR + 1;
|
||||
if (cm->cd == cm->cdspace)
|
||||
{
|
||||
newCd = (struct colordesc *) MALLOC(n * sizeof(struct colordesc));
|
||||
|
Reference in New Issue
Block a user