Skip to Content.
Sympa Menu

freetds - Re: [freetds] Crash selecting a blank TEXT field

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Crash selecting a blank TEXT field
  • Date: Thu, 31 May 2007 10:52:18 -0400

Luke Benstead wrote:
> When I run a select query on a blank text field. I get a segmentation
> fault. Here is the last part of the log:
>
> token.c:526:processing result tokens. marker is 81(TDS7_RESULT)
> mem.c:519:tds_free_all_results()
> token.c:1472:processing TDS7 result. set current_results to
> tds->res_info token.c:3395:adjust_character_column_size:
> Server charset: UCS-2LE
> Server column_size: 2147483646
> Client charset: UTF-8
> Client column_size: -4

Well, that's no good. We get -4 because UCS-2LE is 2 byte/char; UTF-8 is
max 4 byte/char, so to convert we allow -- not very wisely, but still, the
math -- 2* 2147483646, which is 2 * (2^31 - 2) == 2^32 - 4. As a signed
integer (TDSCOLUMN::column_size is TDS_INT, a signed 32-bit integer),
that's -4. Bah.

However CVS HEAD code checks for malloc failures in this case, and IIRC
that code has been in place for some time. What version of FreeTDS are
you using?

You say it's a "blank text field". Does that mean a zero-length string,
or a NULL? Or something else? Because the server is indicating it's a
very big text field, two bytes shy of 2 GB, to be exact.

Also, does it help if you set textsize to some reasonable value?

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page