Opened 10 years ago

Closed 10 years ago

#2856 closed defect (invalid)

broken varint encoding ?

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.2.0
Component: postgis Version: master
Keywords: Cc: nicklas

Description

With r12836 I moved varint encoding code in its own module and added more tests, starting with examples found on the varint documentation page https://developers.google.com/protocol-buffers/docs/encoding#varints

In doing so I found that the encoding for the signed integers 2147483647 and -2147483648 were wrong. In particular the "size" detector correctly says it takes 4 bytes to encode those numbers

but the encoder (or hexbytes_from_bytes) ends up returning an hex representing 5 bytes instead.

See http://trac.osgeo.org/postgis/browser/trunk/liblwgeom/cunit/cu_varint.c?rev=12836#L87

Change History (1)

comment:1 by strk, 10 years ago

Resolution: invalid
Status: newclosed

Sorry, this is invalid. The encoding for 2147483647 should really be 5 bytes long, the example in the google page was about zigzag encoding, not varint encoding.

Note: See TracTickets for help on using tickets.