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

Remove hard crash from MySQLData with malformed data #63

Closed
jdmcd opened this issue Sep 7, 2021 · 0 comments · Fixed by #64
Closed

Remove hard crash from MySQLData with malformed data #63

jdmcd opened this issue Sep 7, 2021 · 0 comments · Fixed by #64
Assignees
Labels
bug Something isn't working

Comments

@jdmcd
Copy link
Member

jdmcd commented Sep 7, 2021

Describe the bug

This section: https://github.com/vapor/mysql-nio/blob/main/Sources/MySQLNIO/MySQLData.swift#L448-L469 causes a hard crash (i.e. bang operator) when there is data that is malformed at the MySQL level. For example, a datetime that is non-nullable defaults to 0000-00-00 00:00:00.000000 which is 1. obviously invalid as a date and 2. causes the description property to crash.

To Reproduce

Do a SELECT from a table with a column with a date value set to 0000-00-00 00:00:00.000000

Expected behavior

It should not crash and ideally log out some kind of an error

Environment

MySQLNIO v 1.3.2

@jdmcd jdmcd added the bug Something isn't working label Sep 7, 2021
@gwynne gwynne self-assigned this Sep 7, 2021
gwynne added a commit that referenced this issue Sep 8, 2021
…me is received from older MySQL configurations which still do this. Returns a description of the epoch instead.
@gwynne gwynne closed this as completed in #64 Sep 8, 2021
gwynne added a commit that referenced this issue Sep 8, 2021
* Fix #63: Hard crash in MySQLData.description when a zero-value datetime is received from older MySQL configurations which still do this. Returns a description of the epoch instead.

* Use the thread-safe gmtime_r() instead of gmtime() in MySQLTime.init(date:).

* Pass a more sensible capacity value to ByteBufferAllocator for SHA digests.

* Fix deprecation warnings for TLSConfiguration and declare the explicit dependency on the update NIOSSL version.

* Another round of long-overdue CI updates

* Don't crash if server capabilities are not available during connection close.
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