Skip to content

Parse CRLF .yaze project descriptors without dropping safety flags #206

Description

@scawful

Problem

The native .yaze parser is not CRLF-safe. std::getline removes \n but leaves \r; section recognition checks line.back() == ']' before removing carriage returns, and key/value trimming removes only spaces/tabs.

A CRLF descriptor therefore silently misses sections and values. Safety flags such as save_dungeon_water_fill_zones=false are not applied, leaving compiled defaults active.

Reproduction

  1. Convert a valid .yaze or bundle project.yaze from LF to CRLF.
  2. Open or run:
z3ed project-bundle-verify --project /path/to/project.yazeproj --format json

Observed on exact tree d02784a79afa334f566ffc260a353a98af45df19:

  • parser reports an empty project name
  • ROM path is not resolved
  • [feature_flags] is not recognized
  • kSaveWaterFillZones remains its compiled default (true)

Relevant code:

  • src/core/project.cc: ParseFromString() section check
  • src/core/project.cc: ParseKeyValue() trims only " \t"
  • src/core/features.h: WaterFill default

Expected

Treat CRLF and LF identically. Strip one trailing \r after std::getline (before comment/section/key parsing), with tests covering:

  • LF and CRLF parse equivalently
  • standalone .yaze and bundled project.yaze
  • safety flags remain false under CRLF
  • lone-CR input either parses deliberately or fails explicitly rather than silently falling back

Current Oracle mitigation

Oracle PR #127 forces generated/checked-in descriptors to LF and its CI rejects CRLF. That protects its documented producer path but does not repair Yaze's general parser behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions