Skip to content

Bug: ASCII PLY parsing fails on files with \r line endings due to binary mode #45

Description

@mjaein

When loading an ASCII PLY file via PLYData(filename), the parser fails to properly handle empty lines containing standalone \r (Carriage Return) characters. This occurs because the file is opened in binary mode (preserving raw \r), but the ASCII parser does not explicitly skip them. As a result, lines with \r are treated as valid content, leading to crashes.

Expected behavior:
The parser should safely ignore empty lines regardless of line ending type (\n, \r\n, or \r).

Reproduction:

  • Create an ASCII PLY file with empty lines between header and data.
  • Load it with happly::PLYData plyIn("file.ply", false);
  • Parsing will fail when reading element data.

fily.ply:
ply
format ascii 1.0
element vertex 1
property float x
property float y
property float z
end_header

0.0 0.0 0.0

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions