Issue Details (XML | Word | Printable)

Key: CORE-5254
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Mahmudov Ilgar S.
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Firebird Core

isc_que_events callback function randomly return invalid Update Buffer

Created: 26/May/16 11:15 AM   Updated: 19/May/17 09:23 AM
Component/s: API / Client Library
Affects Version/s: 2.5.4
Fix Version/s: None

Environment: Windows 7 Ultimate, Firebird 2.5.4, Embarcadero RAD XE2

QA Status: No test


 Description  « Hide
I use POST EVENT in triggers and stored procedures. For catching events I try use FIBPlus, but found AV when registering/unregistering Events (~50 % times in application staring/closing). I write my own component (similar to FIBPlus super alerter and IBEvents) and found that EventBuffer used in
res = Parent->Database->ClientLibrary->isc_que_events(StatusVector, &DBH, &EventID, EventBufferLen, EventBuffer, (TISC_CALLBACK)EventCallback, PVoid)this);
in sometimes corrupt, because of in EventCallback function receive invalid Updated, witch copied to ResulBuffer and then isc_event_counts copied ResultBuffer to EventBuffer

void EventCallback(void *Ptr, short Length, unsigned char *Updated)
{
if (Ptr && Updated)
{
TMxFBEventsBlockListener *T = (TMxFBEventsBlockListener *)Ptr;

T->UpdateResultBuffer(Length, Updated);
T->SignalEvent();
}
}
//---------------------------------------------------------------------------
void __fastcall TMxFBEventsBlockListener::UpdateResultBuffer(short Length, unsigned char *Updated)
{
if (Length == EventBufferLen && Updated[0] == 1)
memcpy(ResultBuffer, Updated, Length);
else // ---------------------------------------------------> INVALID UPDATED
{
memcpy(ResultBuffer, EventBuffer, EventBufferLen); // this is my patch, witch help call isc_que_events without error 335544973
// bFirstTime = true;
Parent->DoError("MxFBEventsAlerter: Invalid Updated buffer ="+IntToStr(Length), 0);
}
}

This is floating error. You can 100 times unregister and register again same event list and see this error 20-50 times.

İ can send all sources

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov added a comment - 26/May/16 11:28 AM
In callback you must check that length > 0 in addition to updated != NULL.

Mahmudov Ilgar S. added a comment - 26/May/16 11:45 AM
İt's already checked in UpdateResultBuffer
if (Length == EventBufferLen && Updated[0] == 1)

Vlad Khorsun added a comment - 19/May/17 09:23 AM
It looks like recently fixed CORE-5521
Is it still actual ?