Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Fix] Misc bug fixes

Summary:
I turned on some c++ std library debugging features, and found a few minor
issues.
 - we deleted an entry from a vector, while iterating over it without adjusting
   the total count, or the current index (so we ended up skipping the next element,
   and accessing past the end of the vector)
 - the iterator didnt match the map in a few places
 - uninitialized stl iterators are "singular" - meaning that you cant do
   anything with them, including initialize /another/ iterator with them. This
   means that using [] on a map of iterators is technically undefined behavior.

Test Plan: fast_tests slow_tests

Reviewers: qigao, myang

Reviewed By: myang

CC: ps, mwilliams, myang

Differential Revision: 340611
  • Loading branch information...
commit 8ebcef2e50da827f2cc8637ef3285d40b4a3ef05 1 parent 6588637
@markw65 markw65 authored scottmac committed
View
2  src/compiler/analysis/class_scope.cpp
@@ -326,6 +326,8 @@ void ClassScope::collectMethods(AnalysisResultPtr ar,
m_derivesFromRedeclaring = DirectFromRedeclared;
}
m_bases.erase(m_bases.begin() + i);
+ n--;
+ i--;
}
}
}
View
10 src/runtime/eval/runtime/eval_state.cpp
@@ -578,7 +578,7 @@ void RequestEvalState::GetMethodStaticVariables(Array &arr) {
mprefix += "$$";
Variant val;
if (it->second.size() > 1) {
- for (map<string, LVariableTable>::iterator cit =
+ for (map<string, LVariableTable, string_lessi>::iterator cit =
it->second.begin(); cit != it->second.end(); ++cit) {
Array vars(cit->second.getDefinedVars());
for (ArrayIter vit(vars); !vit.end(); vit.next()) {
@@ -690,8 +690,8 @@ void RequestEvalState::fiberInit(RequestEvalState *res,
// Method statics
for (MethodStatics::const_iterator it = res->m_methodStatics.begin();
it != res->m_methodStatics.end(); ++it) {
- for (map<string, LVariableTable>::const_iterator it2 = it->second.begin();
- it2 != it->second.end(); ++it2) {
+ for (map<string, LVariableTable, string_lessi>::const_iterator
+ it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
m_methodStatics[it->first][it2->first].
Array::operator=(it2->second.fiberMarshal(refMap));
}
@@ -770,8 +770,8 @@ void RequestEvalState::fiberExit(RequestEvalState *res,
// Method statics
for (MethodStatics::const_iterator it = res->m_methodStatics.begin();
it != res->m_methodStatics.end(); ++it) {
- for (map<string, LVariableTable>::const_iterator it2 = it->second.begin();
- it2 != it->second.end(); ++it2) {
+ for (map<string, LVariableTable, string_lessi>::const_iterator
+ it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
refMap.unmarshal((Array&)m_methodStatics[it->first][it2->first],
(Array&)it2->second, default_strategy);
}
View
4 src/util/synchronizable_multi.cpp
@@ -60,10 +60,10 @@ bool SynchronizableMulti::waitImpl(int id, bool front, timespec *ts) {
if (front) {
m_cond_list.push_front(cond);
- m_cond_map[cond] = m_cond_list.begin();
+ m_cond_map.insert(make_pair(cond, m_cond_list.begin()));
} else {
m_cond_list.push_back(cond);
- m_cond_map[cond] = --m_cond_list.end();
+ m_cond_map.insert(make_pair(cond, --m_cond_list.end()));
}
int ret;
Please sign in to comment.
Something went wrong with that request. Please try again.