Harden MakeFromBuffer with respect to the array length value.
* Check that the array count is not too large.
Change-Id: I5b398be1690fafce5be5b90ba8aa7af0f12be317
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507637
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Bug: skia:12845
Change-Id: I8013b0068ab758e9a5e580344c62e4680f4fa48e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506176
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12643
Change-Id: Id5eecb3445082e747def8c87f99a16552857af3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506462
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:12754
Change-Id: Ib4f1a9ac4ef16805cf8ca4e4c0eea0b3922ca28a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506465
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
These all stemmed from the same root cause, but are interesting and
distinct enough to include in our error tests.
Bug: oss-fuzz:44555, oss-fuzz:44557, oss-fuzz:44559, oss-fuzz:44561, oss-fuzz:44565
Change-Id: I22c1798809754b4b38c77ffbe369a97c64a2f60e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507636
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The fuzzer constructs a long, valid nonsense expression
(x+x+x-x+x-x, etc.) which exceeds parse depth. At that point, the token
stream points to a `+` token. The parser attempts to consume a new
statement but stops in `unaryExpression`; this fails again, due to the
max parse-depth, but doesn't consume a token. The parser continues
trying to parse the statement, but stopping in `unaryExpression`, making
no forward progress in an infinite loop.
I've made a couple of changes as a result.
- Exceeding the max parse depth now sets `fEncounteredFatalError`.
- Encountering a fatal error causes block() to immediately halt. This
actually undoes a few of the arbitrary changes from
http://review.skia.org/506463 but not in a bad way.
- `unaryExpression()` now consumes a token before checking parse-depth.
- `structDeclaration()` had a similar issue where it could potentially
fail without consuming any tokens; this is fixed as well.
- Some unnecessarily-nested logic in ternaryExpression() was flattened
while I tried to ensure that it always consumes a token.
Change-Id: I52c2161965ffbcef1185761ca6897ec1cba5df89
Bug: oss-fuzz:44551
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507436
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Serialize all the glyphID information for the different
sub runs.
Bug: chromium:1278340
Change-Id: I04387ffadcf5cb20fbaca17a02d7ca1faf883806
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507318
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Build with
./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
or
./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Adds wangs_formula::quadratic_pow4, cubic_pow4, conic_pow2 overloads
that operate on float2 directly instead of having to load data from
SkPoints. This means that the fixed count tessellators now only load
their control points into float2s once (when creating a patch geometry)
and then evaluate Wang's formula on those points, vs. both patch
geometry and Wang's formula evaluation requiring reading from the
SkPoint[] data. Not sure how likely a compiler is to have automatically
reduced that work.
Change-Id: I18eeb3e81a7e4b38f3fdfe4cc652a468415857a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502058
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit dec95f24e1.
Reason for revert: broke viewer build
The original CL was landed to keep upstream Skia the source of
truth when the changes were proposed directly in G3 in cl/414839941.
Original change's description:
> Migrate compat v4 classes to androidx
>
> Change-Id: I9dd1d4cbaaf0dc5c4dc8a7bd9155ae6334ab24af
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480396
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: I660ba61a3a777e18154c52e8eda63937be4d7b4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507184
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This to match the naming convention for skgpu::Device and the future
skgpu::Image.
Change-Id: Ide0448633f14cfcba583a24eaaceb24da8a58e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507317
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Change-Id: I9c985a8c68efea0b24a51e87fa09569d927ae0c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506897
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This command is redundant now that we have kBuiltin_Symbol.
Change-Id: Ia41d80b6601bd47e9ec9a14777adf7e1c71fb610
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507316
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Extricate GlyphVector to test serialization which will be added to
it in the future.
Change-Id: I2baa01d92394b3f9af6fe4c3e14341ed453d572f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506885
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I4a37da74f9fc351cf62e9c028c38ac1f3f8c963a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506883
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This allows recorded pictures finished as drawables to be used for glyph
drawing.
Change-Id: I717626eda2bf4e1659c8941c3217cb61c1a16cf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506882
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This is a reland of 3225c8cc46
Original change's description:
> Add kR8_unorm_SkColorType
>
> Change-Id: I97b5bc7f90715664f233ca7b7c41c0ecbfc29ac4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505679
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I73fa17625d57e0e58da1b70e2e59ba200383cfe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506460
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
...based on conversation with jvanverth@ on 2022-02-04 in Skia GChat.
Change-Id: I463737e33e87f2052326f6231781a801ad5c320c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506877
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Erik Rose <erikrose@google.com>
Bug: skia:12643
Change-Id: I285d42c908c75532b78c9b80da7b6145e1b47fe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506458
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
isinf() exists in GLSL 1.3 and above, but hardware without proper IEEE
support is allowed to always return false, so it's potentially
meaningless. In GLSL 3.3 and GLSL ES3+, isinf() is required to actually
identify infinite values. (GPUs are not required to _produce_ infinite
values via operations like `num / 0.0` until GLSL 4.1.)
Change-Id: I6d8cd70f47f653402d9eb2a0aed0773e54cfa61b
Bug: skia:12716
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506878
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Christopher Dalton <csmartdalton@google.com>
Change-Id: I5147bea5b113d41e1d47fabca51dfbbc961fa70f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506836
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously, REPORTER_ASSERT/ERRORF relied on a helper function named
`reporter_string` which papered over zero-argument and one-argument
messages (where one-argument messages are assumed to ignore printf
formatting rules entirely, and just forward the message as-is).
Replacing this helper with a direct call to `SkStringPrintf` allows
the compiler to check format arguments for correctness, but sacrifices
the one-argument special case. In practice the one-argument special
case was very rarely used, so it's not a significant sacrifice,
and this did uncover several real errors in assertion format strings
(including some cases where the wrong number of arguments was passed).
Change-Id: I4378c43b16fd8fdbf4c78d849a9f2f0a254f7abc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506617
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Check that the required number of bytes exist for the length
given in the header.
Bug: oss-fuzz:44541
Change-Id: I6f0896fa50a032f97d3981b5f17cf99ef23144b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506779
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This enables the SkSL error testing logic for runtime effects. The core
logic is identical, only the ProgramKind differs.
(Error creation scripts: http://go/paste/6413797460803584 with some
light post-processing)
Change-Id: I877205b3cc1014b50ccccf6037a2f4034c07543e
Bug: skia:12665
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506538
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, when the parser found a bad statement inside a Block, it
would stop processing that Block entirely. This caused our brace
matching to fall out of balance. block() would normally only return once
the Block's closing brace was consumed, but in this case, the closing
brace would still be in the parse stream awaiting consumption even
though block() had returned.
Now, when a bad statement is found inside a Block, we just ignore it and
continue processing. (I tried injecting a poisoned statement as well,
to see if it would affect the test results, but they were identical.)
This seems to generate somewhat better errors.
Change-Id: I8dc781d5602bf99d7610f8280cde8b7c1925cb65
Bug: skia:12868
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506463
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
To avoid ambiguity, the constructor only takes an SkString now instead
of accepting variadic arguments. This functionality was only used in one
place, so this doesn't affect the code in any meaningful way.
Change-Id: I33d2e880e3e1430cea80ca47270dd823221e5a2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506618
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
-Wformat-nonliteral does not work with variadic templates, and requires
a constant format string.
These changes uncovered one incorrect format string (%u -> %lu for a
DWORD in dm.cpp)
Change-Id: Id54a5d6cbcb607ff32c758f4a9d346a7aba70df3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506616
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:12701
Change-Id: I743e4717f3716717bd35e1eea0f504a1f9ac6dc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506536
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Namely:
we were always uploading uniforms to the front of the uniform buffer
the gradient colors are stored as float4s - not half4s
Bug: skia:12701
Change-Id: Ic7a669566454d2c00b499cabf8f659ba08b0cedc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506159
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
In the recently introduced FontConfigInterface_MatchStyleNamedInstance
test the highBitsExpectation vector was one bool too short. Because this
was a std::vector<bool> AddressSanitizer because as silent because all
the bits fit in one underlying storage unit. It isn't clear why
MemorySanitizer did not seem to catch this. In any event,
highBitsExpectation[6] was effectively a random causing the test to fail
about half the time.
Restructure these parallel arrays into a Test struct so that the
expectations are obvious and line up. Also make everything constexpr.
Bug: skia:12916
Change-Id: Iaaabb7aef5e041b551a9e2302f954c64509427f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506160
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Thoroughly exercise the new descriptor de-serializer.
Change-Id: If8208ec5b0f0a8e0db250d2cd723b6970c5f4ff2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506464
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Bug: skia:12643
Change-Id: I37e1718a20283dfb814c85260257d57bac2b7b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506211
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Takes the given texture data and destination rectangle, copies it into
a buffer, and stores the destination textureProxy, buffer, and
associated BufferTextureCopyData into an UploadCommand.
Bug: skia:12845
Change-Id: Icba8b9e56ac0d79083c54fe529bd7e35ddb6e23d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505798
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
PS 1 is re-generating existing BUILD.bazel files
PS 2 is generating BUILD.bazel files for tests/gms
PS 3+ makes modifications to build all of the gms and tests.
It is recommended to view this CL with just a diff between
PS 2 and the end, due to the large amount of generated changes
in PS 1 and 2.
We make a filegroup for the gms and tests because they need
to be compiled as one large blob in order for the registries
to work. Maybe in the future we will break these up, but at least
for WASM/JS, the overhead of starting a browser for each new
test would likely grind things to a halt, so we just group them
all together for now. It's also the most similar to what we
currently do.
In gm/BUILD.bazel and tests/BUILD.bazel, we add a cc_library
that encapsulates all of the deps of the tests, so we can
easily include that the build. These were discovered via
trial and error, not anything automatic or systematic.
The is_skia_dev_build config_setting is very similar to the
GN equivalent from which it was based.
The list of gms and tests to skip (e.g. which are incompatible
with WASM) was determined by building the wasm bundle:
modules/canvaskit$ make bazel_gms_release
tools/run-wasm-gm-tests$ make run_local_debug
# Don't forget to click the button on the screen after the
# browser loads
This way of invoking the tests will be replace soon with
`bazel test <something>`. As such, I didn't bother fully
documenting the current way.
Suggested review order:
- modules/canvaskit/BUILD.bazel taking note that we always
use profiling-funcs to make the stacktraces human readable.
- gm/BUILD.bazel and tests/BUILD.bazel to see the lists of
gms/tests. Notice the tests are roughly partitioned because
we don't support things like vulkan/PDF in the wasm build
and we will want a way to not build certain tests for
certain configurations
- tools/* noting some of the cc_libraries added to make
dependencies easier to add when needed.
- All other files.
Change-Id: I43059cd93c28af1c4c12b93d6ebd9c46a12d381f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>