Skip to content

4-byte long real numbers parsing #38

@AnatolyRugalev

Description

@AnatolyRugalev

I have an issue with plist files that macOS keeps in Preferences folder, and after some debugging I found that decoder does not respect possibility of the floating point number to be 4 bytes long.

What I get: unexpected EOF returned by parseReal, specifically from this line: https://github.com/groob/plist/blob/63fa881b19a57babfe576f2750f5dc3b29ebb69f/binary_parser.go#L257

The length of the byte slice there is 4 bytes, but binary.Read expects 8 bytes for float64 type.

This can probably be fixed with byte length check and with float32 type in case the length is 4. Then, it can be safely converted to float64 for internal use.

I noticed that converting problematic files to xml and back to binary solves the issue: plist encodes new binary files with float64 bytes, however, this is not a suitable workaround for me.

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