skia2/fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp
Herb Derby 0f2390f7fb move SkRemoteGlyphCache.h to private
Chromium has been using the remote glyph cache for a few years now.
It's time to give it a proper home.

This is an intermediate CL. The old .h file includes the new .h file.
After I change the include paths in Chromium, I will delete the old
file.

Change-Id: Iaf00c46aa0698326c0bdec9a0eed218bcc3e334e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482700
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-10 20:20:56 +00:00

40 lines
909 B
C++

/*
* Copyright 2019 Google, LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "src/core/SkDescriptor.h"
void FuzzSkDescriptorDeserialize(sk_sp<SkData> bytes) {
SkAutoDescriptor aDesc;
bool ok = SkFuzzDeserializeSkDescriptor(bytes, &aDesc);
if (!ok) {
return;
}
auto desc = aDesc.getDesc();
desc->computeChecksum();
desc->isValid();
// An arbitrary number
uint32_t tagToFind = 117;
uint32_t ignore;
desc->findEntry(tagToFind, &ignore);
}
#if defined(SK_BUILD_FOR_LIBFUZZER)
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size > 1024) {
return 0;
}
auto bytes = SkData::MakeWithoutCopy(data, size);
FuzzSkDescriptorDeserialize(bytes);
return 0;
}
#endif