From cab46f1ecf10ab248b059330e2bd9064786ce454 Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Mon, 25 Dec 2017 22:30:34 +0000 Subject: [PATCH] handle error case where the descendant font for a type 0 composite font is not a dictionary --- src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs b/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs index 54892164..13bb0cb1 100644 --- a/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs +++ b/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs @@ -41,6 +41,10 @@ { ParseDescendant(descendantFontDictionary, reader, isLenientParsing); } + else + { + throw new InvalidFontFormatException("Expected to find a Descendant Font dictionary, instead it was: " + parsed); + } } else { @@ -68,7 +72,7 @@ return font; } - + private static bool TryGetFirstDescendant(PdfDictionary dictionary, out CosObject descendant) { descendant = null;