[postgis-tickets] [PostGIS] #4451: gserialized_max_header_size is too big
PostGIS
trac at osgeo.org
Fri Jul 5 09:22:54 PDT 2019
#4451: gserialized_max_header_size is too big
------------------------+---------------------------
Reporter: Algunenano | Owner: Algunenano
Type: defect | Status: assigned
Priority: medium | Milestone: PostGIS 3.0.0
Component: postgis | Version: trunk
Keywords: |
------------------------+---------------------------
The max header size is being calculated as:
{{{
return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(int);
}}}
But sizeof(GSERIALIZED) takes into account `data[1]`, which AFAIK we
shouldn't include as it's added after.
A small test case:
{{{
#include <stdio.h>
#include <stdint.h>
typedef struct
{
uint32_t size; /* For PgSQL use only, use VAR* macros to manipulate.
*/
uint8_t srid[3]; /* 24 bits of SRID */
uint8_t gflags; /* HasZ, HasM, HasBBox, IsGeodetic */
uint8_t data[1]; /* See gserialized.txt */
} GSERIALIZED;
int main()
{
printf("Size: %d\n", sizeof(GSERIALIZED));
printf("Data: %u\n", (intptr_t)&((GSERIALIZED *)NULL)->data);
}
}}}
{{{
$ ./a.out
Size: 12
Data: 8
}}}
sizeof(GSERIALIZED) returns 12 bytes, when what we want is 8.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4451>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list