Skip to content

Commit

Permalink
OTS
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlstrom-g committed May 9, 2024
1 parent 79adf53 commit 3e9dbfa
Show file tree
Hide file tree
Showing 44 changed files with 1,040 additions and 676 deletions.
4 changes: 2 additions & 2 deletions third_party/ots/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/libfuzzer/fuzzer_test.gni")

config("ots_config") {
include_dirs = [ "src/include" ]
defines = [ "HAVE_CONFIG_H" ]
}

static_library("ots") {
Expand Down Expand Up @@ -99,5 +98,6 @@ static_library("ots") {
"//third_party/zlib",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
4 changes: 2 additions & 2 deletions third_party/ots/METADATA
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
third_party {
identifier {
type: "ChromiumVersion"
value: "90.0.4430.218" # from https://chromereleases.googleblog.com/2021/05/stable-channel-update-for-chrome-os_18.html
value: "114.0.5735.358" # from https://chromereleases.googleblog.com/2024/03/long-term-support-channel-update-for_26.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/chromium/src.git"
version: "be07a152d9098db1e9d104a559c811029ab3e450"
version: "1759c6ae9316996b9f150c0ce9d0ca78a3d15c02"
}
identifier {
type: "UpstreamSubdir"
Expand Down
2 changes: 1 addition & 1 deletion third_party/ots/OWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[email protected]
[email protected]
drott@chromium.rg
drott@chromium.org
[email protected]
[email protected]
2 changes: 1 addition & 1 deletion third_party/ots/README.chromium
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: OTS (OpenType Sanitizer)
URL: https://github.com/khaledhosny/ots.git
Version: ee537ac096667eed6559124164c3e8482646fd77
Version: 46bea9879127d0ff1c6601b078e2ce98e83fcd33
Security Critical: yes
License: BSD

Expand Down
2 changes: 1 addition & 1 deletion third_party/ots/fuzz/ots_fuzzer.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down
48 changes: 0 additions & 48 deletions third_party/ots/src/.appveyor.yml

This file was deleted.

103 changes: 103 additions & 0 deletions third_party/ots/src/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build

on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: [main]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v1

- name: Install Python Dependencies
run: pip install --upgrade meson==0.60.2 ninja

- name: MSVC Setup
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1

- name: Meson Setup
run: meson --buildtype=release --strip -Ddebug=true --prefix="${{ github.workspace }}/dist" build

- name: Build
run: ninja -C build

- name: Test
run: ninja -C build test

- name: Install
if: github.ref_type == 'tag'
shell: bash
run: |
ninja -C build install
export VERSION=$(grep -m1 -o "version: '.*.'" meson.build | sed "s/version: '\(.*.\)'/\1/")
echo "ots_version=$VERSION" >> $GITHUB_ENV
mv -v dist/bin ots-$VERSION-${{ runner.os }}
- name: Archive
if: github.ref_type == 'tag'
uses: thedoctor0/zip-release@master
with:
path: ots-${{ env.ots_version }}-${{ runner.os }}
filename: ots-${{ env.ots_version }}-${{ runner.os }}.zip

- name: Upload
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v2
with:
name: bin-${{ runner.os }}
path: ots-*.zip
if-no-files-found: error

- name: Make Dist Tarball
if: github.ref_type == 'tag' && matrix.os == 'ubuntu-latest'
run: meson dist -C build --no-tests

- name: Upload Dist Tarball
if: github.ref_type == 'tag' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: dist
path: build/meson-dist/ots-*.tar.xz
if-no-files-found: error

deploy:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Download artifacts from build jobs
uses: actions/download-artifact@v2
with:
path: dist

- name: Extract release notes from annotated tag message
run: |
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md"
echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Publish
uses: softprops/action-gh-release@v1
with:
name: ${{ env.release_name }}
body_path: ${{ runner.temp }}/release_body.md
fail_on_unmatched_files: true
files: |
dist/*/*
64 changes: 0 additions & 64 deletions third_party/ots/src/.travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions third_party/ots/src/METADATA
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
third_party {
identifier {
type: "ChromiumVersion"
value: "90.0.4430.218" # from https://chromereleases.googleblog.com/2021/05/stable-channel-update-for-chrome-os_18.html
value: "114.0.5735.358" # from https://chromereleases.googleblog.com/2024/03/long-term-support-channel-update-for_26.html
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/external/github.com/khaledhosny/ots.git"
version: "ee537ac096667eed6559124164c3e8482646fd77"
# from https://chromium.googlesource.com/chromium/src/+/90.0.4430.218/DEPS#275
version: "46bea9879127d0ff1c6601b078e2ce98e83fcd33"
# from https://chromium.googlesource.com/chromium/src/+/114.0.5735.358/DEPS#363
}
}
3 changes: 1 addition & 2 deletions third_party/ots/src/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Build Status](https://travis-ci.com/khaledhosny/ots.svg?branch=master)](https://travis-ci.com/khaledhosny/ots)
[![Build status](https://ci.appveyor.com/api/projects/status/0l9ms6g47corescm/branch/master?svg=true)](https://ci.appveyor.com/project/khaledhosny/ots/branch/master)
[![Build](https://github.com/khaledhosny/ots/actions/workflows/ci.yml/badge.svg)](https://github.com/khaledhosny/ots/actions/workflows/ci.yml)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/ots.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:ots)

OpenType Sanitizer
Expand Down
2 changes: 1 addition & 1 deletion third_party/ots/src/docs/HowToTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This tool is basically for OTS developers.
### Description:
`ots-validator-checker` is a program which is intended to validate malformed fonts.
If the program detects that the font is invalid, it prints “OK” and returns
with 0 (success). If it coulndn’t detect any errors, the program then opens the
with 0 (success). If it couldn’t detect any errors, the program then opens the
transcoded font and renders some characters using FreeType:

transcoded_font = ValidateAndTranscode(malicious_font);
Expand Down
43 changes: 43 additions & 0 deletions third_party/ots/src/docs/ots-idempotent.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.TH OTS-IDEMPOTENT "1" "May 2021" "OpenType Sanitizer" "User Commands"
.SH NAME
ots-idempotent \- font transcoder
.SH SYNOPSIS
.B ots-idempotent
\fI\,FONT_FILE\/\fR
.SH DESCRIPTION
.PP
ots-idempotent is a program which validates and transcodes a font file using OTS.
This tool transcodes the original font twice and then verifies that the two
transcoded fonts are identical:
.PP
.RS
.nf
t1\ =\ ValidateAndTranscode(original_font);
if\ (validation_error)
\ \ PrintErrorAndExit;
t2\ =\ ValidateAndTranscode(t1);
if\ (validation_error)
\ \ PrintErrorAndExit;
if\ (t1\ !=\ t2)
\ \ PrintErrorAndExit;
.fi
.RE
.PP
This tool is basically for OTS developers.
.SH EXAMPLES
.RS
.nf
$ ./ots-idempotent sample.otf
$ ./ots-idempotent malformed.ttf
WARNING: bad range shift
ERROR at src/ots.cc:670 (ProcessGeneric)
Failed to sanitize file!
.fi
.RE
.SH "REPORTING BUGS"
Report bugs to <https://github.com/khaledhosny/ots/issues>
.SH "SEE ALSO"
.BR ots-perf (1),
.BR ots-sanitize (1),
.BR ots-side-by-side (1),
.BR ots-validator-checker (1)
34 changes: 34 additions & 0 deletions third_party/ots/src/docs/ots-perf.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.TH OTS-PERF "1" "May 2021" "OpenType Sanitizer" "User Commands"
.SH NAME
ots-perf \- performance checker
.SH SYNOPSIS
.B ots-perf
\fI\,FONT_FILE\/\fR
.SH DESCRIPTION
.PP
ots-perf is a program which validates and transcodes a font file N times using
OTS, then prints the elapsed time:
.PP
.RS
.nf
for\ (N\ times)
\ \ ValidateAndTranscode(original_font);
Print(elapsed_time_in_us\ /\ N);
.fi
.RE
.SH EXAMPLES
.RS
.nf
$ ./ots-perf sample.ttf
903 [us] sample.ttf (139332 bytes, 154 [byte/us])
$ ./ots-perf sample-bold.otf
291 [us] sample-bold.otf (150652 bytes, 517 [byte/us])
.fi
.RE
.SH "REPORTING BUGS"
Report bugs to <https://github.com/khaledhosny/ots/issues>
.SH "SEE ALSO"
.BR ots-idempotent (1),
.BR ots-sanitize (1),
.BR ots-side-by-side (1),
.BR ots-validator-checker (1)
Loading

0 comments on commit 3e9dbfa

Please sign in to comment.