The vulnerability lies in the pypdf library's handling of PDF files in incremental parsing mode. An attacker can craft a PDF with a trailer containing a very large /Size value. The pypdf library, specifically the PdfWriter.clone_reader_document_root function, would previously trust this value and attempt to allocate memory for that number of objects. This leads to excessive memory allocation and CPU usage, resulting in a denial of service. The patch, identified in commit c50a0104cf083356f7c7f5d61410466a57f5c88a, rectifies this by no longer trusting the /Size value. Instead, it inspects the PDF's cross-reference tables to determine the actual number of objects to process, and it introduces configurable limits (incremental_clone_object_count_limit and incremental_clone_object_id_limit) on the number of objects and their IDs as a further safeguard. The primary vulnerable function is PdfWriter.clone_reader_document_root, which is called from PdfWriter.__init__ when incremental=True.