postgresql/contrib/seg
Tom Lane b87037b373 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 Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -05:00
seg--1.0--1.1.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -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:42 -04:00
seg--1.3--1.4.sql Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -05:00
seg-validate.pl Update copyright for 2022 2022-01-07 19:04:57 -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 Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -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 Update copyright for 2022 2022-01-07 19:04:57 -05:00