From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Strange coding in mvdistinct.c |
Date: | 2019-04-15 22:12:24 |
Message-ID: | 30400.1555366344@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Oh, and as I continue to grep, I found this in dependencies.c:
dependencies = (MVDependencies *) repalloc(dependencies,
offsetof(MVDependencies, deps)
+ dependencies->ndeps * sizeof(MVDependency));
I'm pretty sure this is an actual bug: the calculation should be
offsetof(MVDependencies, deps)
+ dependencies->ndeps * sizeof(MVDependency *));
because deps is an array of MVDependency* not MVDependency.
This would lead to an overallocation not underallocation, and it's
probably pretty harmless because ndeps can't get too large (I hope;
if it could, this would have O(N^2) performance problems). Still,
you oughta fix it.
(There's a similar calculation later in the file that gets it right.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2019-04-15 22:35:41 | Re: Strange coding in mvdistinct.c |
Previous Message | Tom Lane | 2019-04-15 22:00:02 | Strange coding in mvdistinct.c |