[freetds] [PATCH] bcp columns too small
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Thu Feb 3 03:28:08 EST 2005
>
> I encountered a bug doing a bcp in with RC9's freebcp where a
> character
> column in the client's charset occupies more space than the
> same column
> in the server's charset. In my case, I've set the client charset to
> UTF-8 and the server's is ISO-8859-1.
>
> When dbconvert is called from _bcp_read_hostfile, it space fills up to
> the length of curcol->column_size, which is determined from
> the client's
> charset, but the data area is only allocated according to the server's
> charset (curcol->on_server.column_size). So, for example, a char(6)
> field in ISO-8859-1 could take up to 24 bytes in UTF-8. We
> only allocate
> 6 bytes (or 6 + 1?), but later space fill all 24 bytes, including 18
> bytes that belong to something else. This obviously causes a memory
> accesss error if we're lucky, or corrupted data if we're not.
>
> The attached patch deals with the problem by modifying the way column
> memory is allocated. It simply allocates based on whichever
> column size
> is larger, server or client.
>
>
Applied in both 0.63 and HEAD.
freddy77
More information about the FreeTDS
mailing list