postgresql/contrib/seg
Tom Lane 0ff4056b8c Fix contrib/seg to be more wary of long input numbers.
seg stores the number of significant digits in an input number
in a "char" field.  If char is signed, and the input is more than
127 digits long, the count can read out as negative causing
seg_out() to print garbage (or, if you're really unlucky,
even crash).

To fix, clamp the digit count to be not more than FLT_DIG.
(In theory this loses some information about what the original
input was, but it doesn't seem like useful information; it would
not survive dump/restore in any case.)

Also, in case there are stored values of the seg type containing
bad data, add a clamp in seg_out's restore() subroutine.

Per bug #17725 from Robins Tharakan.  It's been like this
forever, so back-patch to all supported branches.

Discussion: https://postgr.es/m/17725-0a09313b67fbe86e@postgresql.org
2022-12-21 17:51:50 -05:00
..
data Modify the float4 datatype to be pass-by-val. Along the way, remove the last 2008-04-18 18:43:09 +00:00
expected Fix contrib/seg to be more wary of long input numbers. 2022-12-21 17:51:50 -05:00
sql Fix contrib/seg to be more wary of long input numbers. 2022-12-21 17:51:50 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Provide for contrib and pgxs modules to install include files. 2018-07-31 19:58:39 +01:00
seg--1.0--1.1.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:43 -04:00
seg--1.1--1.2.sql Update contrib/seg for new scalarlesel/scalargesel selectivity functions. 2017-09-13 11:54:55 -04:00
seg--1.1.sql Update extensions with GIN/GIST support for parallel query. 2016-06-14 13:34:37 -04:00
seg--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:43 -04:00
seg--unpackaged--1.0.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
seg-validate.pl Use 'use strict' in all Perl programs 2017-01-05 12:34:48 -05:00
seg.c Fix contrib/seg to be more wary of long input numbers. 2022-12-21 17:51:50 -05:00
seg.control Support index-only scans in contrib/cube and contrib/seg GiST indexes. 2017-11-20 20:25:18 -05:00
segdata.h Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
segparse.y Fix contrib/seg to be more wary of long input numbers. 2022-12-21 17:51:50 -05:00
segscan.l Exclude flex-generated code from coverage testing 2017-10-16 16:28:11 -04:00
sort-segments.pl Use 'use strict' in all Perl programs 2017-01-05 12:34:48 -05:00