diff options
author | Tamás Bunth <btomi96@gmail.com> | 2017-01-10 15:16:08 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2017-01-11 17:48:01 +0000 |
commit | 38ce989b4f9d2aead097e5a2e95b819def7e2624 (patch) | |
tree | ff43201913229a4c315d9c9fa1b1e480e6f062af /connectivity | |
parent | 018beb38848fbd93889f29969f7ca5c68d0ac546 (diff) |
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/32937
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/Blob.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx index 7a7481bb1367..2c6b95261c31 100644 --- a/connectivity/source/drivers/firebird/Blob.cxx +++ b/connectivity/source/drivers/firebird/Blob.cxx @@ -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. |