Details
- 
    Bug 
- 
    Status: Closed (View Workflow)
- 
    Major 
- 
    Resolution: Fixed
- 
    1.1.12
- 
    None
- 
        3.13
Description
Unfortunately MariaDB server allows to store invalid utf8mb3 characters. This might end up in a possible crash of C/Python during fetch, since PyUnicode_GET_LENGTH doesn't perform any validation checks.
Instead of using the more secure function PyUnicode_GetLength (it does validate the Object) we shouldn't calculate length at all - this would also avoid to "overwrite" previous exception.
How to repeat:
|  | 
| import mariadb | 
|  | 
| conn= mariadb.connect(db="test") | 
| cursor= conn.cursor(binary=True) | 
| cursor.execute("CREATE OR REPLACE TABLE t1 (a varchar(20) charset utf8mb3)") | 
| cursor.execute("INSERT INTO t1 VALUES (0xEDA080)") | 
| conn.commit() | 
|  | 
| cursor.execute("SELECT a FROM t1") | 
| row= cursor.fetchone() | 
Attachments
Issue Links
- relates to
- 
                    CONPY-238 Querying mysql.slow_log table might cause UnicodeDecodeError -         
- Closed
 
-