freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] suspected corruption
- Date: Wed, 5 Dec 2007 10:31:23 -0500
ZIGLIO, Frediano, VF-IT wrote:
> 08:47:27.523087 (dblib.c:513):dbgetnull(0x4103728, 1, -1, 0xbe9a9894)
> 08:47:27.538366 (dblib.c:542):varaddr(0xbe9a9894) varlen -1 < 0?
> t0011: dblib.c:544: dbgetnull: Assertion `varlen > 0' failed.
Thanks for looking at this. At least you were seeing the same thing I
was, and didn't suspect corruption. Now I think I know what's going on.
If varlen == -1 and pnullrep->len == 0, why does the function not return
FAIL?
Answer: integral promotion.
The code:
if (varlen < pnullrep->len) {
tdsdump_log(...);
return FAIL;
}
needs to be:
if (varlen < (long)pnullrep->len) {
tdsdump_log(...);
return FAIL;
}
because varlen is int and pnullrep->len is size_t (unsigned int). The
rule: for two same-size ints, one signed and the other not, treat the
signed as unsigned.
Anyone know if gcc can warn about that?
t0011 now passes, but I'm pretty sure the code is wrong. dbgetnull()
takes a length and an address; it has no more information than that about
what the NULL should look like. STRINGBIND means pad the value with
blanks and terminate it with '\0'. dbgetnull() can't 'pad' because it
doesn't know the column width.
copy_data_to_host_var must determine the column width and pass it (not -1)
to dbgetnull().
Regards,
--jkl
-
[freetds] suspected corruption,
James K. Lowden, 12/04/2007
-
Re: [freetds] suspected corruption,
ZIGLIO, Frediano, VF-IT, 12/05/2007
-
Re: [freetds] suspected corruption,
James K. Lowden, 12/05/2007
-
Re: [freetds] suspected corruption,
ZIGLIO, Frediano, VF-IT, 12/05/2007
-
Re: [freetds] suspected corruption,
James K. Lowden, 12/05/2007
-
Re: [freetds] suspected corruption,
Frediano Ziglio, 12/06/2007
- Re: [freetds] suspected corruption, James K. Lowden, 12/06/2007
-
Re: [freetds] suspected corruption,
Frediano Ziglio, 12/06/2007
-
Re: [freetds] suspected corruption,
James K. Lowden, 12/05/2007
-
Re: [freetds] suspected corruption,
ZIGLIO, Frediano, VF-IT, 12/05/2007
-
Re: [freetds] suspected corruption,
James K. Lowden, 12/05/2007
-
Re: [freetds] suspected corruption,
ZIGLIO, Frediano, VF-IT, 12/05/2007
Archive powered by MHonArc 2.6.24.