nvs: check CRC of items on full pages

Previously NVS did check CRC values of key-value pairs on the active
page, but the check for full pages was missing. This adds the necessary
check and a test for it.
This commit is contained in:
Ivan Grokhotkov
2017-09-04 11:54:18 +08:00
parent c0510c4266
commit c0269bc1cd
2 changed files with 49 additions and 0 deletions
+11
View File
@@ -577,6 +577,17 @@ esp_err_t Page::mLoadEntryTable()
}
mHashList.insert(item, i);
if (item.crc32 != item.calculateCrc32()) {
err = eraseEntryAndSpan(i);
if (err != ESP_OK) {
mState = PageState::INVALID;
return err;
}
continue;
}
assert(item.span > 0);
size_t span = item.span;
i += span - 1;