From 016d25e2bf13e43fc8b45088318459a234ef8c21 Mon Sep 17 00:00:00 2001 From: Mark Newnham Date: Fri, 20 Feb 2026 10:42:42 -0700 Subject: Validates method for out-of-bound indexes --- adodb.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/adodb.inc.php b/adodb.inc.php index 485ae4ea..5589835c 100644 --- a/adodb.inc.php +++ b/adodb.inc.php @@ -5559,13 +5559,21 @@ class ADORecordSet implements IteratorAggregate { } /** - * @param int [$fieldOffset] + * @param int $fieldOffset The required offset * - * @return \ADOFieldObject + * @return false|\ADOFieldObject */ function FetchField($fieldOffset = -1) { if (isset($this->_fieldobjects)) { - return $this->_fieldobjects[$fieldOffset]; + if (array_key_exists($fieldOffset, $this->_fieldobjects)) { + return $this->_fieldobjects[$fieldOffset]; + } else { + return false; + } + } + + if (!array_key_exists($fieldOffset, $this->_colnames)) { + return false; } $o = new ADOFieldObject(); $o->name = $this->_colnames[$fieldOffset]; -- cgit v1.3