1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +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:
Heikki Linnakangas
2013-04-04 19:04:57 +03:00
parent 9508754ed7
commit c99e0d382f
4 changed files with 14 additions and 0 deletions

View File

@@ -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));