Skip to content

Segmentation Fault on some PDF when calling both PageCollection::AppendDocumentPages() and PdfMetadata::SetProducer() #253

@bhennion

Description

@bhennion

Using the PDF file testfile.pdf, the following MWE triggers a segmentation fault:

{
    PdfMemDocument document;
    document.Load("path/to/the/above/testfile.pdf");

    PdfMemDocument otherdoc;
    // otherdoc.Load("some/other/file.pdf"); // This is actually not needed to get the crash

    document.GetPages().AppendDocumentPages(otherdoc);
    document.GetMetadata().SetProducer("Anything");

    document.Save("output.pdf");
}

It runs fine if you comment out either document.GetPages().AppendDocumentPages(otherdoc); or document.GetMetadata().SetProducer("Anything");.

Note: the test pdf has been created using pdftk.

Expected behaviour

Append the pages and set the Producer as expected (or raise an exception if the PDF file is malformed), without Segfaulting.

PoDoFo Version
Latest master (8690ee9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions