Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: testing/libfuzzer/xfa_codec_fuzzer.h

Issue 2386343002: Make sure the fuzzer read size does not go negative. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/xfa_codec_fuzzer.h
diff --git a/testing/libfuzzer/xfa_codec_fuzzer.h b/testing/libfuzzer/xfa_codec_fuzzer.h
index 6a84ed85725939eb030880f2652dc739dcd085f2..63991c555f690dc57940790f39f765d42380384f 100644
--- a/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -49,8 +49,11 @@ class XFACodecFuzzer {
void Release() override {}
FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
+ if (offset <= 0 || offset >= m_size)
Lei Zhang 2016/10/04 19:13:15 No, 0 is a valid offset.
dsinclair 2016/10/04 19:15:29 Bugger, mis-read your previous comment.
+ return FALSE;
if (offset + size > m_size)
size = m_size - offset;
+
memcpy(buffer, m_data + offset, size);
return TRUE;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698