Skip to content

Generals crashes loading a retail compatible save when retail compatibility is disabled #3298

Description

@bobtista

A Generals build with RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME=OFF crashes on the first object when it loads a save written by retail 1.08 or by a retail compatible build.

DamageInfoInput::xfer checks currentVersion where it should check version:

// kill no matter what (old versions default to FALSE).
if( currentVersion >= 2 )
{
xfer->xferBool( &m_kill );
}

currentVersion is 1 under RTS_GENERALS && RETAIL_COMPATIBLE_XFER_SAVE and 3 otherwise. With compatibility off it is 3, so the load reads a m_kill byte that a version 1 record does not have. Everything after it is off by one. ActiveBody::xfer transfers a DamageInfo for every object, so the first object with a body crashes the load.

Original Generals never wrote m_kill. #2141 brought the line over from Zero Hour, where retail 1.04 always wrote version 3 and the check is always true.

Repro:

  1. Build Generals with default options, start a mission, save
  2. Build Generals with -DRTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME=OFF
  3. Load that save

Access violation in CHUNK_GameLogic on the first Xfer Object line in the log.

This is one of the six sites in #3297. It crashes and the other five do not, so it gets its own issue. The closed #2922 included the same line in a larger change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions