Change log:95336cb92b..191d55580eFull diff:95336cb92b..191d55580eRoll chromium third_party 4e16929f46..3a8f2a9e1e Change log:4e16929f46..3a8f2a9e1eChanged dependencies: * src/tools:c44a3f5eca..f524a53b81DEPS diff:95336cb92b..191d55580e/DEPS No update to Clang. TBR=titovartem@google.com, BUG=None CQ_INCLUDE_TRYBOTS=master.internal.tryserver.corp.webrtc:linux_internal Change-Id: Ic9c4a62b050383646e9fcf5cc07a5653c14ac06e Reviewed-on: https://webrtc-review.googlesource.com/76120 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23205}
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#include <hb.h>
|
|
#include <hb-ot.h>
|
|
|
|
// Entry point for LibFuzzer.
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
const char* dataPtr = reinterpret_cast<const char*>(data);
|
|
hb_blob_t* blob = hb_blob_create(dataPtr, size, HB_MEMORY_MODE_READONLY, NULL,
|
|
NULL);
|
|
hb_face_t* face = hb_face_create(blob, 0);
|
|
hb_font_t* font = hb_font_create(face);
|
|
hb_ot_font_set_funcs(font);
|
|
hb_font_set_scale(font, 12, 12);
|
|
|
|
{
|
|
const char text[] = "ABCDEXYZ123@_%&)*$!";
|
|
hb_buffer_t* buffer = hb_buffer_create();
|
|
hb_buffer_add_utf8(buffer, text, -1, 0, -1);
|
|
hb_buffer_guess_segment_properties(buffer);
|
|
hb_shape(font, buffer, NULL, 0);
|
|
hb_buffer_destroy(buffer);
|
|
}
|
|
|
|
uint32_t text32[16] = { 0 };
|
|
if (size > sizeof(text32)) {
|
|
memcpy(text32, data + size - sizeof(text32), sizeof(text32));
|
|
hb_buffer_t* buffer = hb_buffer_create();
|
|
size_t text32len = sizeof(text32) / sizeof(text32[0]);
|
|
hb_buffer_add_utf32(buffer, text32, text32len, 0, -1);
|
|
hb_buffer_guess_segment_properties(buffer);
|
|
hb_shape(font, buffer, NULL, 0);
|
|
hb_buffer_destroy(buffer);
|
|
}
|
|
|
|
hb_font_destroy(font);
|
|
hb_face_destroy(face);
|
|
hb_blob_destroy(blob);
|
|
return 0;
|
|
}
|