Improve error message for invalid codepoints

This commit is contained in:
Laurenz Stampfl 2024-12-18 16:30:16 +01:00
parent b61505c893
commit 48f833c79a
3 changed files with 8 additions and 6 deletions

2
Cargo.lock generated
View File

@ -1313,7 +1313,7 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.3.0"
source = "git+https://github.com/LaurenzV/krilla?rev=d4dedf7#d4dedf71cc39f8fa5e8c8dc2a69eed164e0f8358"
source = "git+https://github.com/LaurenzV/krilla?rev=ffdd1aa#ffdd1aa56a5c70711cc2863ce056cc2925bf4468"
dependencies = [
"base64",
"bumpalo",

View File

@ -70,7 +70,7 @@ if_chain = "1"
image = { version = "0.25.2", default-features = false, features = ["png", "jpeg", "gif"] }
indexmap = { version = "2", features = ["serde"] }
kamadak-exif = "0.5"
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "d4dedf7", features = ["comemo", "rayon", "svg"] }
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "ffdd1aa", features = ["comemo", "rayon", "svg"] }
kurbo = "0.11"
libfuzzer-sys = "0.4"
lipsum = "0.9"

View File

@ -385,10 +385,12 @@ fn finish(document: Document, gc: GlobalContext) -> SourceResult<Vec<u8>> {
hint: "ensure all text can be displayed using an available font");
}
ValidationError::InvalidCodepointMapping(_, _) => {
bail!(Span::detached(), "{prefix} the PDF contains the \
disallowed codepoints";
hint: "make sure to not use the Unicode characters 0x0, \
0xFEFF or 0xFFFE");
bail!(Span::detached(), "{prefix} the PDF contains \
disallowed codepoints or is missing codepoint mappings";
hint: "make sure to not use the unicode characters 0x0, \
0xFEFF or 0xFFFE";
hint: "for complex scripts like indic or arabic, it might \
not be possible to produce a compliant document");
}
ValidationError::UnicodePrivateArea(_, _) => {
bail!(Span::detached(), "{prefix} the PDF contains characters from the \