happly icon indicating copy to clipboard operation
happly copied to clipboard

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

Open mjaein opened this issue 8 months ago • 0 comments

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

mjaein avatar May 27 '25 09:05 mjaein