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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user