PostgreSQL
Check-in [9fae83a1b0]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a second cause of undersized pallocs for btree_gist indexes on macaddr. gbt_macad_union also allocated 12-byte structs where we really need 16. Per report from Andres Freund. No back-patch since there's no current risk of a real problem.
Timelines: family | ancestors | descendants | both | trunk | WIN32_DEV | REL9_0_ALPHA4_BRANCH
Files: files | file ages | folders
SHA1:9fae83a1b0b69414ed9824ef340dfb2fec39737c
User & Date: tgl@sss.pgh.pa.us 2014-05-16 19:18:09
Context
2014-05-16
19:29
Suppress some more valgrind whining about btree_gist. A couple of functions didn't bother to zero out pad bytes in datums that would ultimately go to disk. Harmless, but valgrind doesn't know that. check-in: e846fca3d6 user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
19:18
Fix a second cause of undersized pallocs for btree_gist indexes on macaddr. gbt_macad_union also allocated 12-byte structs where we really need 16. Per report from Andres Freund. No back-patch sinc... check-in: 9fae83a1b0 user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
19:11
Fix valgrind warning for btree_gist indexes on macaddr. The macaddr opclass stores two macaddr structs (each of size 6) in an index column that's declared as being of type gbtreekey16, ie 16 bytes. I... check-in: d05b3130ac user: tgl@sss.pgh.pa.us tags: trunk, WIN32_DEV, REL9_0_ALPHA4_BRANCH
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to contrib/btree_gist/btree_macaddr.c.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include "utils/builtins.h"
#include "utils/inet.h"

typedef struct
{
	macaddr		lower;
	macaddr		upper;

} macKEY;

/*
** OID ops
*/
PG_FUNCTION_INFO_V1(gbt_macad_compress);
PG_FUNCTION_INFO_V1(gbt_macad_union);
................................................................................
}


Datum
gbt_macad_union(PG_FUNCTION_ARGS)
{
	GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
	void	   *out = palloc(sizeof(macKEY));

	*(int *) PG_GETARG_POINTER(1) = sizeof(macKEY);
	PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
}


Datum







>







 







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "utils/builtins.h"
#include "utils/inet.h"

typedef struct
{
	macaddr		lower;
	macaddr		upper;
	char		pad[4];			/* make struct size = sizeof(gbtreekey16) */
} macKEY;

/*
** OID ops
*/
PG_FUNCTION_INFO_V1(gbt_macad_compress);
PG_FUNCTION_INFO_V1(gbt_macad_union);
................................................................................
}


Datum
gbt_macad_union(PG_FUNCTION_ARGS)
{
	GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
	void	   *out = palloc0(sizeof(macKEY));

	*(int *) PG_GETARG_POINTER(1) = sizeof(macKEY);
	PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
}


Datum