Ticket #243 (new defect)
COBIA IStream::Seek error.
Reported by: | jasper | Owned by: | jasper |
---|---|---|---|
Priority: | critical | Milestone: | Phase III |
Component: | COMBIA | Version: | |
Keywords: | Cc: |
Description
As reported by Michael:
Malcolm/Jasper: The following code in a property package Save/Load combination will illustrate the access violate on the second read of Load: STDMETHODIMP CapeThermoPropertyPackage::Load(LPSTREAM pStm) { unsigned char buf[4096]; ULONG cbRead; pStm->Read(buf, sizeof(buf), &cbRead); LARGE_INTEGER li; li.QuadPart = -4092; ULARGE_INTEGER libNewPosition; pStm->Seek(li, STREAM_SEEK_CUR, &libNewPosition); return pStm->Read(buf, sizeof(buf), &cbRead); } STDMETHODIMP CapeThermoPropertyPackage::Save(LPSTREAM pStm, BOOL fClearDirty) { unsigned char buf[7000]; ULONG cbWritten; return pStm->Write(buf, sizeof(buf), &cbWritten); } Michael Hlavinka
Reply:
There is certainly an error on the <0 value of the current position pointer in the COBIA Stream implementation, but I would expect below would succeed if there was indeed 4096 bytes of data in the stream. If not, the read would return less than 4096, and the seek is invalid (and fails to return an error). Can you check the return value of Read (how many bytes were read)? I am correcting the <0 error.
Note: See
TracTickets for help on using
tickets.
partial fix in commit de37b96