full integrity check

This commit is contained in:
Leijurv 2018-08-21 13:18:58 -07:00
parent 7d6d34c5aa
commit 530f87ad14
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -135,6 +135,7 @@ public final class CachedRegion implements ICachedChunkAccess {
} }
} }
} }
out.writeInt(~CACHED_REGION_MAGIC);
} }
hasUnsavedChanges = false; hasUnsavedChanges = false;
} catch (IOException ignored) {} } catch (IOException ignored) {}
@ -182,6 +183,10 @@ public final class CachedRegion implements ICachedChunkAccess {
} }
} }
} }
int fileEndMagic = in.readInt();
if (fileEndMagic != ~magic) {
throw new IOException("Bad end of file magic");
}
} }
hasUnsavedChanges = false; hasUnsavedChanges = false;
} catch (IOException ignored) {} } catch (IOException ignored) {}