PR# 18092 The ARRAYED_LIST iteratation procedures 'do_if' and 'do_all', iterate beyond the count of list items
Problem Report Summary
Submitter: finnianr
Category: EiffelBase
Priority: Medium
Date: 2012/01/29
Class: Bug
Severity: Serious
Number: 18092
Release: 7.0.8.8074
Confidential: No
Status: Open
Responsible:
Environment: Ubuntu Linux x86_64 10.10
Synopsis: The ARRAYED_LIST iteratation procedures 'do_if' and 'do_all', iterate beyond the count of list items
Description
The do_all and do_if iterators should not iterate past the count of items. The expression (area_v2.count - 1) in the code below represents the list capacity which may be greater than the count of items. class ARRAYED_LIST [G] feature -- Iteration do_all (action: PROCEDURE [ANY, TUPLE [G]]) -- Apply `action' to every item, from first to last. -- Semantics not guaranteed if `action' changes the structure; -- in such a case, apply iterator to clone of structure instead. do area_v2.do_all_in_bounds (action, 0, area_v2.count - 1) end
To Reproduce
Problem Report Interactions
do_all and there_exists also have an incorrect upper bound. do_all_with_index and do_if_with_index have the correct upper bound