8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +01:00

Fixed AV in trace: after refactoring dsc_address field of input parameter descriptor contains offset in message buffer (it was real addresses before).

Reported by Alex privately.
This commit is contained in:
hvlad 2011-09-26 08:20:51 +00:00
parent f6c5405e28
commit c55cdb25f6
2 changed files with 17 additions and 7 deletions

View File

@ -286,16 +286,21 @@ void TraceSQLStatementImpl::DSQLParamsImpl::fillParams()
null_flag = DSC_null;
}
dsc* desc = NULL;
if (first_index > parameter->par_index)
{
m_descs.insert(0, parameter->par_desc);
m_descs.front().dsc_flags |= null_flag;
desc = &m_descs.front();
}
else
{
m_descs.add(parameter->par_desc);
m_descs.back().dsc_flags |= null_flag;
desc = &m_descs.back();
}
desc->dsc_flags |= null_flag;
UCHAR* msgBuffer = m_stmt->req_msg_buffers[parameter->par_message->msg_buffer_number];
desc->dsc_address = msgBuffer + (IPTR) desc->dsc_address;
}
}
}

View File

@ -153,8 +153,7 @@ public:
TraceSQLStatementImpl(const dsql_req* stmt, PerformanceInfo* perf) :
m_stmt(stmt),
m_perf(perf),
m_inputs(*getDefaultMemoryPool(), m_stmt->getStatement()->getSendMsg() ?
&m_stmt->getStatement()->getSendMsg()->msg_parameters : NULL)
m_inputs(*getDefaultMemoryPool(), m_stmt)
{}
// TraceSQLStatement implementation
@ -169,10 +168,15 @@ private:
class DSQLParamsImpl : public Firebird::AutoIface<TraceParams, FB_TRACE_PARAMS_VERSION>
{
public:
DSQLParamsImpl(Firebird::MemoryPool& pool, const Firebird::Array<dsql_par*>* params) :
m_params(params),
DSQLParamsImpl(Firebird::MemoryPool& pool, const dsql_req* const stmt) :
m_stmt(stmt),
m_params(NULL),
m_descs(pool)
{}
{
const dsql_msg* msg = m_stmt->getStatement()->getSendMsg();
if (msg)
m_params = &msg->msg_parameters;
}
virtual size_t FB_CARG getCount();
virtual const dsc* FB_CARG getParam(size_t idx);
@ -180,6 +184,7 @@ private:
private:
void fillParams();
const dsql_req* const m_stmt;
const Firebird::Array<dsql_par*>* m_params;
Firebird::HalfStaticArray<dsc, 16> m_descs;
};