You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GHSA-m9g2-p2p8-8xmm: A robot could access files outside its own directories.
The checks of the files that robots access are now more strict. Robots can only access the files that were checked.
getDataFile() now keeps the file inside the robot's own data directory, also when the file name is formed so that it only becomes a path outside the directory after Robocode has processed it. Reported by CyanM0un.
Bugfix
#117: With hidden enemy names, each event had a new String for the name of a robot, but robots may compare names with == or !=, as these work for real names. RougeDC is one robot that did worse because of this. Fixed by Chase-san.
With hidden enemy names, a robot could see the real name of the robot that fired a bullet in HitByBulletEvent and BulletHitBulletEvent, if the robot that fired was on a team.
Files that a robot left open were not closed when the battle ended. They are now closed, with a warning in the console naming the robot and the file. On Windows, an open file cannot be deleted.
With Java 24 and newer, a robot that wrote a file stayed in memory after the battle, as its thread was kept in a list that only the SecurityManager removed threads from. Long runs, e.g. of the RoboRumble client, ran out of memory and hung.
If a robot caught a StackOverflowError and then asked for the stack trace, and this was the first stack trace in Java, it could fail for every robot in all later battles with a NoClassDefFoundError. Robocode now takes a stack trace when it starts. Reported by Chase-san.
A robot built for a newer version of Java stayed invalid after changing to that version of Java, until the robot database was rebuilt by hand. The robot database is now rebuilt when the version of Java changes.
With Java 24 and newer, a program using the Robocode API could not read from System.in. Robots cannot read from it with any version of Java, and are stopped if they try.
#123: Fix robot code running outside the robot's thread
The finalize() method of a robot class ran on Java's finalizer thread, where robot code is not checked like on the robot's own threads. Java no longer calls finalize() of robot classes, so robots cannot rely on it.
With Java 8 to 11, the cleanup after a robot could run its static initializers. Their output went to the main console instead of the robot's console, and building the robot database took longer.
#124: Fix existing robots being rejected since version 1.11.2, because they used something robots are not allowed to use, even in code that never runs. Robots do not need to be changed for this.
Robots can use Logger, Level, AWTKeyStroke, MessageDigest, SecureRandom, and ImageIO.write() to a stream again, and new Scanner(File) and new ZipFile(File) on their own files.
Robots using time zones, e.g. via ZipOutputStream, are no longer punished with Java versions having the SecurityManager, as Robocode now loads the time zone rules itself.
Robots can use Thread.stop() on their own threads, also via a subclass of Thread. It interrupts the thread with Java 20 and newer, as Java can no longer stop threads.
Robots with FileOutputStream or FileWriter in their code can be loaded again, and are stopped if they really try to use them, as before. Robots must use RobocodeFileOutputStream or RobocodeFileWriter.
Thanks go to Chase-san for finding and reporting this ❤️.
Changes
#117: New HIDENAMES setting for the RoboRumble client, by Chase-san. With HIDENAMES=YES in a rumble's configuration, robots only see their enemies by anonymous names like #1, and uploads say hidenames=YES.
#118: New CLEARDATA setting for the RoboRumble client, by Chase-san. With CLEARDATA=YES, the data robots saved is deleted before each battle, so they only keep it between the rounds of one battle, and uploads say cleardata=YES. Data in a robot's jar is not lost. If the data cannot be deleted, even after a garbage collection in case a robot left a file open for reading, the client logs which file it was, waits a minute, and skips the battle.
Both settings default to NOT and must match the rumble on the server. The official LiteRumble rumbles need NOT.