Skip to content
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

[1] PostgreSQLMessage.ParseRequest.serialize crashes when trying to use more than 2^15-1 parameters #102

Closed
MrMage opened this issue Aug 13, 2019 · 0 comments · Fixed by #103
Labels
bug Something isn't working

Comments

@MrMage
Copy link
Contributor

MrMage commented Aug 13, 2019

This calls through to func Utilities.write<T>(array: [T], closure: (inout ByteBuffer, T) -> ()), which calls write(integer: numericCast(array.count), as: Int16.self). And numericCast traps in Release builds for any values outside the representable range.

An example where this can happen is in Fluent queries with \.id ~~ <array with more than 2^15 elements>.

Suggested solution: throw an error when trying to build a query with this many elements.

@tanner0101 tanner0101 transferred this issue from vapor/postgres-kit Apr 24, 2020
@tanner0101 tanner0101 added the bug Something isn't working label Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants