mojira.dev
MC-177378

MCA (Anvil) file headers use 32-bit dates for file modification time (year 2038 problem)

The MCA (Anvil) file format has the following data in the headers:

  • Cluster 0: Location and size of chunk data.

  • Cluster 1: Date stamps of last modification for each chunk as 32-bit integers

These 32-bit integers are expressed as the number of seconds since January 1, 1970, and these file modification times are showing their age. (Recent files would have values around 5E 00 00 00 hex.)

These 32-bit integers are not currently a problem, but they are deprecated. They will be problematic when they reach 80 00 00 00 hex in January, 2038. They could be treated as negative numbers and any comparisons would fail.

Attachments

Comments 3

Is this still an issue in the latest version (1.20.4)?

The 32-bit dates are still there in the second chunk of region files (0x1000 to 0x1fff), therefore it is still an issue.

The exact issue concerns the possibility of integer overflow when signed 32-bit dates roll over to negative numbers on 2038-01-19 (13 years from now). I have no knowledge of how these dates in anvil files are used, but if they are ever compared to anything at any time, the comparison could fail after that date due to overflow of signed 32-bit integers.

See Wikipedia article here: https://en.wikipedia.org/wiki/Year_2038_problem

I recommend giving this report a very low priority for the next few years until the need for 2038 compliance checking becomes more relevant.

Keep in mind this issue will affect all worlds in all affected versions. I'm not sure if current/previous versions will be playable after January 19, 2038. It should be possible to test by changing your system clock, however.

bdm68

(Unassigned)

Plausible

Save Data

1.15.2

Retrieved