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.
I have an issue with
plistfiles 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 EOFreturned byparseReal, specifically from this line: https://github.com/groob/plist/blob/63fa881b19a57babfe576f2750f5dc3b29ebb69f/binary_parser.go#L257The length of the byte slice there is 4 bytes, but
binary.Readexpects 8 bytes forfloat64type.This can probably be fixed with byte length check and with
float32type 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:
plistencodes new binary files with float64 bytes, however, this is not a suitable workaround for me.