Better logging on invalid database data.
GitOrigin-RevId: f474f0493d701758836c3c0345ff8697b5be9ce5
This commit is contained in:
parent
9ed550bdb1
commit
ef924d218d
@ -4139,7 +4139,14 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
|||||||
if (has_message_count_by_index) {
|
if (has_message_count_by_index) {
|
||||||
int32 size;
|
int32 size;
|
||||||
parse(size, parser);
|
parse(size, parser);
|
||||||
CHECK(static_cast<size_t>(size) <= message_count_by_index.size());
|
if (size < 0) {
|
||||||
|
// the logevent is broken
|
||||||
|
// it should be impossible, but has happenned at least once
|
||||||
|
parser.set_error("Wrong message_count_by_index table size");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG_CHECK(static_cast<size_t>(size) <= message_count_by_index.size())
|
||||||
|
<< size << " " << message_count_by_index.size();
|
||||||
for (int32 i = 0; i < size; i++) {
|
for (int32 i = 0; i < size; i++) {
|
||||||
parse(message_count_by_index[i], parser);
|
parse(message_count_by_index[i], parser);
|
||||||
}
|
}
|
||||||
@ -4205,7 +4212,7 @@ void MessagesManager::CallsDbState::parse(ParserT &parser) {
|
|||||||
parse(first_calls_database_message_id_by_index[i], parser);
|
parse(first_calls_database_message_id_by_index[i], parser);
|
||||||
}
|
}
|
||||||
parse(size, parser);
|
parse(size, parser);
|
||||||
CHECK(static_cast<size_t>(size) <= message_count_by_index.size());
|
LOG_CHECK(static_cast<size_t>(size) <= message_count_by_index.size()) << size << " " << message_count_by_index.size();
|
||||||
for (int32 i = 0; i < size; i++) {
|
for (int32 i = 0; i < size; i++) {
|
||||||
parse(message_count_by_index[i], parser);
|
parse(message_count_by_index[i], parser);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user