Subject: [Tools-discuss] RFC PDF crashes viewer

From: Carsten Bormann <[email-masked]>
Date: Fri, 26 Jun 2020 17:44:35 +0200

This is undoubtedly a bug in the viewer, but I have received a report the PDF viewer evince (tested with versions 3.30.2 and 3.36.5, i.e., newer than CVE-2019-1010006) crashes when trying to view:
  
https://www.rfc-editor.org/rfc/rfc8798.pdf

I have no further data at this time.

Grüße, Carsten

---

From: Erik Auerswald <[email-masked]>
Date: Fri, 26 Jun 2020 18:51:23 +0200

Hi,

On Fri, Jun 26, 2020 at 05:44:35PM +0200, Carsten Bormann wrote:
> This is undoubtedly a bug in the viewer, but I have received a report
> the PDF viewer evince (tested with versions 3.30.2 and 3.36.5, i.e.,
> newer than CVE-2019-1010006) crashes when trying to view:
>   

I can confirm this for evince in Ubuntu 18.04 LTS with current updates:

    $ evince --version
    GNOME Document Viewer 3.28.4
    $ evince rfc8798.pdf 
    Segmentation fault (core dumped)

CVE-2019-1010006 should be fixed there, too, see:
https://usn.ubuntu.com/4067-1/

The apport report shows a SIGSEGV during a function to free a string,
just as it did back in 2019 when the first RFC PDFs from xml2rfc v3 were
published:

    evince crashed with SIGSEGV in g_string_free()

Sadly my Ubuntu bug report from back then has disappeared, so I cannot
provide a reference.  Perhaps they did understand that this kind of
program behavior has security implications. ;-)

I have opened a new bug report for this file:

https://bugs.launchpad.net/ubuntu/+source/evince/+bug/1885313

Back then I noticed the problem with RFC 8655.  This problem still exists
(a further hint that my original bug report might have been hidden
because it may point to a still open security vulnerability):

    $ evince rfc8655.pdf 
    Segmentation fault (core dumped)

There were more PDF renderings of RFCs evince could not handle (or rather
cannot handle since) then, e.g. RFC 8650 and RFC 8651:

    $ evince rfc8650.pdf 
    Segmentation fault (core dumped)
    $ evince rfc8651.pdf 
    Segmentation fault (core dumped)

Those examples and more were included in my 2019 Ubuntu bug report.

Thanks,
Erik
-- 
Simplicity is prerequisite for reliability.
                        -- Edsger W. Dijkstra

---

From: Russ Housley <[email-masked]>
Date: Fri, 26 Jun 2020 14:02:20 -0400

I just opened that file with three different viewers.  They all worked.

Russ

> On Jun 26, 2020, at 11:44 AM, Carsten Bormann <[email-masked]> wrote:
> 
> ___________________________________________________________
> Tools-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/tools-discuss
> 
> Please report datatracker.ietf.org and mailarchive.ietf.org
> bugs at http://tools.ietf.org/tools/ietfdb
> or send email to [email-masked]
> 
> Please report tools.ietf.org bugs at
> http://tools.ietf.org/tools/issues
> or send email to [email-masked]

---

From: Erik Auerswald <[email-masked]>
Date: Fri, 26 Jun 2020 22:32:14 +0200

Hi,

while MuPDF can open and display the file, it produces many instances of
two  messages (one error, one warning):

    $ mupdf rfc8798.pdf
    error: Unable to read ICC workflow
    warning: Attempt to read Output Intent failed
    [...]

For every page, a new burst of several instances of the above two messages
is printed.

Firefox displays the PDF file.

The GNOME Document Viewer (evince) crashes.

There are other PDF renderings of RFCs that crash evince, e.g., RFCs 8651
to 8655.  Those produce the same messages with MuPDF as RFC 8798, but MuPDF
does display them.  Both Firefox's and Chrome's built-in PDF viewers can
display those PDF renderings of RFCs.

I agree with Carsten that this is a bug in evince, but evince works fine
for most PDF files out there, including many that Firefox cannot display
correctly.  Since MuPDF produces error and warning messages, and evince
crashes, it seems to me as if it were likely that the PDF versions of
recent RFCs do have issues.

Thanks,
Erik

---

From: Michael Richardson <[email-masked]>
Date: Fri, 26 Jun 2020 23:31:12 -0400

