-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b71
-
x86
-
linux
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Timer.TaskQueue.add() does not gracefully handle OutOfMemoryError's. In the following code:
void add(TimerTask task) {
// Grow backing store if necessary
if (++size == queue.length) {
TimerTask[] newQueue = new TimerTask[2*queue.length];
System.arraycopy(queue, 0, newQueue, 0, size);
queue = newQueue;
}
queue[size] = task;
fixUp(size);
}
an OutOfMemoryError thrown while expanding the queue will result in size being larger than queue.length.
It should be simple to fix by testing against (size + 1) and incrementing size after the if block.
REPRODUCIBILITY :
This bug can be reproduced always.
A DESCRIPTION OF THE PROBLEM :
Timer.TaskQueue.add() does not gracefully handle OutOfMemoryError's. In the following code:
void add(TimerTask task) {
// Grow backing store if necessary
if (++size == queue.length) {
TimerTask[] newQueue = new TimerTask[2*queue.length];
System.arraycopy(queue, 0, newQueue, 0, size);
queue = newQueue;
}
queue[size] = task;
fixUp(size);
}
an OutOfMemoryError thrown while expanding the queue will result in size being larger than queue.length.
It should be simple to fix by testing against (size + 1) and incrementing size after the if block.
REPRODUCIBILITY :
This bug can be reproduced always.