Cockatrice MTG Client Bug Silently Wiped Deck Files on Full Disks
A bug in Cockatrice, the open-source Magic: The Gathering client, caused deck files to be permanently destroyed when saving to a full disk, with the app falsely reporting success. The issue, filed as #6952 by user Mekkiss, stemmed from three compounding failures in the DeckLoader::saveToFile() function: the file was truncated to zero bytes the moment it was opened for writing, serializers returned success unconditionally without verifying data was written, and the return value of flush() was discarded rather than checked. Because truncating a file frees rather than requires disk space, the open() call succeeded even on a full drive, wiping the existing deck before any new data could be written. Two additional write paths in the codebase shared the same flawed pattern, meaning a deck could be silently zeroed simply by opening it, without ever pressing save. The bug was traced and documented with fixes proposed for all three affected functions to properly validate write operations before reporting success.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in