[143324] trunk/dports/textproc/barcode
cal at macports.org
cal at macports.org
Sat Dec 12 09:30:17 PST 2015
Revision: 143324
https://trac.macports.org/changeset/143324
Author: cal at macports.org
Date: 2015-12-10 14:58:17 -0800 (Thu, 10 Dec 2015)
Log Message:
-----------
barcode: Fix segfault if libpaper is unconfigured
Modified Paths:
--------------
trunk/dports/textproc/barcode/Portfile
Added Paths:
-----------
trunk/dports/textproc/barcode/files/patch-main.c-avoid-segfault-on-unconfigured-libpaper.diff
Modified: trunk/dports/textproc/barcode/Portfile
===================================================================
--- trunk/dports/textproc/barcode/Portfile 2015-12-10 22:41:25 UTC (rev 143323)
+++ trunk/dports/textproc/barcode/Portfile 2015-12-10 22:58:17 UTC (rev 143324)
@@ -6,6 +6,7 @@
name barcode
version 0.99
+revision 1
checksums rmd160 44c1574c0a48efae2fc267aab914c03577a4ec4a \
sha256 7c031cf3eb811242f53664379aebbdd9fae0b7b26b5e5d584c31a9f338154b64
@@ -28,7 +29,8 @@
patchfiles patch-Makefile.am-sample-may-need-replacement-calloc-from-libgnu.diff \
patch-barcode.h-library.h-avoid-global-declaration-in-header.diff \
- patch-codeabar.c-correct-output.diff
+ patch-codeabar.c-correct-output.diff \
+ patch-main.c-avoid-segfault-on-unconfigured-libpaper.diff
use_autoreconf yes
autoreconf.args -fvi
Added: trunk/dports/textproc/barcode/files/patch-main.c-avoid-segfault-on-unconfigured-libpaper.diff
===================================================================
--- trunk/dports/textproc/barcode/files/patch-main.c-avoid-segfault-on-unconfigured-libpaper.diff (rev 0)
+++ trunk/dports/textproc/barcode/files/patch-main.c-avoid-segfault-on-unconfigured-libpaper.diff 2015-12-10 22:58:17 UTC (rev 143324)
@@ -0,0 +1,35 @@
+Fix segmentation fault when libpaper is unconfigured
+
+When barcode is compiled with support for libpaper, but libpaper is not
+configured and papersize environment variables are not set, systempapername()
+returns NULL. This causes get_page_geometry() to crash subsequently.
+
+Source code for libpaper suggests that users are expected to call
+defaultpapername() and use its return value instead if that happens.
+Additionally, add a check that will only call get_page_geometry() with non-NULL
+values.
+
+Signed-off-by: Clemens Lang <cal at macports.org>
+Upstream-Status: Pending
+--- main.c.orig 2015-12-10 23:47:45.000000000 +0100
++++ main.c 2015-12-10 23:51:03.000000000 +0100
+@@ -475,10 +475,18 @@
+
+ /* If no paper size has been specified, use the default, if any */
+ if (!page_name) {
++#ifndef NO_LIBPAPER
++ const char *papername = systempapername(); /* or the system default */
++ if (!papername) {
++ papername = defaultpapername();
++ }
++#endif
+ page_wid = 595; page_hei = 842;
+ page_name = "A4"; /* I live in Europe :) */
+ #ifndef NO_LIBPAPER
+- get_page_geometry(systempapername()); /* or the system default */
++ if (papername) {
++ get_page_geometry(papername);
++ }
+ #endif
+ }
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/7eeac876/attachment.html>
More information about the macports-changes
mailing list