Skip to content

Commit 7c76a8c

Browse files
committed
odbc: validate described column indices
1 parent ec85119 commit 7c76a8c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • sqlx-core/src/odbc/connection

‎sqlx-core/src/odbc/connection/mod.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ where
5151
Ok(OdbcColumn {
5252
name: decode_column_name(cd.name, index),
5353
type_info: OdbcTypeInfo::new(cd.data_type),
54-
ordinal: usize::from(index.checked_sub(1).unwrap()),
54+
ordinal: usize::from(
55+
index
56+
.checked_sub(1)
57+
.ok_or_else(|| Error::Protocol("ODBC column indices are 1-based".into()))?,
58+
),
5559
})
5660
}
5761

0 commit comments

Comments
 (0)