Commit cf655518 authored by Varun Khaneja's avatar Varun Khaneja Committed by Commit Bot

Remove the restriction for the length of prefixes to be a multiple of prefix_size

R=nparker

Bug: 933065
Change-Id: Ie2e790cd9ce5fa2aa5f0e7ef9d200b1d0e608060
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1509012Reviewed-by: default avatarNathan Parker <nparker@chromium.org>
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Auto-Submit: Varun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649624}
parent 9c16ed6b
......@@ -65,7 +65,6 @@ class V4StoreFuzzer {
// * First uint8_t is the |prefix_size| to be added.
// * Next uint8_t is the length of the list of prefixes.
// * It is adjusted to be no greater than the remaining size of |data|.
// * It is adjusted to be a multiple of |prefix_size|.
// * It is called as |prefixes_list_size|.
// * Next |prefixes_list_size| bytes are added to |hash_prefix_map|
// as a list of prefixes of size |prefix_size|.
......@@ -86,16 +85,12 @@ class V4StoreFuzzer {
if (!GetDatum(data, size, &datum))
return;
// This |datum| tells us how long should the list of prefixes be.
// It can't be larger than the remaining buffer.
if (*size < datum) {
datum = *size;
size_t prefixes_list_size = datum;
// This |prefixes_list_size| is the length of the list of prefixes to be
// added. It can't be larger than the remaining buffer.
if (*size < prefixes_list_size) {
prefixes_list_size = *size;
}
// For the list of prefixes to be inserted into |hash_prefix_map|, its size
// needs to be a multiple of |prefix_size|. Otherwise
// |V4Store::AddUnlumpedHashes| would simply discard the input and it'll
// never reach |MergeUpdate|.
size_t prefixes_list_size = (datum / prefix_size) * prefix_size;
std::string prefixes(*data, *data + prefixes_list_size);
*size -= prefixes_list_size;
*data += prefixes_list_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment