tweak Descriptor_invalid_rec_size to not over-copy

When we pretend the SkScalerContextRec is 4 bytes bigger than it is, we
copy 4 bytes more than we should, and that's freaking out the ASAN bots.

Let's just say it's a little small.  Still wrong, no stack overflow.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-ASAN
Change-Id: I03b292b9751289782cc0afcb860ca9196130985a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200557
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Adrienne Walker <enne@chromium.org>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Adrienne Walker <enne@chromium.org>
This commit is contained in:
Mike Klein 2019-03-12 17:40:46 -05:00 committed by Skia Commit-Bot
parent b070bc9947
commit 73b0df10f7

View File

@ -74,12 +74,12 @@ DEF_TEST(Descriptor_valid_more_tags, r) {
DEF_TEST(Descriptor_invalid_rec_size, r) {
const size_t size =
sizeof(SkDescriptor) + sizeof(SkDescriptor::Entry) + sizeof(SkScalerContextRec) + 4;
sizeof(SkDescriptor) + sizeof(SkDescriptor::Entry) + sizeof(SkScalerContextRec) - 4;
auto desc = SkDescriptor::Alloc(size);
desc->init();
SkScalerContextRec rec;
desc->addEntry(kRec_SkDescriptorTag, sizeof(rec) + 4, &rec);
desc->addEntry(kRec_SkDescriptorTag, sizeof(rec) - 4, &rec);
REPORTER_ASSERT(r, desc->getLength() == size);
REPORTER_ASSERT(r, !desc->isValid());
}