mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
add size check to prevent further corruption in case of read offset
This commit is contained in:
@@ -109,6 +109,9 @@ public class MantleChunk {
|
|||||||
din.skipTo(end);
|
din.skipTo(end);
|
||||||
TectonicPlate.addError();
|
TectonicPlate.addError();
|
||||||
}
|
}
|
||||||
|
if (din.count() != start + size) {
|
||||||
|
throw new IOException("Chunk section read size mismatch!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,10 +99,9 @@ public interface Matter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Matter read(File f) throws IOException {
|
static Matter read(File f) throws IOException {
|
||||||
FileInputStream in = new FileInputStream(f);
|
try (var in = new FileInputStream(f)) {
|
||||||
Matter m = read(in);
|
return read(in);
|
||||||
in.close();
|
}
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Matter read(InputStream in) throws IOException {
|
static Matter read(InputStream in) throws IOException {
|
||||||
@@ -165,6 +164,10 @@ public interface Matter {
|
|||||||
}
|
}
|
||||||
din.skipTo(end);
|
din.skipTo(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (din.count() != start + size) {
|
||||||
|
throw new IOException("Matter slice read size mismatch!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return matter;
|
return matter;
|
||||||
|
|||||||
Reference in New Issue
Block a user