aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkValidatingReadBuffer.h
Commit message (Collapse)AuthorAge
* upgrade SkReadBuffer to always validateGravatar Mike Reed2017-12-06
| | | | | | | | Bug: skia: Change-Id: I054560b66c6cde346d939015326d8547879d2c4b Reviewed-on: https://skia-review.googlesource.com/81160 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* Remove SkReadBuffer::validateAvailableGravatar Leon Scroggins III2017-10-02
| | | | | | | | | | | | Follow on to 4cdbf6056de29e8c12c3b1b4c2c2fa286cf68049. readByteArray was the only caller of this method, and no longer uses it. So remove it and its only override. Bug: 769134 Change-Id: I0aaf97717baba1f0195162f3e644708bc101eba4 Reviewed-on: https://skia-review.googlesource.com/53920 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* Add serialization support for drawShadowRecGravatar Jim Van Verth2017-05-22
| | | | | | | Change-Id: Ic7f76681a037d8f53a6fdc25061c39559f5c3e30 Reviewed-on: https://skia-review.googlesource.com/17457 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Add SkColor4f serializationGravatar brianosman2016-09-25
| | | | | | | | | | Adjusted usage in color shader, and will also be using this in gradients, soon. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2334123003 Review-Url: https://codereview.chromium.org/2334123003
* change readTypeface to return sk_spGravatar reed2016-08-29
| | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2290653002 TBR=mtklein Review-Url: https://codereview.chromium.org/2290653002
* Remove SkBitmapHeap and SkBitmapHeapReader. They're unused.Gravatar brianosman2016-05-03
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1938033002 Review-Url: https://codereview.chromium.org/1938033002
* Remove (almost) unused read/writeFunctionPtr API.Gravatar brianosman2016-05-02
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1937053002 Review-Url: https://codereview.chromium.org/1937053002
* Remove unused encodedString API on SkWriteBuffer/SkReadBufferGravatar brianosman2016-05-02
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1936103002 Review-Url: https://codereview.chromium.org/1936103002
* Enable flattening/unflattening with custom unflatten procsGravatar msarett2016-04-22
| | | | | | | | | | | | | | | | | | Now flattenables are serialized using a string name, so that flattenables do not necessarily need to be registered before serialization. They just need to override getTypeName(). Allows custom unflatten procs to be set on the SkReadBuffer. This is optional if the flattenable is registered, but otherwise must be called. This was split off from: https://codereview.chromium.org/1837913003/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1858323002 Review URL: https://codereview.chromium.org/1858323002
* Optionally enable SkValidatingReadBuffer in SkPictureImageFilterGravatar robertphillips2016-04-22
| | | | | | | | | | The task here is to get the type of ReadBuffer being used in SkPicture::MakeFromBuffer mirrored in the down-stack SkPicturePlayback::draw call. BUG=skia:5208 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1918433002 Review URL: https://codereview.chromium.org/1918433002
* Fix ImageFilter fuzzer issueGravatar robertphillips2016-04-20
| | | | | | | | | What appears to be happening in this fuzz is that a paint index inside the picture of an SkPictureImageFilter is getting changed to be out of range. BUG=skia:5192 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1893423002 Review URL: https://codereview.chromium.org/1893423002
* Reverse dependency between SkScalar.h and SkFixed.h.Gravatar benjaminwagner2016-04-07
| | | | | | | | | | | | | | | The following are unused in Chromium, Android, Mozilla, and Google3: - SkFixedToScalar - SkScalarToFixed The following are additionally unused in Skia: - SkStrAppendFixed - SkWriteBuffer::writeFixed BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1841123002 Review URL: https://codereview.chromium.org/1841123002
* Revert of Delete SkFlattenable::Type (patchset #2 id:20001 of ↵Gravatar mtklein2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1834303003/ ) Reason for revert: Used by Chrome. c:\b\build\slave\workdir\build\src\cc\playback\compositing_display_item.cc(53): error C2039: 'GetFlattenableType': is not a member of 'SkColorFilter' c:\b\build\slave\workdir\build\src\third_party\skia\include\core\skshader.h(19): note: see declaration of 'SkColorFilter' c:\b\build\slave\workdir\build\src\cc\playback\compositing_display_item.cc(53): error C3861: 'GetFlattenableType': identifier not found Original issue's description: > Delete SkFlattenable::Type > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1834303003 > > Committed: https://skia.googlesource.com/skia/+/99d9231f6a4cb6b85b8637e9d8ae32f8bd7c466f TBR=reed@google.com,msarett@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1853383002
* Delete SkFlattenable::TypeGravatar msarett2016-04-04
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1834303003 Review URL: https://codereview.chromium.org/1834303003
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* SkCanvas::drawPatch param SkPoint[12]Gravatar dandov2014-08-12
| | | | | | | | | | | | | | | | | | drawPatch now receives as parameter const SkPoint cubics[12] Adjusted derived classes and serialization. Ajusted GM's and benches that take into account combinations of optional parameters, the scale of the patch and 4 different types of patches. Planning on adding the extra functionality of SkPatch in another CL. BUG=skia: R=egdaniel@google.com, reed@google.com Author: dandov@google.com Review URL: https://codereview.chromium.org/463493002
* Stopped skipping tests in dm of SkPatch by implementing theGravatar dandov2014-08-07
| | | | | | | | | | | corresponding drawPath calls on classes that derive from SkCanvas. BUG=skia: R=egdaniel@google.com, bsalomon@google.com, mtklein@google.com, robertphillips@google.com Author: dandov@google.com Review URL: https://codereview.chromium.org/429343004
* Fixing another clusterfuzz issueGravatar sugoi2014-06-06
| | | | | | | | | | | | | | | This was introduced by removing SkValidatingReadBuffer::readBitmap in https://codereview.chromium.org/295793002/ Since SkReadBuffer::skip wasn't virtual, it was using the unsafe SkReadBuffer::skip within SkReadBuffer::readBitmap rather than using SkValidatingReadBuffer::skip. I also removed direct uses of fReader within SkReadBuffer::readBitmap so that it can use the virtual readInt / readFixed functions that have a version in SkValidatingReadBuffer. Also, I changed SkReadBuffer::readPoint so that it uses the virtual readScalar, that way, it becomes redundant with SkValidatingReadBuffer::readPoint, which can then be removed. BUG=380723 R=reed@google.com, mtklein@google.com, sugoi@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/317003003
* stop calling SkBitmap::flattenGravatar commit-bot@chromium.org2014-05-23
| | | | | | | | | | | BUG=skia: R=scroggo@google.com, halcanary@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/295793002 git-svn-id: http://skia.googlecode.com/svn/trunk@14867 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove unused (by clients) SkUnitMapperGravatar commit-bot@chromium.org2014-05-22
| | | | | | | | | | | | This reverts commit 874423a81b5bc2541c7397e6ab00d5e7c9fdaf98. TBR=scroggo Author: reed@google.com Review URL: https://codereview.chromium.org/288313009 git-svn-id: http://skia.googlecode.com/svn/trunk@14842 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Remove unused (by clients) SkUnitMapper ↵Gravatar commit-bot@chromium.org2014-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/283273002/) (https://codereview.chromium.org/288343009/) Reason for revert: required blink change failed to land Original issue's description: > Remove unused (by clients) SkUnitMapper (https://codereview.chromium.org/283273002/) > > This reverts commit dd50c83b5b34dab3a077741861b50ed1f2bc6b8f. > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=14830 R=scroggo@google.com, reed@google.com TBR=reed@google.com, scroggo@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: reed@chromium.org Review URL: https://codereview.chromium.org/296823008 git-svn-id: http://skia.googlecode.com/svn/trunk@14838 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove unused (by clients) SkUnitMapper ↵Gravatar commit-bot@chromium.org2014-05-21
| | | | | | | | | | | | | | | (https://codereview.chromium.org/283273002/) This reverts commit dd50c83b5b34dab3a077741861b50ed1f2bc6b8f. BUG=skia: R=scroggo@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/288343009 git-svn-id: http://skia.googlecode.com/svn/trunk@14830 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of remove unused (by clients) SkUnitMapper ↵Gravatar commit-bot@chromium.org2014-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/283273002/) Reason for revert: does not address all legacy callsites in chrome. e.g. [13:45:32.091872] ../../ui/native_theme/native_theme_base.cc:608:76: error: no matching function for call to ‘SkGradientShader::CreateLinear(SkPoint [3], SkColor [3], NULL, int, SkShader::TileMode, NULL)’ [13:45:32.091919] gradient_bounds, colors, NULL, 3, SkShader::kClamp_TileMode, NULL)); Original issue's description: > remove unused (by clients) SkUnitMapper > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=14761 R=robertphillips@google.com, scroggo@google.com, george@mozilla.com TBR=george@mozilla.com, robertphillips@google.com, scroggo@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: reed@google.com Review URL: https://codereview.chromium.org/287063009 git-svn-id: http://skia.googlecode.com/svn/trunk@14763 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove unused (by clients) SkUnitMapperGravatar commit-bot@chromium.org2014-05-16
| | | | | | | | | | | BUG=skia: R=robertphillips@google.com, scroggo@google.com, george@mozilla.com Author: reed@google.com Review URL: https://codereview.chromium.org/283273002 git-svn-id: http://skia.googlecode.com/svn/trunk@14761 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixing SkPicture serializationGravatar commit-bot@chromium.org2014-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a few issues while attempting to use the new serialization path for SkPicture inside a fuzzer: - SkReadBuffer and SkValidatingReadBuffer both had a fReader member instead of sharing the same member, which leads to problems if a base class function is used - In SkPicture, a header is now written as a single chunk of data, so it also has to be read as a single chunk of data - In the SkPicturePlayback destructor, a bad deserialization would lead to a crash if we don't safely unref fOpData - Also in SkPicturePlayback, if we only use a ReadBuffer for the whole deserialization, additional tags must be added to parseBufferTag() - SkValidatingReadBuffer::readBitmap() was broken, but this path wasn't usen't since the only use case for SkValidatingReadBuffer is currently image filters and bitmaps are unflattened as part of the deserialization of SkBitmapSource - SkPictureImageFilter was not deserializable. Added it to SkGlobalInitialization* - Added a test that exercises the SkPicture serialization / deserialization code BUG=skia: R=senorblanco@google.com, senorblanco@chromium.org, reed@google.com, robertphillips@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/195223003 git-svn-id: http://skia.googlecode.com/svn/trunk@13764 2bbb7eff-a529-9590-31e7-b0007b416f81
* Refactor read and write buffers.Gravatar commit-bot@chromium.org2014-01-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eliminates SkFlattenable{Read,Write}Buffer, promoting SkOrdered{Read,Write}Buffer a step each in the hierarchy. What used to be this: SkFlattenableWriteBuffer -> SkOrderedWriteBuffer SkFlattenableReadBuffer -> SkOrderedReadBuffer SkFlattenableReadBuffer -> SkValidatingReadBuffer is now SkWriteBuffer SkReadBuffer -> SkValidatingReadBuffer Benefits: - code is simpler, names are less wordy - the generic SkFlattenableFooBuffer code in SkPaint was incorrect; removed - write buffers are completely devirtualized, important for record speed This refactoring was mostly mechanical. You aren't going to find anything interesting in files with less than 10 lines changed. BUG=skia: R=reed@google.com, scroggo@google.com, djsollen@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/134163010 git-svn-id: http://skia.googlecode.com/svn/trunk@13245 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixed more fuzzer issuesGravatar commit-bot@chromium.org2013-12-17
| | | | | | | | | | | | | | | | - Added the "isAvailable" function to check how much bytes are remaining in the stream before doing potentially large mallocs. That way, we can signal a bad stream instead of crashing. - Added data validation in SkImageInfo.cpp - Added NULL pointer check in displacement - Modified the fuzzer for randomized bitmap types BUG=328934,329254 R=senorblanco@google.com, senorblanco@chromium.org, reed@google.com, sugoi@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/116773002 git-svn-id: http://skia.googlecode.com/svn/trunk@12723 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixed a few places where uninitialized memory could have been readGravatar commit-bot@chromium.org2013-12-06
| | | | | | | | | | | | | Also added early exit in SkImageFilter's constructor to avoid attempting to deserialize all inputs once a bad input has been found. This avoids hanging if a filter pretends to have 1 billion inputs when that's just an error on the number of inputs read by the filter. BUG=326206,326197,326229 R=senorblanco@chromium.org, senorblanco@google.com, reed@google.com, sugoi@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/106943002 git-svn-id: http://skia.googlecode.com/svn/trunk@12544 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adding error checks to SkRBufferGravatar commit-bot@chromium.org2013-11-08
| | | | | | | | | | | BUG= R=robertphillips@google.com, bsalomon@google.com, reed@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/61913002 git-svn-id: http://skia.googlecode.com/svn/trunk@12202 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adding size parameter to read array functionsGravatar commit-bot@chromium.org2013-10-31
| | | | | | | | | | | | | | | | | | | 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
* Initial error handling codeGravatar commit-bot@chromium.org2013-10-23
| | | | | | | | | | | | | | | | I made it as simple as possible. The impact seems minimal and it should do what's necessary to make this code secure. BUG= Committed: http://code.google.com/p/skia/source/detail?r=11247 R=reed@google.com, scroggo@google.com, djsollen@google.com, sugoi@google.com, bsalomon@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11922 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert 11247, 11250, 11251, 11257, and 11279 to unblock DEPS roll ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | | | | | | | | | (https://codereview.chromium.org/24159002/) 11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279 11257 Canary build fix - https://codereview.chromium.org/23532068 11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251 11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250 11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11288 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert the revert of 11247, 11250, 11251 and 11279 (Chrome already relies on ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | changes in r11247) git-svn-id: http://skia.googlecode.com/svn/trunk@11287 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert 11247, 11250, 11251 and 11279 to unblock DEPS roll ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | | | | | | | | (https://codereview.chromium.org/24159002/) 11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279 11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251 11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250 11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11285 2bbb7eff-a529-9590-31e7-b0007b416f81
* Initial error handling codeGravatar commit-bot@chromium.org2013-09-13
I made it as simple as possible. The impact seems minimal and it should do what's necessary to make this code secure. BUG= R=reed@google.com, scroggo@google.com, djsollen@google.com, sugoi@google.com, bsalomon@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org Author: sugoi@chromium.org Review URL: https://chromiumcodereview.appspot.com/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11247 2bbb7eff-a529-9590-31e7-b0007b416f81