develooper Front page | perl.dbi.users | Postings from February 2001

DBD::Oracle buffer overrun bug with CLOBs

From:
Joshua Chamas
Date:
February 10, 2001 11:10
Subject:
DBD::Oracle buffer overrun bug with CLOBs
Message ID:
3A858BB8.BD825E0C@chamas.com
Hey,

I just encountered what seems to be an awful buffer overrun bug 
with DBD::Oracle fetching CLOBs from Oracle8.  The problem was 
that when not setting LongReadLen to a decent value, and fetching 
a CLOB that was bigger than the default of 80 bytes, other perl 
data elsewhere in the stack would get corrupt causing my 
mod_perl child httpd to segfault quite unpleasantly.  I only 
document this since it was so awful to track down, and was 
intermittent because we were setting LongReadLen inconsistently
in the application.

The fix of course was to always set $dbh->{LongReadLen} to a 
reasonable value larger than any CLOB in the database, but it also
turns out that $dbh->{LongTruncOk} = 1 also protects against
the buffer overrun, and I'll take truncated data over a buffer
overrun any day!

-- Josh

_________________________________________________________________
Joshua Chamas			        Chamas Enterprises Inc.
NodeWorks >> free web link monitoring	Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About