Skip to content

Fix reading files larger than 2GiB on macOS#3

Open
stuart8c wants to merge 2 commits intobuergmann:mainfrom
stuart8c:main
Open

Fix reading files larger than 2GiB on macOS#3
stuart8c wants to merge 2 commits intobuergmann:mainfrom
stuart8c:main

Conversation

@stuart8c
Copy link
Copy Markdown

  • macOS read() returns EINVAL when count > INT_MAX. For files >2GiB, read_to_end() passed the full file size in a single call which silently failed. The uninitialised malloced buffer was displayed (usually all 00 bytes) with no error message.
  • Cap each read() call to 0x7FFF0000 bytes (to accommodate Linux and macOS), looping for the remainder.
  • When read_to_end() fails exit with perror() instead of calling sysemsg() which gets immediately painted over by repaint().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants