Author: faridz
Date: Mon Sep 17 02:32:53 2007
New Revision: 576327
URL: http://svn.apache.org/viewvc?rev=576327&view=rev
Log:
2007-09-17 Farid Zaripov <[EMAIL PROTECTED]>
* catalog.cpp (__catfind): Fixed undefined behavior
when __rw_catlist vector is full and id is not valid.
Modified:
incubator/stdcxx/trunk/src/catalog.cpp
Modified: incubator/stdcxx/trunk/src/catalog.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/catalog.cpp?rev=576327&r1=576326&r2=576327&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/catalog.cpp (original)
+++ incubator/stdcxx/trunk/src/catalog.cpp Mon Sep 17 02:32:53 2007
@@ -71,12 +71,14 @@
CatVector::size_type __catfind(nl_catd id)
{
- CatVector::size_type i = 0;
- while (i < __rw_catlist.size() && __rw_catlist[i] && __rw_catlist[i]->id()
!= id)
- i++;
- if (!__rw_catlist[i])
- return __rw_catlist.size();
- return i;
+ for (CatVector::size_type i = 0;
+ i < __rw_catlist.size() && __rw_catlist[i]; ++i) {
+
+ if (__rw_catlist[i]->id() == id)
+ return i;
+ }
+
+ return __rw_catlist.size();
}