[Poppler-bugs] [Bug 90796] New: [patch] Allow disabling C assertions with configure --disable-assert

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 31 13:33:31 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90796

            Bug ID: 90796
           Summary: [patch] Allow disabling C assertions with configure
                    --disable-assert
           Product: poppler
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: williambader at hotmail.com

Created attachment 116191
  --> https://bugs.freedesktop.org/attachment.cgi?id=116191&action=edit
patch to configure.ac to configure assert()

Poppler has a number of calls to assert() that are enabled by default.
Some of them could be expensive, for example,
Splash::gouraudTriangleShadedFill() in splash.cc has two assert() tests inside
an inner loop, and one of the tests does a real number calculation for each
pixel:
  assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10);
  assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y *
rowSize);

In addition, it would be bad for an application that used poppler to abort
(possibly losing work) just because poppler had an internal inconsistency that
might have corrupted an image but would not have caused a bad memory access.

The attached patch to configure.ac adds a --disable-assert option to configure
that adds -DNDEBUG to CPPFLAGS.  Some headers include <assert.h> before (or
without) including config.h, so I think that it is safer to pass -DNDEBUG on
the command line than to try to trace every include <assert.h> in each header
to verify that every path to include the header has already included config.h.

William

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20150531/aa24af61/attachment.html>


More information about the Poppler-bugs mailing list