提交 a12e0f16 authored 作者: Thomas Mueller's avatar Thomas Mueller

The Recover tool could throw a ArrayIndexOutOfBoundsException.

上级 41285f19
......@@ -8,6 +8,7 @@ package org.h2.compress;
import java.io.IOException;
import java.io.InputStream;
import org.h2.message.DbException;
import org.h2.util.Utils;
/**
......@@ -52,7 +53,11 @@ public class LZFInputStream extends InputStream {
int size = readInt();
readFully(inBuffer, len);
buffer = ensureSize(buffer, size);
decompress.expand(inBuffer, 0, len, buffer, 0, size);
try {
decompress.expand(inBuffer, 0, len, buffer, 0, size);
} catch (ArrayIndexOutOfBoundsException e) {
DbException.convertToIOException(e);
}
this.bufferLength = size;
}
pos = 0;
......
......@@ -263,7 +263,11 @@ public class PageLog {
Arrays.fill(data.getBytes(), 0, store.getPageSize(), (byte) 0);
} else {
in.readFully(compressBuffer, 0, size);
compress.expand(compressBuffer, 0, size, data.getBytes(), 0, store.getPageSize());
try {
compress.expand(compressBuffer, 0, size, data.getBytes(), 0, store.getPageSize());
} catch (ArrayIndexOutOfBoundsException e) {
DbException.convertToIOException(e);
}
}
if (stage == RECOVERY_STAGE_UNDO) {
if (!undo.get(pageId)) {
......
......@@ -8,7 +8,6 @@ package org.h2.tools;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
......@@ -440,7 +439,7 @@ public class Recover extends Tool implements DataHandler {
writeSchema(writer);
try {
dumpPageLogStream(writer, logKey, logFirstTrunkPage, logFirstDataPage);
} catch (EOFException e) {
} catch (IOException e) {
// ignore
}
writer.println("---- Statistics ----------");
......@@ -580,7 +579,11 @@ public class Recover extends Tool implements DataHandler {
} else {
byte[] compressBuffer = new byte[size];
in.readFully(compressBuffer, 0, size);
compress.expand(compressBuffer, 0, size, data, 0, pageSize);
try {
compress.expand(compressBuffer, 0, size, data, 0, pageSize);
} catch (ArrayIndexOutOfBoundsException e) {
DbException.convertToIOException(e);
}
}
String typeName = "";
int type = data[0];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论