FIX: FindIndex Works Incorrectly When nIndex Is Negative (173244)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q173244 SYMPTOMS
If a value less than 0 is passed to the FindIndex function, the function
will ASSERT in debug mode and enter an infinite loop in release mode.
CAUSE
The problem is that an ASSERT statement is used to test for a negative
value in the FindIndex function instead of an if...then statement that
would return NULL if the value is negative.
RESOLUTION
Check the value that is passed to FindIndex to make sure that it is not
negative before calling the FindIndex function.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem was corrected in Visual C++
version 6.0.
REFERENCES
See AFXTEMPL.H for CList, LIST_S.cpp for CStringList, LIST_P.cpp for
CPtrList, and LIST_O.cpp for CObList implementation details. The header
file can be found in the in the ...\VC\mfc\include directory and the source
files can be found in the ...\VC\mfc\src directory.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbBug kbfix kbNoUpdate kbVC600fix KB173244 |
---|
|