Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 02:50:05 +01:00
Fixes unsafe memory access using cross server clipboards (#651)
Co-authored-by: wea_ondara <wea_ondara@alpenblock.net>
Dieser Commit ist enthalten in:
Ursprung
5e67c1b658
Commit
3f1e8fa4d4
@ -25,6 +25,7 @@ import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
@ -148,6 +149,7 @@ public class ClipboardCommands {
|
||||
copy.setSourceMask(mask);
|
||||
}
|
||||
Operations.completeLegacy(copy);
|
||||
saveDiskClipboard(clipboard);
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
@ -259,6 +261,7 @@ public class ClipboardCommands {
|
||||
copy.setSourceMask(mask);
|
||||
}
|
||||
Operations.completeLegacy(copy);
|
||||
saveDiskClipboard(clipboard);
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
@ -539,4 +542,16 @@ public class ClipboardCommands {
|
||||
session.setClipboard(null);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.clearclipboard.cleared"));
|
||||
}
|
||||
|
||||
private void saveDiskClipboard(Clipboard clipboard) {
|
||||
DiskOptimizedClipboard c;
|
||||
if (clipboard instanceof DiskOptimizedClipboard)
|
||||
c = (DiskOptimizedClipboard) clipboard;
|
||||
else if (clipboard instanceof BlockArrayClipboard
|
||||
&& ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard)
|
||||
c = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent();
|
||||
else
|
||||
return;
|
||||
c.flush();
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren