Menu

#8 Segmentation fault for select with large floating point valu

open
nobody
None
5
2008-03-06
2008-03-06
No

Hi,

I get a segmentation fault when I select from a table containing a certain floating point numbers.

host-13: sqsh
sqsh-2.1.4 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2006 Michael Peppler
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
[22] sqldev15.tibbetts.1> create table foo (col1 double precision);
[23] sqldev15.tibbetts.1> insert into foo values (-1e120);
(1 row affected)
[24] sqldev15.tibbetts.1> select col1 from foo;
col1
--------------------
-999999999999999980003468347394201181668805192897008518188648311830772414627428
725464789434929992439754776075181077037056.000000

(1 row affected)
Segmentation fault

This happens on both Solaris, sqsh built with Sun C compiler 5.7, and Linux, sqsh built with gcc-3.4.6.

I suspect this is a buffer overflow issue with the space allocated for CS_FLOAT and CS_REAL datatypes in dsp_desc.c. 64 bytes are malloc, but the values requires more to properly display using the %f format specifier in sprintf.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.