Bug 59070 - read error for CLOB in Oracle dbd driver
Summary: read error for CLOB in Oracle dbd driver
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR-util (show other bugs)
Version: HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
Keywords: PatchAvailable, PortBack
Depends on:
Reported: 2016-02-25 21:30 UTC by Chris Darroch
Modified: 2016-02-25 22:47 UTC (History)
0 users

fix for CLOB reads in apr_dbd_oracle.c (408 bytes, patch)
2016-02-25 21:30 UTC, Chris Darroch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Darroch 2016-02-25 21:30:52 UTC
Created attachment 33594 [details]
fix for CLOB reads in apr_dbd_oracle.c

I bumped into a bug recently (actually, in APR-util 1.5.x but it's also in APR trunk) where CLOBs are not readable due to a failed check on the val->type in dbd_oracle_get_entry() in dbd/apr_dbd_oracle.c.

In the surrounding switch statement, val->type has been determined to be one of the Oracle SQLT_BLOB or SQLT_CLOB values.  Then, to handle the CLOB case specifically, val->type is tested again but now it is incorrectly checked against APR_DBD_TYPE_CLOB instead of SQLT_CLOB.

That always fails, so CLOBs are treated as BLOBs, insufficient space may be allocated, and then trouble ensues.

The patch attached has been running in production for a long time; I just never realized I hadn't reported it to the APR list.