Icon View Incident Report

Serious Serious
Reported By: Roy Lambert
Reported On: 4/11/2011
For: Version 2.05 Build 6
# 3426 Sensitive Query Results with SELECT Statements that Contain Expressions Can Cause AV

I'm getting an AV which runs back through my subclassed table component into your code. It happens when I'm opening a table (Calls.Open) so all my code is doing is calling your code. Switch back to build 4 and all is sweetness and light.

I tried deleting all events from the table component and the datasource - still blows up.

The query that is causing the problem is below, and the problem occurs after opening/closing/unpreparing/re-opening the query.

SELECT  IF(_aList IS NOT NULL, 62,-1) AS _xAttachment,
CASE
WHEN _ELNtype = 'EMail' THEN
  IF(_InOutInd = 'M«' THEN 146 ELSE 105)
WHEN _ELNType = 'Project' THEN 36
WHEN _ELNType = 'Note' THEN 36
WHEN _ELNType = 'Meeting' THEN 148
WHEN _ELNType = 'eShot' THEN 150
WHEN _ELNType = 'Fax' THEN 147
WHEN _ELNType = 'Letter' THEN 61
WHEN _ELNType = 'Mailshot' THEN 149
WHEN _ELNType = 'CC' THEN 152
WHEN _ELNType = 'Bcc' THEN 151 ELSE -1  END AS _xELNType,
(SELECT _Surname+' '+_Forename  FROM Contacts WHERE _ID = _fkContacts) AS _xContact, 
(SELECT _Name FROM Companies WHERE _ID = _fkCompanies) AS _xCompany,
IF(CURRENT_DATE - CAST(_Timestamp AS DATE) <= 30,TRUE,FALSE) AS _xRecent,
CAST(_Comments + ' ' + _Subject AS VARCHAR(210)) AS _xSubject,
CAST(_Timestamp AS VARCHAR(10)) AS _xTimestamp,
*
FROM ELN WHERE _fkContacts = :_fkContacts ORDER BY _TimeStamp DESC



Comments Comments
The problem was with the CAST() expressions. ElevateDB implements such simple expressions as computed columns in sensitive result sets, and the compiled computed column expressions were being incorrectly freed when the query was unprepared. Therefore, when the query was executed again, an AV would occur.


Resolution Resolution
Fixed Problem on 4/12/2011 in version 2.05 build 7


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image