Open
Description
// Generate fuzzed comments.
for (int i = 0; i < tc.comments; ++i) {
tc.comment_lengths[i] = fuzzed_data.ConsumeIntegralInRange<int>(1, 128);
tc.user_comments[i] = (char *)malloc(tc.comment_lengths[i]);
if (!tc.user_comments[i]) {
continue;
}
fuzzed_data.ConsumeData(tc.user_comments[i], tc.comment_lengths[i]);
}
fuzzed_data.ConsumeData(tc.user_comments[i], tc.comment_lengths[i]);
is wrong, because ConsumeData
doesn't guarantee it'll write tc.comment_lengths[i]
bytes of data, leading to potential false positive OOB reads afterwards.
This should instead be:
tc.comment_lengths[i] = fuzzed_data.ConsumeData(tc.user_comments[i], tc.comment_lengths[i]);
Is there some instruction we can give to prevent this misuse of FDP ? @DavidKorczynski @DonggeLiu