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

Unified Diff: samplecode/SampleRegion.cpp

Issue 41253002: Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adding validation before memory allocation in SkRegion::readFromMemory Created 7 years, 1 month 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
Index: samplecode/SampleRegion.cpp
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 1bd316233f9fb84941744dac695d85e981ab34ae..39c27a89281060a4c502b5f5d60104447734410f 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -280,7 +280,7 @@ protected:
SkASSERT(size == size2);
SkRegion tmp3;
- SkDEBUGCODE(size2 = ) tmp3.readFromMemory(buffer);
+ SkDEBUGCODE(size2 = ) tmp3.readFromMemory(buffer, 1000);
SkASSERT(size == size2);
SkASSERT(tmp3 == tmp);
« no previous file with comments | « include/core/SkRegion.h ('k') | src/core/SkBuffer.h » ('j') | tests/SerializationTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698