John,

Yup. This one is already fixed in CVS (exactly your fix below :>). One of the reasons we need to get a new version out.

With thanks!

Cheers,
        Berin


John Moore wrote:


While testing, my program started failing. I traced it to the following code snippet from XSECCannon::outputBuffer() (my changes are commented with "JDM"):

// While we don't have enough, and have not completed -

while (!m_allNodesDone && (remaining < bytesToGo)) {

                // Copy what we have and get some more in the buffer
                memcpy(&outBuffer[i], &m_buffer[m_bufferPoint], remaining);
                i += remaining;
                m_bufferPoint += remaining;
                bytesToGo -= remaining;

// Get more

processNextNode();

remaining = m_bufferLength - m_bufferPoint;

}

//if (m_allNodesDone) { // JDM bug fix - deleted
if (m_allNodesDone && (remaining < bytesToGo)) { // JDM bug fix - inserted


                // Was not enough data to fill everything up
                memcpy (&outBuffer[i], &m_buffer[m_bufferPoint], remaining);
                m_bufferPoint += remaining;
                return i + remaining;
        }
        
        // Copy the tail of the buffer

        memcpy(&outBuffer[i], &m_buffer[m_bufferPoint], bytesToGo);
        m_bufferPoint += bytesToGo;
        return (bytesToGo + i);

The symptoms were that this method was returning more chars than the maximum specified in the parameter numBytes (in my case it was returning 1027 bytes when numBytes was set to only 1024)

Just thought you might want to know, if you are planning a release soon.

ta john







Reply via email to