Skip Menu |

This queue is for tickets about the DBD-Sybase CPAN distribution.

Report information
The Basics
Id: 116065
Status: open
Priority: 0/
Queue: DBD-Sybase

People
Owner: Nobody in particular
Requestors: thompsa [...] freebsd.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DBD-Sybase does not support [n]varchar(max)
Date: Tue, 12 Jul 2016 16:22:51 +1200
To: bug-DBD-Sybase [...] rt.cpan.org
From: Andrew Thompson <thompsa [...] freebsd.org>
Using p5-DBD-Sybase-1.15 In dbdimp.c line 3271 the code is imp_sth->datafmt[i].maxlength = get_cwidth(&imp_sth->datafmt[i]) + 1; maxlength and get_cwidth are both signed int types so when the column is varchar(max) the get_cwidth() call returns 2147483647 2147483647 + 1 = -2147483648 When this is cast to size_t for the Perl_safesysmalloc() call (via New macro) it tries to allocate 18446744071562067968 bytes (on 64bit arch). The script will exit with "Out of memory!" error. The maxlength may need to check for overflow but I am unsure how to handle the +1 byte padding. Andrew
This is still broken in 1.16 and resulted in core dumps under RHEL 7.6, perl 5.30.0 and freetds 1.1.16 while fetching result data from a query. I patched it with a very crude if ( imp_sth->datafmt[i].maxlength == -2147483648 ) { imp_sth->datafmt[i].maxlength = 2147483647; } Thomas
not fixed in 1.16