Commit 8cf6bde4 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

cc: Add more checks to reading PaintShaders

Previously it was possible to have non-record shaders have a record,
which is invalid.  If these get written back out again, they are not
valid and will DCHECK.  We should just prevent these in the first place.

Bug: 868674
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I3da083024fcd47c4577b2a59c9a3014da2097e50
Reviewed-on: https://chromium-review.googlesource.com/1159113Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579960}
parent a3ee93a7
......@@ -445,7 +445,15 @@ void PaintOpReader::Read(sk_sp<PaintShader>* shader) {
uint32_t shader_id = PaintShader::kInvalidRecordShaderId;
size_t shader_size = 0;
if (has_record) {
if (shader_type != PaintShader::Type::kPaintRecord) {
SetInvalid();
return;
}
Read(&shader_id);
if (shader_id == PaintShader::kInvalidRecordShaderId) {
SetInvalid();
return;
}
// Track dependent transfer cache entries to make cached shader size
// more realistic.
......@@ -492,12 +500,8 @@ void PaintOpReader::Read(sk_sp<PaintShader>* shader) {
return;
}
if (shader_id == PaintShader::kInvalidRecordShaderId) {
// Paint record shaders must have ids.
if (shader_type == PaintShader::Type::kPaintRecord) {
SetInvalid();
return;
}
// All shader types but records are done.
if (shader_type != PaintShader::Type::kPaintRecord) {
(*shader)->CreateSkShader();
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment