Kaydet (Commit) 38ce989b authored tarafından Tamás Bunth's avatar Tamás Bunth Kaydeden (comit) Lionel Elie Mamane

XBlob::getBytes expects 1-indexed position

There was also a wrong relation. Now blob resets its position.

Change-Id: I41caf7cdfa261cafa5b9e66c9523c7f15225bfd8
Reviewed-on: https://gerrit.libreoffice.org/32937Reviewed-by: 's avatarLionel Elie Mamane <lionel@mamane.lu>
Tested-by: 's avatarLionel Elie Mamane <lionel@mamane.lu>
üst 018beb38
......@@ -149,19 +149,20 @@ uno::Sequence< sal_Int8 > SAL_CALL Blob::getBytes(sal_Int64 nPosition,
checkDisposed(Blob_BASE::rBHelper.bDisposed);
ensureBlobIsOpened();
if (nPosition > m_nBlobLength)
if (nPosition > m_nBlobLength || nPosition < 1)
throw lang::IllegalArgumentException("nPosition out of range", *this, 0);
// We only have to read as many bytes as are available, i.e. nPosition+nBytes
// can legally be greater than the total length, hence we don't bother to check.
if (nPosition > m_nBlobPosition)
if (nPosition -1 < m_nBlobPosition)
{
// Resets to the beginning (we can't seek these blobs)
closeBlob();
ensureBlobIsOpened();
}
skipBytes(nPosition - m_nBlobPosition);
// nPosition is indexed from 1.
skipBytes(nPosition - m_nBlobPosition -1 );
// Don't bother preallocating: readBytes does the appropriate calculations
// and reallocates for us.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment