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

Unified Diff: testing/libfuzzer/xfa_codec_fuzzer.h

Issue 2386343002: Make sure the fuzzer read size does not go negative. (Closed)
Patch Set: 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..dea079b7111e4bb5c226d774d8738784bdb2b808 100644
--- a/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -51,6 +51,8 @@ class XFACodecFuzzer {
FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
if (offset + size > m_size)
size = m_size - offset;
+ if (offset > m_size)
Lei Zhang 2016/10/03 21:16:50 Shouldn't we check this first in the function? Sho
dsinclair 2016/10/04 13:11:07 Done.
+ return FALSE;
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