skia2/tests
commit-bot@chromium.org 0251288112 Adding size parameter to read array functions
In some cases, the allocated array into which the data will be read is using getArrayCount() to allocate itself, which should be safe, but some cases use fixed length arrays or compute the array size before reading, which could overflow if the stream is compromised.

To prevent that from happening, I added a check that will verify that the number of bytes to read will not exceed the capacity of the input buffer argument passed to all the read...Array() functions.

I chose to use the byte array for this initial version, so that "size" represents the same value across all read...Array() functions, but I could also use the element count, if it is preferred.

Note : readPointArray and writePointArray are unused, so I could also remove them

BUG=
R=reed@google.com, mtklein@google.com, senorblanco@chromium.org

Author: sugoi@chromium.org

Review URL: https://codereview.chromium.org/37803002

git-svn-id: http://skia.googlecode.com/svn/trunk@12058 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-31 18:37:50 +00:00
..
TestXCode/Tests.xcodeproj migrate more legacy unittests into tests/ 2009-03-07 03:39:23 +00:00
AAClipTest.cpp Add an even more convenient way to declare tests, with example. 2013-09-19 20:56:46 +00:00
AndroidPaintTest.cpp We don't flatten or unflatten SkPaintOptionsAndroid. Reproduce and fix. 2013-09-26 15:16:12 +00:00
AnnotationTest.cpp PDF: add support for named destinations. 2013-03-08 09:09:10 +00:00
ARGBImageEncoderTest.cpp store SkAlphaType inside SkBitmap, on road to support unpremul 2013-10-21 14:00:07 +00:00
AtomicTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
BitmapCopyTest.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
BitmapFactoryTest.cpp "Fix" persistent failure of BitmapFactoryTest on debug RazrI 2013-03-21 20:54:42 +00:00
BitmapGetColorTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
BitmapHasherTest.cpp store SkAlphaType inside SkBitmap, on road to support unpremul 2013-10-21 14:00:07 +00:00
BitmapHeapTest.cpp In SkBitmapHeap, defer adding owners for new bitmaps. 2012-11-16 20:34:37 +00:00
BitSetTest.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
BlitRowTest.cpp More clang warning fixes. 2013-10-21 16:41:00 +00:00
BlurTest.cpp Fix leak in BlurTest 2013-10-11 14:38:46 +00:00
CachedDecodingPixelRefTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-30 07:01:56 +00:00
CanvasStateTest.cpp fix printing of error messages in canvasstatetest. 2013-09-18 20:15:12 +00:00
CanvasTest.cpp More clang warning fixes. 2013-10-21 16:41:00 +00:00
ChecksumTest.cpp Add SkChecksum::Murmur3. 2013-07-23 20:25:34 +00:00
ClampRangeTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ClipCacheTest.cpp Don't reuse scratch textures patch 2013-10-29 14:06:15 +00:00
ClipCubicTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
ClipperTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
ClipStackTest.cpp More clang warning fixes. 2013-10-21 16:41:00 +00:00
ColorFilterTest.cpp force readbuffer clients to use specialized readFoo for flattenables 2013-10-16 13:05:06 +00:00
ColorTest.cpp More clang warning fixes. 2013-10-21 16:41:00 +00:00
DataRefTest.cpp Remove SkDataTable from SkFlattenable hierarchy. 2013-10-15 20:39:57 +00:00
DeferredCanvasTest.cpp store SkAlphaType inside SkBitmap, on road to support unpremul 2013-10-21 14:00:07 +00:00
DequeTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
DeviceLooperTest.cpp Fix Mac 10.6 DeviceLooperTest build error (this time with feeling) 2013-09-18 12:51:50 +00:00
DocumentTest.cpp Fix a test warning on some linux machines 2013-10-22 18:33:21 +00:00
DrawBitmapRectTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-16 07:02:24 +00:00
DrawPathTest.cpp promote SkImage::AlphaType to SkAlphaType 2013-09-20 19:33:52 +00:00
DrawTextTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
DynamicHashTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
EmptyPathTest.cpp Refactor: clean up some unused or mostly-unused API I saw here. 2013-06-18 20:50:34 +00:00
ErrorTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-20 07:01:33 +00:00
FillPathTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
FitsInTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
FlatDataTest.cpp use SkTDynamicHash in picture recording 2013-08-20 16:48:47 +00:00
FlateTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
FontHostStreamTest.cpp Check whether font creation is failed to avoid segment fault. 2013-05-07 14:32:58 +00:00
FontHostTest.cpp onCharsToGlyphs to handle non-bmp on Mac. 2013-10-25 17:49:08 +00:00
FontMgrTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-09-20 07:01:33 +00:00
FontNamesTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
FrontBufferedStreamTest.cpp Add a buffered SkStream class. 2013-09-26 21:35:39 +00:00
GeometryTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
GifTest.cpp GIF decode: optional error messages and fault tolerance. 2013-10-11 18:21:56 +00:00
GLInterfaceValidation.cpp Simplify the GL interface validation test. 2013-03-11 20:22:38 +00:00
GLProgramsTest.cpp Implement SkColorFilter as a GrGLEffect 2013-10-23 05:42:03 +00:00
GpuBitmapCopyTest.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
GpuColorFilterTest.cpp Implement SkColorFilter as a GrGLEffect 2013-10-23 05:42:03 +00:00
GpuDrawPathTest.cpp Temporarily disable GpuTestPath. 2013-08-05 14:50:31 +00:00
GradientTest.cpp Split SkDevice into SkBaseDevice and SkBitmapDevice 2013-08-29 11:54:56 +00:00
GrContextFactoryTest.cpp Add --threads to tests binary, to run non-GPU tests on multiple cores. 2013-04-19 13:24:28 +00:00
GrMemoryPoolTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
GrSurfaceTest.cpp Reland of 8525 with fix for case when GrRT outlives GrTexture. 2013-04-09 15:04:12 +00:00
HashCacheTest.cpp Clean up the GrTHashTable API. 2013-10-27 20:50:23 +00:00
ImageCacheTest.cpp SkTDynamicHash 2013-08-12 14:51:25 +00:00
ImageDecodingTest.cpp Implement charToGlyph on remaining ports. 2013-10-24 21:39:35 +00:00
ImageFilterTest.cpp Remove support for SK_CROP_RECT_IS_INT, now that it is no longer used in Blink or Chrome. 2013-10-16 15:46:00 +00:00
InfRectTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
JpegTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
LayerDrawLooperTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
LListTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
MathTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
Matrix44Test.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
MatrixTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
MD5Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-31 20:28:24 +00:00
MemoryTest.cpp Add sk_calloc. Remove SkMemory_stdlib, which seems unused. 2013-09-20 14:31:45 +00:00
MemsetTest.cpp combine glyph and image bulk alloc, and adjust initial alloc size, to reduce total waste from 50% to 30% 2013-06-19 19:25:36 +00:00
MessageBusTest.cpp We want to give SkPixelRef a way to signal over to GrResourceCache that it's become pointless to keep around textures based on that SkPixelRef when its pixels change, so that it can be a good citizen and free those textures. 2013-10-24 17:44:27 +00:00
MetaDataTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
MipMapTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
OnceTest.cpp SK_ONCE for SkData and SkPathRef 2013-10-23 14:44:08 +00:00
OSPathTest.cpp Fix bug in setting directories for tests. 2013-06-06 14:59:56 +00:00
PackBitsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
PaintTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ParsePathTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
PathCoverageTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
PathMeasureTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
PathOpsAngleTest.cpp More clang warning fixes. 2013-10-21 16:41:00 +00:00
PathOpsBoundsTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsCubicIntersectionTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsCubicIntersectionTestData.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsCubicIntersectionTestData.h Make parallel unit testing work on windows 2013-04-10 15:55:37 +00:00
PathOpsCubicLineIntersectionTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsCubicQuadIntersectionTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsCubicReduceOrderTest.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsCubicToQuadsTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDCubicTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDLineTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsDPointTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDQuadTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDRectTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDTriangleTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsDVectorTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsExtendedTest.cpp Sadly TSAN still reports this as a race, even when we're obviously writing the 2013-10-02 16:15:44 +00:00
PathOpsExtendedTest.h harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsInverseTest.cpp path ops : add support for inverse fill 2013-04-22 14:37:05 +00:00
PathOpsLineIntersectionTest.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsLineParametetersTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpCubicThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpRectThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsOpTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsQuadIntersectionTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsQuadIntersectionTestData.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsQuadIntersectionTestData.h Add intersections for path ops 2013-04-08 11:50:00 +00:00
PathOpsQuadLineIntersectionTest.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsQuadLineIntersectionThreadedTest.cpp turn off debugging printfs 2013-07-23 15:27:41 +00:00
PathOpsQuadParameterizationTest.cpp path ops work in progress 2013-04-15 19:13:59 +00:00
PathOpsQuadReduceOrderTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
PathOpsSimplifyDegenerateThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyFailTest.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsSimplifyQuadralateralsThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyQuadThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyRectThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSimplifyTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsSimplifyTrianglesThreadedTest.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsSkpClipTest.cpp path ops work in progress 2013-10-02 14:49:34 +00:00
PathOpsSkpTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-10-03 07:01:37 +00:00
PathOpsTestCommon.cpp Sanitizing source files in Housekeeper-Nightly 2013-07-17 07:01:13 +00:00
PathOpsTestCommon.h harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
PathOpsThreadedCommon.cpp path ops work in progress 2013-09-16 15:55:01 +00:00
PathOpsThreadedCommon.h path ops work in progress 2013-10-02 14:49:34 +00:00
PathTest.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
PathUtilsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
PDFPrimitivesTest.cpp Use SkPicture::ExtractBitmap callback in pdf too, there is no need for a specialized function pointer for pdf only only to pass a rectangle, when we can use subseted bitmaps. 2013-10-03 19:29:21 +00:00
PictureTest.cpp Expose SkPicture::willPlayBackBitmaps() 2013-10-24 11:12:47 +00:00
PictureUtilsTest.cpp Updated make_filepath test to reflect changes in picture_utils. TBR 2012-07-13 18:43:39 +00:00
PipeTest.cpp Defining new color constat for transparent color 2012-12-06 21:47:40 +00:00
PixelRefTest.cpp We want to give SkPixelRef a way to signal over to GrResourceCache that it's become pointless to keep around textures based on that SkPixelRef when its pixels change, so that it can be a good citizen and free those textures. 2013-10-24 17:44:27 +00:00
PointTest.cpp by hook or by crook, force gcc to return the value of SkPoint::length() to actually be a float 2013-05-06 15:59:51 +00:00
PremulAlphaRoundTripTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
QuickRejectTest.cpp Added toString to SkDrawLooper-derived classes 2013-01-28 20:21:59 +00:00
RandomTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
Reader32Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
ReadPixelsTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
ReadWriteAlphaTest.cpp Remove GrRefCnt.h in favor of SkRefCnt.h 2013-09-09 13:38:37 +00:00
RefCntTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
RefDictTest.cpp Extended Inst counting to find "unknown" leaked object (SkTMaskGamma) 2012-08-16 14:58:06 +00:00
RegionTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ResourceCacheTest.cpp Sanitizing source files in Housekeeper-Nightly 2013-08-09 07:01:22 +00:00
RoundRectTest.cpp remove contains(x,y) for rects and rrects ... not well defined, and unused 2013-10-30 17:39:43 +00:00
RTreeTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
ScalarTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SerializationTest.cpp Adding size parameter to read array functions 2013-10-31 18:37:50 +00:00
SHA1Test.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-31 20:28:24 +00:00
ShaderImageFilterTest.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
ShaderOpacityTest.cpp store SkAlphaType inside SkBitmap, on road to support unpremul 2013-10-21 14:00:07 +00:00
Sk64Test.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
skia_test.cpp tests: Provide a default resources path. 2013-10-29 19:50:39 +00:00
SortTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
SrcOverTest.cpp Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
StreamTest.cpp Add a detachAsStream to SkDynamicMemoryWStream. 2013-07-19 22:32:11 +00:00
StringTest.cpp Clean up SkTypes.h. 2013-10-11 18:50:45 +00:00
StrokeTest.cpp Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
SurfaceTest.cpp Fix valgrind uninitialized memory complaint 2013-10-09 12:51:09 +00:00
Test.cpp harden and speed up path op unit tests 2013-07-16 16:11:16 +00:00
Test.h Rewrite SkTRegistry to take any trivially-copyable type. 2013-09-04 17:20:18 +00:00
TestClassDef.h Add an even more convenient way to declare tests, with example. 2013-09-19 20:56:46 +00:00
TestSize.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
TileGridTest.cpp Revert "If the path is a rect, call drawRect to raster the geometry in SkCanvas::drawPath to get better performance." 2013-10-22 16:54:15 +00:00
TLSTest.cpp Tests : Unused parameters cleanup 2013-02-27 19:17:41 +00:00
ToUnicode.cpp pdf: write only ToUnicode mappings needed by the font, trimming anything out of [firstChar, lastChar] interval. 2013-09-18 19:29:08 +00:00
TSetTest.cpp Deterministic SkTSet and PDF Output 2013-07-24 01:51:08 +00:00
Typeface.cpp Update Android's FontHost to return NULL if familyName does not match 2013-09-19 12:08:40 +00:00
UnicodeTest.cpp Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/) 2012-08-23 18:14:13 +00:00
UnitTestTest.cpp Fix crash when querying a runtime config that is defined in environment 2013-08-14 18:14:37 +00:00
UtilsTest.cpp Change old PRG to be SkLCGRandom; change new one to SkRandom 2013-09-09 20:09:12 +00:00
valgrind.supp Add valgrind suppressions for driver bugs 2013-10-11 18:28:18 +00:00
WArrayTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
WritePixelsTest.cpp Remove unnamed namespace usage from tests. 2013-10-12 17:25:17 +00:00
Writer32Test.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00
XfermodeTest.cpp Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"" 2013-10-31 17:28:30 +00:00