avoid overflow when reading more than 64k into buffer
(we had only two tiles where this could have happend :)
This commit is contained in:
parent
c5663df198
commit
e4276ae9c4
@ -857,8 +857,8 @@ public class MapDatabase implements IMapDatabase {
|
|||||||
if (mBufferSize == mBufferPos) {
|
if (mBufferSize == mBufferPos) {
|
||||||
mBufferPos = 0;
|
mBufferPos = 0;
|
||||||
mBufferSize = 0;
|
mBufferSize = 0;
|
||||||
} else if (mBufferPos + (size - mBufferSize) > BUFFER_SIZE) {
|
} else if (mBufferPos + size > BUFFER_SIZE) {
|
||||||
Log.d(TAG, "wrap buffer" + (size - mBufferSize) + " " + mBufferPos);
|
//Log.d(TAG, "wrap buffer" + (size - mBufferSize) + " " + mBufferPos);
|
||||||
// copy bytes left to read to the beginning of buffer
|
// copy bytes left to read to the beginning of buffer
|
||||||
mBufferSize -= mBufferPos;
|
mBufferSize -= mBufferPos;
|
||||||
System.arraycopy(mReadBuffer, mBufferPos, mReadBuffer, 0, mBufferSize);
|
System.arraycopy(mReadBuffer, mBufferPos, mReadBuffer, 0, mBufferSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user