DescriptionAdding 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=
Committed: http://code.google.com/p/skia/source/detail?r=12058
Patch Set 1 #
Total comments: 2
Patch Set 2 : Added dox in SkFlattenableBuffers.h #
Total comments: 2
Patch Set 3 : Added a better description for read...Array() functions #Patch Set 4 : Bad upload, retrying #
Total comments: 6
Patch Set 5 : Fixed comments and added test #
Total comments: 2
Patch Set 6 : Fixed comments #Patch Set 7 : More uint32_t to size_t changes #
Total comments: 1
Patch Set 8 : Sending read cursor to the end on error #Patch Set 9 : Cleanup #
Total comments: 12
Patch Set 10 : Fixed comments #
Total comments: 5
Messages
Total messages: 28 (0 generated)
|