Skip to Content.
Sympa Menu

freetds - FreeTDS and segfaults under IRIX

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: David Nahman <vanyadog AT yahoo.com>
  • To: FreeTDS list <freetds AT franklin.metalab.unc.edu>
  • Subject: FreeTDS and segfaults under IRIX
  • Date: Tue, 16 Jul 2002 19:20:27 -0700 (PDT)


Dear List,

This is probably not a problem with FreeTDS, but I'm
posting here in case it jogs a memory of a similar
occurance.

I'm building the current CVS snapshot under IRIX with
gcc with --disable-shared. I am finding that
somewhere under tds_convert, after a certain number of
iterations, ctx->locale gets incorrectly freed or the
pointer gets overwritten, so that later when my
program segfaults in cs_ctx_drop.

The other problem here is that the remaining legacy
code that I'm working with here has to be compiled
with the MIPSPro Compiler V7.2.1. I don't know if it
is a problem with the way the various compilers set up
the stack, or if there is something else going on.

Here is a sample of the inner loop of the code that is
causing the problem, if that sheds any info. The
cscmd that is passed in has already been used for a
prior query, which has most likely not returned any
rows.

Thank you very much,
David


=====================
int GetDevByAlias(CS_COMMAND * cscmd, char * alias,
char * device)
{
CS_DATAFMT columns[6];
CS_INT datalength[6];
CS_SMALLINT indicator[6];
CS_RETCODE csresult_type;
char query[VCL_MAXBUFSIZE];

sprintf(query, "SELECT
control.dbo.Device.Device_Mnemonic FROM
cl.dbo.Aliases, control.dbo.Device WHERE
cl.dbo.Aliases.Alias = '%s' AND
cl.dbo.Aliases.DeviceID =
control.dbo.Device.Device_ID", alias);

if (ct_command(cscmd, CS_LANG_CMD, query,
CS_NULLTERM, CS_UNUSED) != CS_SUCCEED) {
return 0;
}

if (ct_send(cscmd) != CS_SUCCEED) {

return 0;
}
while (ct_results(cscmd, &csresult_type) ==
CS_SUCCEED) {
switch (csresult_type){
case CS_ROW_RESULT:
columns[0].datatype = CS_CHAR_TYPE;
columns[0].format = CS_FMT_NULLTERM;
columns[0].maxlength = NVL_DEVICE_MNEMONIC + 1;
columns[0].count = 1;
columns[0].locale = NULL;
if (ct_bind(cscmd, 1, &columns[0], device,
&datalength[0], &indicator[0]) != CS_SUCCEED) {

return 0;
}

while (ct_fetch(cscmd, CS_UNUSED, CS_UNUSED,
CS_UNUSED, NULL) == CS_SUCCEED) {
;
}
break;
case CS_CMD_SUCCEED:
/* No rows returned */
return 0;
break;
default:
; /* ignore other messages */
} /* switch */
}

return 1;


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




Archive powered by MHonArc 2.6.24.

Top of Page