Date: Mon, 04 Sep 2006 15:48:17 -0500 From: Bill Milford <freebsd@milfordmail.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/102868: [patch] x11-servers/xorg-server will not build on 4.11 Message-ID: <E1GKLMf-0006Yx-JF@mail.milfordmail.com> Resent-Message-ID: <200609042050.k84KoFT2054088@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 102868 >Category: ports >Synopsis: [patch] x11-servers/xorg-server will not build on 4.11 >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Sep 04 20:50:14 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Bill Milford >Release: FreeBSD 4.11-RELEASE-p17 i386 >Organization: >Environment: System: FreeBSD mail.milfordmail.com 4.11-RELEASE-p17 FreeBSD 4.11-RELEASE-p17 #2: Wed May 31 20:26:47 CDT 2006 bill@mail.milfordmail.com:/usr/obj/usr/src/sys/MYKERNEL2 i386 AMD K6-450 >Description: The patch added when the version became 6.9.0_5 will causes pcfread.c to not compile. This is because the patch uses INT32_MAX which is defined std_int.h for 5.x and 6.x, but not in 4.11. I have changed the patch to include limits.h and to use INT_MAX. This eliinates the build error and the code runs OK here. This is the error message received: LD_LIBRARY_PATH=/usr/ports/x11-servers/xorg-server/work/xc/exports/lib XLOCALEDIR=/usr/ports/x11-servers/xorg-server/work/xc/exports/lib/locale cc -O -pipe -ansi -pedantic -Dasm=__asm -Wall -Wpointer-arith -Wundef -fPIC -I/usr/ports/x11-servers/xorg-server/work/xc/include/fonts -I../../include -I/usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include -I/usr/ports/x11-servers/xorg-server/work/xc/exports/include/X11 -I../ -I/usr/ports/x11-servers/xorg-server/work/xc -I/usr/ports/x11-servers/xorg-server/work/xc/exports/include -I/usr/X11R6/include -I/usr/X11R6/include -DCSRG_BASED -DSHAPE -DXINPUT -DXKB -DXAPPGROUP -DXCSECURITY -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPANORAMIX -DRENDER -DRANDR -DXFIXES -DDAMAGE -DCOMPOSITE -DXEVIE -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER -DDLOPEN_HACK -DXFree86Server -DXF86VIDMODE -DXvMCExtension -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension -DX_BYTE_ ORDER=X_LITTLE_ENDIAN -DXORG_VERSION_CURRENT="(((6) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)" -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE -DXFree86Module -DFONTMODULE -DBDFFORMAT -DSNFFORMAT -DPCFFORMAT -c pcfread.c In file included from pcfread.c:48: /usr/include/stdint.h:75: redefinition of `xf86gid_t' /usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include/xf86_libc.h:90: `xf86gid_t' previously declared here /usr/include/stdint.h:80: conflicting types for `xf86mode_t' /usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include/xf86_libc.h:88: previous declaration of `xf86mode_t' /usr/include/stdint.h:92: redefinition of `xf86uid_t' /usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include/xf86_libc.h:89: `xf86uid_t' previously declared here /usr/include/stdint.h:108: conflicting types for `xf86dev_t' /usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include/xf86_libc.h:87: previous declaration of `xf86dev_t' In file included from pcfread.c:48: /usr/include/stdint.h:144: conflicting types for `xf86ssize_t' /usr/ports/x11-servers/xorg-server/work/xc/programs/Xserver/include/xf86_libc.h:86: previous declaration of `xf86ssize_t' pcfread.c: In function `pcfReadTOC': pcfread.c:137: `INT32_MAX' undeclared (first use in this function) pcfread.c:137: (Each undeclared identifier is reported only once pcfread.c:137: for each function it appears in.) pcfread.c: In function `pcfGetProperties': pcfread.c:260: `INT32_MAX' undeclared (first use in this function) pcfread.c: In function `pcfReadFont': pcfread.c:442: `INT32_MAX' undeclared (first use in this function) pcfread.c: In function `pmfReadFont': pcfread.c:835: `INT32_MAX' undeclared (first use in this function) *** Error code 1 Stop in /usr/ports/x11-servers/xorg-server/work/xc/lib/font/bitmap/module. *** Error code 1 Stop in /usr/ports/x11-servers/xorg-server/work/xc/lib/font/bitmap. *** Error code 1 Stop in /usr/ports/x11-servers/xorg-server/work/xc/lib/font. *** Error code 1 Stop in /usr/ports/x11-servers/xorg-server. >How-To-Repeat: cd /usr/ports/x11-servers/xorg-server make >Fix: --- patch-font-bitmap-pcfread.patch begins here --- *** patch-font-bitmap-pcfread.c.orig Fri Aug 25 16:52:48 2006 --- patch-font-bitmap-pcfread.c Wed Aug 30 11:33:53 2006 *************** *** 2,31 **** +++ lib/font/bitmap/pcfread.c Thu Aug 24 21:56:56 2006 @@ -45,6 +45,7 @@ #endif #include <stdarg.h> ! +#include <stdint.h> void pcfError(const char* message, ...) @@ -133,6 +134,10 @@ return (PCFTablePtr) NULL; count = pcfGetLSB32(file); if (IS_EOF(file)) return (PCFTablePtr) NULL; ! + if (count < 0 || count > INT32_MAX / sizeof(PCFTableRec)) { + pcfError("pcfReadTOC(): invalid file format\n"); + return NULL; + } tables = (PCFTablePtr) xalloc(count * sizeof(PCFTableRec)); if (!tables) { pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec)); @@ -252,6 +257,10 @@ if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) goto Bail; nprops = pcfGetINT32(file, format); ! + if (nprops <= 0 || nprops > INT32_MAX / sizeof(FontPropRec)) { + pcfError("pcfGetProperties(): invalid nprops value (%d)\n", nprops); + goto Bail; + } if (IS_EOF(file)) goto Bail; props = (FontPropPtr) xalloc(nprops * sizeof(FontPropRec)); --- 2,31 ---- +++ lib/font/bitmap/pcfread.c Thu Aug 24 21:56:56 2006 @@ -45,6 +45,7 @@ #endif #include <stdarg.h> ! +#include <limits.h> void pcfError(const char* message, ...) @@ -133,6 +134,10 @@ return (PCFTablePtr) NULL; count = pcfGetLSB32(file); if (IS_EOF(file)) return (PCFTablePtr) NULL; ! + if (count < 0 || count > INT_MAX / sizeof(PCFTableRec)) { + pcfError("pcfReadTOC(): invalid file format\n"); + return NULL; + } tables = (PCFTablePtr) xalloc(count * sizeof(PCFTableRec)); if (!tables) { pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec)); @@ -252,6 +257,10 @@ if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) goto Bail; nprops = pcfGetINT32(file, format); ! + if (nprops <= 0 || nprops > INT_MAX / sizeof(FontPropRec)) { + pcfError("pcfGetProperties(): invalid nprops value (%d)\n", nprops); + goto Bail; + } if (IS_EOF(file)) goto Bail; props = (FontPropPtr) xalloc(nprops * sizeof(FontPropRec)); *************** *** 54,64 **** if (!strings) { @@ -422,6 +439,10 @@ else nmetrics = pcfGetINT16(file, format); if (IS_EOF(file)) goto Bail; ! + if (nmetrics < 0 || nmetrics > INT32_MAX / sizeof(CharInfoRec)) { + pcfError("pcfReadFont(): invalid file format\n"); + goto Bail; + } metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec)); if (!metrics) { --- 54,64 ---- if (!strings) { @@ -422,6 +439,10 @@ else nmetrics = pcfGetINT16(file, format); if (IS_EOF(file)) goto Bail; ! + if (nmetrics < 0 || nmetrics > INT_MAX / sizeof(CharInfoRec)) { + pcfError("pcfReadFont(): invalid file format\n"); + goto Bail; + } metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec)); if (!metrics) { *************** *** 90,100 **** pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo)); @@ -809,6 +832,10 @@ else nmetrics = pcfGetINT16(file, format); if (IS_EOF(file)) goto Bail; ! + if (nmetrics < 0 || nmetrics > INT32_MAX / sizeof(CharInfoRec)) { + pcfError("pmfReadFont(): invalid file format\n"); + goto Bail; + } metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec)); if (!metrics) { --- 90,100 ---- pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo)); @@ -809,6 +832,10 @@ else nmetrics = pcfGetINT16(file, format); if (IS_EOF(file)) goto Bail; ! + if (nmetrics < 0 || nmetrics > INT_MAX / sizeof(CharInfoRec)) { + pcfError("pmfReadFont(): invalid file format\n"); + goto Bail; + } metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec)); if (!metrics) { --- patch-font-bitmap-pcfread.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1GKLMf-0006Yx-JF>