File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
core/src/main/java/de/bluecolored/bluemap/core/world/mca/region Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,17 @@ public String getRegionFileName(int regionX, int regionZ) {
113113 public @ Nullable Vector2i getRegionFromFileName (String fileName ) {
114114 Matcher matcher = regionFileNamePattern .matcher (fileName );
115115 if (!matcher .matches ()) return null ;
116- return new Vector2i (
117- Integer .parseInt (matcher .group (1 )),
118- Integer .parseInt (matcher .group (2 ))
119- );
116+
117+ int regionX = Integer .parseInt (matcher .group (1 ));
118+ int regionZ = Integer .parseInt (matcher .group (2 ));
119+
120+ // sanity-check for roughly minecraft max boundaries (-30 000 000 to 30 000 000)
121+ if (
122+ regionX < -100000 || regionX > 100000 ||
123+ regionZ < -100000 || regionZ > 100000
124+ ) return null ;
125+
126+ return new Vector2i (regionX , regionZ );
120127 }
121128
122129 }
You can’t perform that action at this time.
0 commit comments