-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into golang-ver-fix
- Loading branch information
Showing
26 changed files
with
1,091 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ auto_ccs: | |
- "[email protected]" | ||
- "[email protected]" | ||
- "[email protected]" | ||
- "[email protected]" | ||
main_repo: 'https://github.com/apache/arrow.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2025 Google LLC | ||
# | ||
# 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. | ||
# | ||
################################################################################ | ||
|
||
FROM gcr.io/oss-fuzz-base/base-builder-rust | ||
|
||
# Clone ttf-parser project | ||
RUN git clone https://github.com/RazrFalcon/ttf-parser ttf-parser | ||
WORKDIR $SRC/ttf-parser | ||
|
||
COPY build.sh $SRC/ | ||
COPY fuzz $SRC/ttf-parser/fuzz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -eu | ||
# | ||
# Copyright 2025 Google LLC | ||
# | ||
# 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. | ||
# | ||
################################################################################ | ||
|
||
# Build fuzzers | ||
cargo fuzz build -O | ||
|
||
find $SRC/ttf-parser/fuzz/target/x86_64-unknown-linux-gnu/release -maxdepth 1 -name fuzz-* \ | ||
-type f -perm -u=x -exec cp {} $OUT \; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[package] | ||
name = "ttf-parser-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2018" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
serde = "1.0" | ||
serde_json = "1.0" | ||
ttf-parser = { path = "..", features = ["apple-layout"] } | ||
|
||
[[bin]] | ||
name = "fuzz-base" | ||
path = "fuzz_targets/fuzz-base.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-aat" | ||
path = "fuzz_targets/fuzz-aat.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-cpal" | ||
path = "fuzz_targets/fuzz-cpal.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-table" | ||
path = "fuzz_targets/fuzz-table.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-table-with-builder" | ||
path = "fuzz_targets/fuzz-table-with-builder.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-glyph-index" | ||
path = "fuzz_targets/fuzz-glyph-index.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-outline" | ||
path = "fuzz_targets/fuzz-outline.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "fuzz-variable-outline" | ||
path = "fuzz_targets/fuzz-variable-outline.rs" | ||
test = false | ||
doc = false | ||
bench = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// 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. | ||
|
||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
use std::num::NonZeroU16; | ||
use ttf_parser::{GlyphId, apple_layout::Lookup}; | ||
|
||
fn u16_to_u8_vec(data: &[u16]) -> Vec<u8> { | ||
let mut u8_data = Vec::with_capacity(data.len() * 2); | ||
for &value in data { | ||
u8_data.push((value >> 8) as u8); | ||
u8_data.push(value as u8); | ||
} | ||
u8_data | ||
} | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
// Skip this iteration if data not enough | ||
if data.len() < 4 { | ||
return; | ||
} | ||
|
||
let (format_data, rest) = data.split_at(2); | ||
let format = u16::from_be_bytes([format_data[0], format_data[1]]); | ||
|
||
let random_u16 = |data: &[u8], idx: usize| -> Option<u16> { | ||
if data.len() > idx + 1 { | ||
Some(u16::from_be_bytes([data[idx], data[idx + 1]])) | ||
} else { | ||
None | ||
} | ||
}; | ||
|
||
let lookup_len = NonZeroU16::new(1).unwrap(); | ||
|
||
// Use valid fromat 0 2 4 6 8 10 for fuzzing chioce | ||
match format { | ||
0 => { | ||
if let Some(value) = random_u16(rest, 0) { | ||
let lookup_data = u16_to_u8_vec(&[0, value]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(0)); | ||
let _ = table.value(GlyphId(1)); | ||
} | ||
} | ||
} | ||
2 => { | ||
if let Some(segment_size) = random_u16(rest, 2) { | ||
let lookup_data = u16_to_u8_vec(&[2, segment_size, 1]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(118)); | ||
let _ = table.value(GlyphId(5)); | ||
} | ||
} | ||
} | ||
4 => { | ||
if let Some(segment_size) = random_u16(rest, 2) { | ||
let lookup_data = u16_to_u8_vec(&[4, segment_size, 1]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(118)); | ||
let _ = table.value(GlyphId(7)); | ||
} | ||
} | ||
} | ||
6 => { | ||
if let Some(segment_size) = random_u16(rest, 2) { | ||
let lookup_data = u16_to_u8_vec(&[6, segment_size]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(0)); | ||
let _ = table.value(GlyphId(10)); | ||
} | ||
} | ||
} | ||
8 => { | ||
if let Some(glyph_count) = random_u16(rest, 2) { | ||
let lookup_data = u16_to_u8_vec(&[8, 0, glyph_count]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(0)); | ||
let _ = table.value(GlyphId(5)); | ||
} | ||
} | ||
} | ||
10 => { | ||
if let Some(value_size) = random_u16(rest, 2) { | ||
let lookup_data = u16_to_u8_vec(&[10, value_size, 0]); | ||
if let Some(table) = Lookup::parse(lookup_len, &lookup_data) { | ||
let _ = table.value(GlyphId(0)); | ||
let _ = table.value(GlyphId(1)); | ||
} | ||
} | ||
} | ||
_ => { | ||
// Ignore invliad format of 1 3 5 7 9 | ||
} | ||
} | ||
}); |
Oops, something went wrong.