Bug #102076 Contribution: MySQL JDBC Driver ResultSet.getLong() throws NumberOutOfRange
Submitted: 27 Dec 2020 16:32 Modified: 12 Mar 2021 20:11
Reporter: Gary Gregory (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:8.0.22 OS:Any
Assigned to: CPU Architecture:Any
Tags: jdbc

[27 Dec 2020 16:32] Gary Gregory
Description:
https://github.com/mysql/mysql-connector-j/pull/58

How to repeat:
https://github.com/mysql/mysql-connector-j/pull/58

Suggested fix:
https://github.com/mysql/mysql-connector-j/pull/58
[28 Dec 2020 15:48] MySQL Verification Team
Thank you for the bug report. If you want to make a contribution, please attach here the patch and then assign the OCA according the instructions you got in the link you mentioned:

 n order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html
[28 Dec 2020 16:05] Gary Gregory
I've submitted my OCA as part of my fix here: https://github.com/mysql/mysql-connector-j/pull/58
[28 Dec 2020 16:16] MySQL Verification Team
src/main/protocol-impl/java/com/mysql/cj/protocol/a/MysqlTextValueDecoder.java
@@ -102,7 +102,7 @@
    }

    public <T> T decodeInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf) {
  -      return vf.createFromLong(getInt(bytes, offset, offset + length));
  +      return vf.createFromLong(getLong(bytes, offset, offset + length));
    }

    public <T> T decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) {
[28 Dec 2020 16:18] MySQL Verification Team
Thank you for the contribution.
[26 Jan 2021 8:40] Alexander Soklakov
The Bug#102225 was marked as a duplicate of this one.
[12 Mar 2021 20:11] Daniel So
Posted by developer:
 
Added the following entry to the Connector/J 8.0.24 changelog: 

"Using getLong() on the CHAR_OCTET_LENGTH column of the ResultSet for DatabaseMetaData.getProcedureColumns() (or getFunctionColumns()) resulted in a NumberOutOfRange exception when the column's value exceeded 232 − 1. With this patch, the value of 232 − 1 is returned in the situation."