> I can confirm this for evince in Ubuntu 18.04 LTS with current updates:

and for evince GNOME Document Viewer 3.30.2 for me.
on Devuan Beowulf (same as Debian Bullseye) on amd64.
Chrome's built-in viewer did not crash.

    > https://usn.ubuntu.com/4067-1/

Thanks.

    > Segmentation fault (core dumped)

:-(

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        |    IoT architect   [
]     [email-masked]  http://www.sandelman.ca/        |   ruby on rails    [

---

From: Erik Auerswald <[email-masked]>
Date: Mon, 29 Jun 2020 20:17:39 +0200

Hi all,

as another data point, the AUTH48 versions of the PDF rendering of
RFC 8792 worked fine in evince.  Viewing them in MuPDF did not produce
any error or warning messages.

The published version of the PDF does crash evince, and produce error
and warning messages (as below) in MuPDF.

As an obvious difference between the two files, the published PDF
embeds the XML version of the RFC, while the AUTH48 versions did not.

Thanks,
Erik

---

From: "John Levine" <[email-masked]>
Date: 30 Jun 2020 13:17:31 -0400

>recent RFCs do have issues.

The PDF versions of our RFCs are in the PDF/A-3U profile of PDF. PDF/A
is intended to be bitrot-resistant, with no external references and
such, and the various subprofiles allow various options.  We take
the output of xml2rfc and run it through a commercial package from
Callas software to embed the XML and make it PDF/A compliant.

In my experience, open source software that handles complex formats
like PDF is pretty flaky around the edges, particularly when dealing
with featuers like embdded files that aren't very common.

All of our PDFs work fine in Acrobat and the Apple and Google viewers
so I doubt that the files are bad.

As a workaround, if you run the XML through "xml2rfc --pdf" you'll get
a version without the embedded file which is less likely to trip over
bugs in the processing software.

R's,
John

---

From: "John Levine" <[email-masked]>
Date: 30 Jun 2020 13:18:09 -0400

>embeds the XML version of the RFC, while the AUTH48 versions did not.

Right -- that's a pretty strong hint where the bugs are.

R's,
John

---

From: Adam Roach <[email-masked]>
Date: Tue, 30 Jun 2020 12:52:42 -0500

> I have opened a new bug report for this file:

Thank you. This is how things get fixed. :)

/a

---

From: "John R Levine" <[email-masked]>
Date: 30 Jun 2020 15:35:27 -0400

> bugs in the processing software.

I tried it, mupdf displays them without trouble.

If you want to get the same rendering details as the published PDFs, 
here's the arguments they use to xml2rfc:

   xml2rfc --v3 --pdf --id-reference-base-url="https://tools.ietf.org/html/" \
    --rfc-reference-base-url="https://www.rfc-editor.org/rfc/" \
     --id-is-work-in-progress rfcNNNN.xml

Regards,
John Levine, [email-masked], Taughannock Networks, Trumansburg NY
Please consider the environment before reading this e-mail. https://jl.ly

---

From: "John R Levine" <[email-masked]>
Date: 30 Jun 2020 16:19:39 -0400

One last observation, the open source xpdf viewer from Glyph and Cog, 
which was forked into the widely used poppler library, seems to handle our 
PDFs without trouble.

http://www.glyphandcog.com/opensource.html

Regards,

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 30 Jun 2020 22:25:09 +0200

On 2020-06-30, at 22:19, John R Levine <[email-masked]> wrote:
> 
> One last observation, the open source xpdf viewer from Glyph and Cog, which was forked into the widely used poppler library, seems to handle our PDFs without trouble.
> 

Good to know.

(Background for my initial observation: When you give an assignment to students and their favorite PDF viewer crashes on the required reading material, they’ll simply say they can’t do the assignment instead of trying out other readers.)

Grüße, Carsten

---

From: "John R Levine" <[email-masked]>
Date: 30 Jun 2020 21:10:23 -0400

> (Background for my initial observation: When you give an assignment to students and their favorite PDF viewer crashes on the required reading material, they’ll simply say they can’t do the assignme…

Since the PDF RFCs display without trouble in the default viewers on 
Windows, MacOS, Android, iOS, and Chrome, I am impressed at the creativity 
of your students who went to the effort to find a PDF viewer that didn't 
work.

Regards,