[libpostgresql-jdbc-java] 01/03: When I added bounds checking for ResultSet.updateXXX methods, I accidentally removed bounds checking for getXXX methods. This resulted in an ArrayIndexOutOfBoundsException being thrown instead of the desired SQLException.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:17 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_0_314
in repository libpostgresql-jdbc-java.
commit a290bf9e6b0ba64fc06e4a891f4a12dfed3a6ab5
Author: Kris Jurka <books at ejurka.com>
Date: Sat Nov 5 09:25:03 2005 +0000
When I added bounds checking for ResultSet.updateXXX methods, I
accidentally removed bounds checking for getXXX methods. This
resulted in an ArrayIndexOutOfBoundsException being thrown instead
of the desired SQLException.
---
org/postgresql/jdbc2/AbstractJdbc2ResultSet.java | 3 ++-
org/postgresql/test/jdbc2/ResultSetTest.java | 19 ++++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
index 8aba6d6..849e1fd 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
@@ -3,7 +3,7 @@
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v 1.71.2.4 2005/06/08 01:48:14 oliver Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v 1.71.2.5 2005/09/29 22:12:11 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2450,6 +2450,7 @@ public abstract class AbstractJdbc2ResultSet implements BaseResultSet, org.postg
if ( this_row == null )
throw new PSQLException(GT.tr("ResultSet not positioned properly, perhaps you need to call next."),
PSQLState.INVALID_CURSOR_STATE);
+ checkColumnIndex(column);
}
//----------------- Formatting Methods -------------------
diff --git a/org/postgresql/test/jdbc2/ResultSetTest.java b/org/postgresql/test/jdbc2/ResultSetTest.java
index 8269ef7..fd09714 100644
--- a/org/postgresql/test/jdbc2/ResultSetTest.java
+++ b/org/postgresql/test/jdbc2/ResultSetTest.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/ResultSetTest.java,v 1.24 2004/12/17 21:24:30 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/ResultSetTest.java,v 1.25 2005/01/11 08:25:48 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -644,6 +644,23 @@ public class ResultSetTest extends TestCase
}
}
+ public void testGetOutOfBounds() throws SQLException
+ {
+ Statement stmt = con.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT id FROM testrs");
+ assertTrue(rs.next());
+
+ try {
+ rs.getInt(-9);
+ } catch (SQLException sqle) {
+ }
+
+ try {
+ rs.getInt(1000);
+ } catch (SQLException sqle) {
+ }
+ }
+
public void testClosedResult() throws SQLException
{
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list