/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <stdlib.h>
#include "../includes/common.h"
#include "minikin/LayoutUtils.h"

using namespace minikin;

int main() {
    // This PoC reuses the testcase provided in the GTest "BidiCtrl"
    // of LayoutSplitterTest.cpp
    const uint16_t testCase[] = {0x2066, 0x2069, 0x202A, 0x202E, 0x200E, 0x200F};
    size_t offset = 0;
    size_t len = sizeof(testCase) / sizeof(uint16_t);
    return (getNextWordBreakForCache(U16StringPiece(testCase, len), offset) == len)
               ? EXIT_VULNERABLE
               : EXIT_SUCCESS;
}
