vapor / mysql-nio

🐬 Non-blocking, event-driven Swift client for MySQL.
MIT License
87 stars 28 forks source link

Remove hard crash from `MySQLData` with malformed data #63

Closed jdmcd closed 2 years ago

jdmcd commented 2 years ago

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