24-pdf-destination-missing.patch (935B)
1 # HG changeset patch 2 # User Jonathan Kew <jkew@mozilla.com> 3 # Date 1715329864 -3600 4 # Fri May 10 09:31:04 2024 +0100 5 # Node ID 0e12f0bc1e445c0afb23e620aa0321ccf7d7c4a8 6 # Parent 8f49349eeb0ec5df0e1dd3ddd98423138921a029 7 Bug 1895872 - Avoid generating a broken PDF when a link destination is missing. r=#gfx-reviewers 8 9 diff --git a/gfx/cairo/cairo/src/cairo-pdf-interchange.c b/gfx/cairo/cairo/src/cairo-pdf-interchange.c 10 --- a/gfx/cairo/cairo/src/cairo-pdf-interchange.c 11 +++ b/gfx/cairo/cairo/src/cairo-pdf-interchange.c 12 @@ -1506,7 +1506,8 @@ cairo_pdf_interchange_write_forward_link 13 TRUE, 14 x, y); 15 } else { 16 - return _cairo_tag_error ("Link to dest=\"%s\" not found", link->dest); 17 + // Destination is missing: just give the link an empty dest string. 18 + _cairo_output_stream_printf(surface->object_stream.stream, "<>\n"); 19 } 20 } else { 21 cairo_pdf_interchange_write_explicit_dest (surface,