Opened 6 years ago

Closed 6 years ago

#4089 closed defect (fixed)

ST_GeomFromTWKB throws an error when reading bbox around 3D geometry

Reported by: atallah Owned by: nicklas
Priority: medium Milestone: PostGIS 2.4.5
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

Here is one particular breaking example

select st_AsTWKB(st_GeometryFromText('POINT Z(1 2 3)'), 0, 0, 0, false, true);
// \x010901020004000600020406
select st_astext(st_geomfromtwkb('\x010901020004000600020406'));
// ERROR:  varint_u64_decode: varint extends past end of buffer

While I of course couldn't check all possible configurations that lead to this, I found that this happens for POINT Z, LINESTRING Z and POLYGON Z, but only when includeBbox is set to true. Precision did not seem to make a difference.

Change History (2)

comment:1 by nicklas, 6 years ago

Owner: changed from pramsey to nicklas

I can replicate

I have also studied the output of ST_AsTWKB which looks ok. So ST_GeomFromTWKB is main suspect.

I will take a look on ST_GeomFromTWKB, should be fairly easy to track down.

comment:2 by nicklas, 6 years ago

Resolution: fixed
Status: newclosed

Fixed in :

trunk r16572

2.4 r16573

2.3 r16574

2.2 r16575

Thank you atallah! Good catch

Note: See TracTickets for help on using tickets.