poppler/Form.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 40762b05b73ec790c8cbe33ab76770f181f67aee
Author: Nelson Benítez León <[email protected]>
Date:   Sun Jun 19 19:28:52 2022 -0400

    Form.cc: Fix crash in Form::ensureFontsForAllCharacters()
    
    code was assuming that defaultResources->lookupFont() would
    never return null.
    
    Fixes #1258

diff --git a/poppler/Form.cc b/poppler/Form.cc
index efd55a5f..0b9b0b1d 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -2951,7 +2951,7 @@ std::vector<Form::AddFontResult> 
Form::ensureFontsForAllCharacters(const GooStri
 {
     GfxResources *resources = fieldResources ? fieldResources : 
defaultResources;
     std::shared_ptr<GfxFont> f = 
resources->lookupFont(pdfFontNameToEmulate.c_str());
-    const CharCodeToUnicode *ccToUnicode = f->getToUnicode();
+    const CharCodeToUnicode *ccToUnicode = f ? f->getToUnicode() : nullptr;
     if (!ccToUnicode) {
         error(errInternal, -1, "Form::ensureFontsForAllCharacters: No 
ccToUnicode, this should not happen\n");
         return {}; // will never happen with current code

Reply via email to