Skip to Content.
Sympa Menu

freetds - error message on bigendian platforms

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark J. Lilback" <mark AT lilback.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: error message on bigendian platforms
  • Date: Wed, 20 Jun 2001 18:50:06 -0400


Is anyone on a big endian platform getting error messages when you issue a bad query?

Using TDS 4.2 talking to MS SQL Server 7 SP3 from Mac OS 9.1, I'm sending a bad query. The TDS packet that is returned is giving a value of 0xAA000000 for the tds->msg_info->msg_number, but this value is retrieved by calling tds_get_int. There are no big endian checks in there anywhere.

dblib_handle_err_message is being called via g_tds_err_handler to handle the error, but it checks to see if (tds->msg_info->msg_number >0), which in this case it isn't, since there was no swap of bytes.

Now my debugger doesn't show the value of tds->msg_info->msg_number getting changed by the call to tds_get_int(), but I think this is because tds->msg_info->msg_number is defined as a TDS_SMALLINT, so the top 2 bytes are being discarded when the value is cast.

Looking through read.c, there don't seem to by any kinds of checks for endianness -- is byte-swapping ever being done at the tds layer? It seems in this case that it does, and I'd imagine there are more places like this.

I'm a little behind on what is in the CVS repository, but this definitely needs to get fixed for the next release.

--

__________________________________________________________________________
"The best assumption to have
Mark J. Lilback is that any commonly held
<mark AT lilback.com> belief is wrong." -- Ken Olsen,
http://www.lilback.com/ founder, Digital Equip. Corp.



  • error message on bigendian platforms, Mark J. Lilback, 06/20/2001

Archive powered by MHonArc 2.6.24.

Top of Page