-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIOFileSystem crashes when loading more than 2GB #2878
Comments
Oof. Yeah, we should throw an error and suggest using the streaming APIs instead. |
clintonpi
added a commit
to clintonpi/swift-nio
that referenced
this issue
Oct 9, 2024
Motivation: As described in issue (apple#2878)[apple#2878], NIOFileSystem crashes when reading more than `ByteBuffer` capacity. Modifications: - Add a new static property, `byteBufferCapacity`, to `ByteCount` representing the maximum amount of bytes that can be written to `ByteBuffer`. - Throw a `FileSystemError` in `ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)` when `maximumSizeAllowed` is more than `ByteCount.byteBufferCapacity`. Result: NIOFileSystem will `throw` instead of crashing.
clintonpi
added a commit
to clintonpi/swift-nio
that referenced
this issue
Oct 9, 2024
Motivation: As described in issue [apple#2878](apple#2878), NIOFileSystem crashes when reading more than `ByteBuffer` capacity. Modifications: - Add a new static property, `byteBufferCapacity`, to `ByteCount` representing the maximum amount of bytes that can be written to `ByteBuffer`. - Throw a `FileSystemError` in `ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)` when `maximumSizeAllowed` is more than `ByteCount.byteBufferCapacity`. Result: NIOFileSystem will `throw` instead of crashing.
glbrntt
pushed a commit
that referenced
this issue
Oct 10, 2024
… tolerate (#2911) Motivation: As described in issue [#2878](#2878), NIOFileSystem crashes when reading more than `ByteBuffer` capacity. Modifications: - Add a new static property, `byteBufferCapacity`, to `ByteCount` representing the maximum amount of bytes that can be written to `ByteBuffer`. - Throw a `FileSystemError` in `ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)` when `maximumSizeAllowed` is more than `ByteCount.byteBufferCapacity`. Result: NIOFileSystem will `throw` instead of crashing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
When requesting impossible things (e.g. loading more than 2GB into a
ByteBuffer
),NIOFileSystem
should raise an error and not crash.Actual behavior
Crash
Steps to reproduce
problem
The text was updated successfully, but these errors were encountered: