SECURITY:

Fixes for multiple vulnerabilities.  Switch to centralized jumbo patch.
From rohee@
This commit is contained in:
naddy 2005-04-12 17:28:04 +00:00
parent e1fe63e373
commit 1a6b0aa7f4
20 changed files with 34 additions and 1188 deletions

View File

@ -1,27 +1,17 @@
# $OpenBSD: Makefile,v 1.25 2005/03/15 01:16:47 naddy Exp $
# $OpenBSD: Makefile,v 1.26 2005/04/12 17:28:04 naddy Exp $
# Original from: Marco S Hyman <marc@OpenBSD.ORG>
COMMENT= "X11 image display and modification tool"
DISTNAME= xv-3.10a
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= graphics x11
MASTER_SITES= ftp://ftp.cis.upenn.edu/pub/xv/
MASTER_SITES0= ftp://swrinde.nde.swri.edu/pub/png/applications/
MASTER_SITES1= http://ftp.trilon.com/pub/xv/patches/
DISTFILES= ${DISTNAME}.tar.gz xv-3.10a-png-1.2d.tar.gz:0
MASTER_SITES0= http://www.sonic.net/~roelofs/code/
DISTFILES= ${DISTNAME}.tar.gz xv-3.10a-jumbo-patches-20050410.tar.gz:0
DIST_SUBDIR= xv
# Various patches from the XV author's site
#
# (xpm.patch is integrated in xvpng.diff that is in xv-3.10a-png-1.2d.tar.gz)
# longname.patch is integrated in patches/patch-aj
PATCHFILES= xv-3.10a.JPEG-patch xv-3.10a.TIFF-patch bmp32.patch:1 \
deepcolor.patch:1 exceed_grab.patch:1 gifpatch:1 grabpatch:1 \
gssafer.patch:1 mp-tiff-patch:1 pdf.patch:1 tiff1200.patch:1 \
vispatch:1 xvpng-fix2.patch:1
HOMEPAGE= http://www.trilon.com/xv/index.html
LIB_DEPENDS= jpeg.62.::graphics/jpeg \
@ -36,15 +26,12 @@ PERMIT_DISTFILES_CDROM= "Must buy license"
PERMIT_DISTFILES_FTP= Yes
WANTLIB= X11 Xext c m z
CONFIGURE_STYLE= imake
CONFIGURE_STYLE= imake
NO_REGRESS= Yes
pre-patch:
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xcmap.diff
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xvpng.diff
@mv ${WRKDIR}/xvpng.c ${WRKSRC}
@mv ${WRKDIR}/bits/br_png ${WRKSRC}/bits
NO_REGRESS= Yes
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xv-3.10a-jumbo-fix-patch-20050410.txt
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xv-3.10a-jumbo-enh-patch-20050410.txt
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/xv

View File

@ -1,60 +1,8 @@
MD5 (xv/bmp32.patch) = 03d3d5da674a53b4046aa5b205a628c0
MD5 (xv/deepcolor.patch) = bc81180d9e9dce234d092ff4334cafc0
MD5 (xv/exceed_grab.patch) = f2b4026ee97386db8585e51ed2e275bc
MD5 (xv/gifpatch) = 476a786f60fee70812a4b59588db2049
MD5 (xv/grabpatch) = fd9b9e735a1ed68e3792d904f1df422a
MD5 (xv/gssafer.patch) = 88992cfe70d542456615208f42ca8741
MD5 (xv/mp-tiff-patch) = acc754bea43bf957c37d2df293ed41e7
MD5 (xv/pdf.patch) = f057517331a6cb9b231c828d57514295
MD5 (xv/tiff1200.patch) = 8ab1082f02a7fa9847b2fb696a0b5aa2
MD5 (xv/vispatch) = 4bc978d266bf1af9e29e8f21fc21e9d7
MD5 (xv/xv-3.10a-png-1.2d.tar.gz) = c8cbe14db6e2104ed4eb5330cdaba420
MD5 (xv/xv-3.10a.JPEG-patch) = bd3ac79fa805319f583ccd382bdc825d
MD5 (xv/xv-3.10a.TIFF-patch) = 305f2f0273368bb6e029c3f212a14249
MD5 (xv/xv-3.10a-jumbo-patches-20050410.tar.gz) = 4f032107152a5e95cd35812defff1aee
MD5 (xv/xv-3.10a.tar.gz) = 2d4fbeec1561304362781cc8e2f7f72d
MD5 (xv/xvpng-fix2.patch) = 672f2f82c94828d91b6929ed87139937
RMD160 (xv/bmp32.patch) = 31e3f2be6d1e039d42ea111965e35c88b07652a3
RMD160 (xv/deepcolor.patch) = 27dbaf4e159a5d5c74643ffbd83db8d3bfc17ee1
RMD160 (xv/exceed_grab.patch) = 0bc71dbd317c2dd0a7729efa5b089d2b6aff7a3c
RMD160 (xv/gifpatch) = 5c7152b8fb7ebf42c2501808d944044dd5d2e263
RMD160 (xv/grabpatch) = b05b957f8a4a8b32c2325c023a82e145cdcab101
RMD160 (xv/gssafer.patch) = 76c90d38d76749dcd4b54cbb7987e0c13037d701
RMD160 (xv/mp-tiff-patch) = cfa30baa3e32b965fe60ab85a47cf5668c479ec1
RMD160 (xv/pdf.patch) = 469d456554b73d4c5f75b32eb6d542e163a9a45e
RMD160 (xv/tiff1200.patch) = 06944bc4f59f9f6a7abad9152ba2d38e2bb63524
RMD160 (xv/vispatch) = 33928eb4c5a21bb4a01572df661518c8ea8f4112
RMD160 (xv/xv-3.10a-png-1.2d.tar.gz) = 5ff43920962ddbeca9bbbb14dd7fdc59c284002f
RMD160 (xv/xv-3.10a.JPEG-patch) = f69cb0c07c116fbcec58678bcba1b5ef96cb7e62
RMD160 (xv/xv-3.10a.TIFF-patch) = 4c09609558f1b93a67cae2abaf14462208dd850b
RMD160 (xv/xv-3.10a-jumbo-patches-20050410.tar.gz) = 2c2d871f297c8ca5c6f8c6782e6c2b07271cf070
RMD160 (xv/xv-3.10a.tar.gz) = 7d545e0c0e5b0120a7d026ea549cba19a53fbc0d
RMD160 (xv/xvpng-fix2.patch) = 755232e0328faebdb0c95728691ffd6f3fb2539a
SHA1 (xv/bmp32.patch) = 07606692a171f50950751c9827422db917171d1d
SHA1 (xv/deepcolor.patch) = a2090f8be004d6ae10e2d1ee09c47a44270b2bb7
SHA1 (xv/exceed_grab.patch) = b095776ebb90d29e773098ceddd70f2d35e994dc
SHA1 (xv/gifpatch) = 2bc19d64dc426521746fa964bd9164f74ccf6d37
SHA1 (xv/grabpatch) = 0a9354b8649db991e57313f6844788236dc6dd22
SHA1 (xv/gssafer.patch) = fd354a256da0220a67b96bb8c6f75f8e41b39370
SHA1 (xv/mp-tiff-patch) = afe0c638470b9a78f22327f64564d139d734ecf3
SHA1 (xv/pdf.patch) = 79794af437c37df53e0ca9669f944772803dc46e
SHA1 (xv/tiff1200.patch) = 2f825a08da59a0e80bd2229ad0b6d103dad5f908
SHA1 (xv/vispatch) = 0efe40c451319b9f20ee3358277c216230b0de23
SHA1 (xv/xv-3.10a-png-1.2d.tar.gz) = cd824fc8c5e15d609b09c04b6c924ad656321e93
SHA1 (xv/xv-3.10a.JPEG-patch) = 05d0de5a3c4babc36f867247e1920eca6b9e9ff0
SHA1 (xv/xv-3.10a.TIFF-patch) = 5e1ce5610a83a88d5878eefe175352a4cc2aa21c
SHA1 (xv/xv-3.10a-jumbo-patches-20050410.tar.gz) = 39cd97057233257f949ae8f48a693f7e6fb3fd9a
SHA1 (xv/xv-3.10a.tar.gz) = 9e6372f154be9e9e355972cbeb91d98d9c342474
SHA1 (xv/xvpng-fix2.patch) = 3712d6e5a5a56afe286637faf22b86f3ba690f39
SIZE (xv/bmp32.patch) = 6652
SIZE (xv/deepcolor.patch) = 1529
SIZE (xv/exceed_grab.patch) = 3354
SIZE (xv/gifpatch) = 1168
SIZE (xv/grabpatch) = 1155
SIZE (xv/gssafer.patch) = 871
SIZE (xv/mp-tiff-patch) = 16003
SIZE (xv/pdf.patch) = 585
SIZE (xv/tiff1200.patch) = 1023
SIZE (xv/vispatch) = 3711
SIZE (xv/xv-3.10a-png-1.2d.tar.gz) = 20971
SIZE (xv/xv-3.10a.JPEG-patch) = 3297
SIZE (xv/xv-3.10a.TIFF-patch) = 3241
SIZE (xv/xv-3.10a-jumbo-patches-20050410.tar.gz) = 318005
SIZE (xv/xv-3.10a.tar.gz) = 2259124
SIZE (xv/xvpng-fix2.patch) = 6837

View File

@ -1,5 +1,5 @@
--- Imakefile.orig Fri Jan 13 21:24:01 1995
+++ Imakefile Tue Sep 21 06:50:27 2004
--- Imakefile.orig Mon Apr 11 23:39:27 2005
+++ Imakefile Mon Apr 11 23:40:00 2005
@@ -6,15 +6,24 @@
/* if, for whatever reason, you're unable to get the JPEG library to compile
* on your machine, *COMMENT OUT* the following line
@ -27,7 +27,16 @@
/* if, for whatever reason, you're unable to get the PDS/VICAR support
* to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line
*/
@@ -119,16 +128,44 @@ SGI = -Dsgi
@@ -35,7 +44,7 @@
/* If your machine has the 'usleep()' function, uncomment the following
* line. If it doesn't, or you're not sure, don't uncomment the line
*/
-/* TIMERS = -DUSLEEP */
+TIMERS = -DUSLEEP
/* if XV locks up whenever you click any button in the controls window,
* the Timer() function in xvmisc.c is going out-to-lunch. A simple
@@ -119,16 +128,44 @@
JPEG = -DDOJPEG
JPEGDIR = jpeg
LIBJPEG = $(JPEGDIR)/libjpeg.a
@ -72,7 +81,7 @@
#ifdef HavePDS
PDS = -DDOPDS
#endif
@@ -138,18 +175,18 @@ PDS = -DDOPDS
@@ -138,18 +175,18 @@
SCO= -Dsco -DPOSIX -DNO_RANDOM
SYS_LIBRARIES= -lm -lc -lx
#else
@ -96,25 +105,7 @@
SRCS1 = xv.c xvevent.c xvroot.c xvmisc.c xvimage.c xvcolor.c xvsmooth.c \
xv24to8.c xvgif.c xvpm.c xvinfo.c xvctrl.c xvscrl.c xvalg.c \
@@ -157,7 +194,7 @@ SRCS1 = xv.c xvevent.c xvroot.c xvmisc.c
xvdial.c xvgraf.c xvsunras.c xvjpeg.c xvps.c xvpopup.c xvdflt.c \
xvtiff.c xvtiffwr.c xvpds.c xvrle.c xviris.c xvgrab.c vprintf.c \
xvbrowse.c xvtext.c xvpcx.c xviff.c xvtarga.c xvxpm.c xvcut.c \
- xvxwd.c xvfits.c
+ xvxwd.c xvfits.c xvpng.c
OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
@@ -165,7 +202,7 @@ OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o
xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
- xvxwd.o xvfits.o
+ xvxwd.o xvfits.o xvpng.o
SRCS2= bggen.c
OBJS2= bggen.o
@@ -233,7 +270,19 @@ clean::
@@ -233,7 +270,19 @@
#endif
@ -134,7 +125,7 @@
SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4)
AllTarget($(PROGRAMS))
@@ -268,5 +317,5 @@ InstallManPageLong(docs/vdcomp,$(MANDIR)
@@ -268,5 +317,5 @@
tar:
tar cf xv.tar Makefile* Imakefile *.c *.h bits docs \

View File

@ -1,36 +1,16 @@
$OpenBSD: patch-config_h,v 1.1 2004/09/21 18:46:04 sturm Exp $
We have gunzip, it's in /usr/bin, and if ghostscript is installed it will be
found.
--- config.h.orig Thu Jan 5 19:49:21 1995
+++ config.h Wed Mar 24 00:08:07 1999
@@ -13,13 +13,13 @@
* definition appropriately. (use 'which gunzip' to find if you have gunzip,
* and where it lives)
*/
-#undef USE_GUNZIP
+#define USE_GUNZIP
#ifdef USE_GUNZIP
# ifdef VMS
# define GUNZIP "UNCOMPRESS"
# else
-# define GUNZIP "/usr/local/bin/gunzip -q"
+# define GUNZIP "/usr/bin/gunzip -q"
# endif
#endif
@@ -88,9 +88,9 @@
--- config.h.after-distpatch Mon Apr 11 22:23:26 2005
+++ config.h Mon Apr 11 22:24:15 2005
@@ -106,10 +106,9 @@
* should not need to be changed
*/
-/* #define GS_PATH "/usr/local/bin/gs" */
-#define GS_PATH "/usr/bin/gs"
-/* #define GS_LIB "." */
-/* #define GS_DEV "ppmraw" */
+#define GS_PATH "/usr/local/bin/gs"
+#define GS_LIB "/usr/local/share/ghostscript"
+#define GS_DEV "ppmraw"
+#define GS_PATH "/usr/local/bin/gs"
+#define GS_LIB "/usr/local/share/ghostscript"
+#define GS_DEV "ppmraw"
/***************************************************************************

View File

@ -1,49 +0,0 @@
$OpenBSD: patch-vdcomp_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- vdcomp.c.orig Thu Dec 22 23:34:47 1994
+++ vdcomp.c Tue Sep 21 06:50:27 2004
@@ -108,7 +108,9 @@
!defined(bsd43) && \
!defined(aux) && \
!defined(__bsdi__) && \
- !defined(sequent)
+ !defined(sequent) && \
+ !defined(__FreeBSD__) && \
+ !defined(__OpenBSD__)
# if defined(hp300) || defined(hp800) || defined(NeXT)
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
@@ -429,10 +431,13 @@ int host;
{
short shortint;
typedef long off_t;
+ char *s;
if (inname[0] == ' ') {
printf("\nEnter name of file to be decompressed: ");
- gets (inname);
+ fgets (inname, sizeof(inname), stdin);
+ if ((s = strchr(inname, '\n')) != NULL)
+ *s = '\0';
}
if (host == 1 | host == 2) {
@@ -474,13 +479,17 @@ int host;
printf("\n 3. VICAR format.");
printf("\n 4. Unlabelled binary array.\n");
printf("\n Enter format number:");
- gets(inname);
+ fgets (inname, sizeof(inname), stdin);
+ if ((s = strchr(inname, '\n')) != NULL)
+ *s = '\0';
output_format = atoi(inname);
} while (output_format < 1 || output_format > 4);
if (outname[0] == ' ') {
printf("\nEnter name of uncompressed output file: ");
- gets (outname);
+ fgets (outname, sizeof(outname), stdin);
+ if ((s = strchr(outname, '\n')) != NULL)
+ *s = '\0';
}
return(host);

View File

@ -1,100 +0,0 @@
$OpenBSD: patch-xv_c,v 1.2 2005/03/15 01:16:47 naddy Exp $
--- xv.c.orig Tue Mar 15 00:20:23 2005
+++ xv.c Tue Mar 15 00:28:24 2005
@@ -1990,10 +1990,9 @@ static int openPic(filenum)
#else /* it is VMS */
sprintf(filename, "[]xvXXXXXX");
#endif
- mktemp(filename);
+ fp = fdopen(mkstemp(filename), "w");
clearerr(stdin);
- fp = fopen(filename,"w");
if (!fp) FatalError("openPic(): can't write temporary file");
while ( (i=getchar()) != EOF) putc(i,fp);
@@ -2219,7 +2218,7 @@ static int openPic(filenum)
SetISTR(ISTR_INFO,formatStr);
SetInfoMode(INF_PART);
- SetISTR(ISTR_FILENAME,
+ SetISTR(ISTR_FILENAME, "%s",
(filenum==DFLTPIC || filenum==GRABBED || frompipe)
? "<none>" : basefname);
@@ -2759,7 +2758,7 @@ int UncompressFile(name, uncompname)
#ifndef VMS
sprintf(uncompname, "%s/xvuXXXXXX", tmpdir);
- mktemp(uncompname);
+ close(mkstemp(uncompname));
sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
#else /* it IS VMS */
strcpy(uncompname, "[]xvuXXXXXX");
@@ -2934,8 +2933,8 @@ static int readpipe(cmd, fname)
if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
sprintf(tmpname,"%s/xvXXXXXX", tmpdir);
- mktemp(tmpname);
- if (tmpname[0] == '\0') { /* mktemp() blew up */
+ close(mkstemp(tmpname));
+ if (tmpname[0] == '\0') { /* mkstemp() blew up */
sprintf(str,"Unable to create temporary filename.");
ErrPopUp(str, "\nHow unlikely!");
return 1;
@@ -3232,9 +3231,17 @@ static void createMainWindow(geom, name)
hints.flags = 0;
if ((i&XValue || i&YValue)) hints.flags = USPosition;
- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
-
+ hints.win_gravity = NorthWestGravity;
+ if (i&XValue && i&XNegative) {
+ hints.win_gravity = NorthEastGravity;
+ x = vrWIDE - (eWIDE + 2 * bwidth) - abs(x);
+ }
+ if (i&YValue && i&YNegative) {
+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
+ SouthWestGravity : SouthEastGravity;
+ y = vrHIGH - (eHIGH + 2 * bwidth) - abs(y);
+ }
+
if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
@@ -3253,7 +3260,7 @@ static void createMainWindow(geom, name)
hints.x = x; hints.y = y;
hints.width = eWIDE; hints.height = eHIGH;
hints.max_width = maxWIDE; hints.max_height = maxHIGH;
- hints.flags |= USSize | PMaxSize;
+ hints.flags |= USSize | PMaxSize | PWinGravity;
xswa.bit_gravity = StaticGravity;
xswa.background_pixel = bg;
@@ -3302,10 +3309,6 @@ static void createMainWindow(geom, name)
}
}
-
- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
- setWinIconNames(name);
-
xwmh.input = True;
xwmh.flags = InputHint;
@@ -3330,12 +3333,12 @@ static void createMainWindow(geom, name)
}
}
}
- XSetWMHints(theDisp, mainW, &xwmh);
classh.res_name = "xv";
classh.res_class = "XVroot";
- XSetClassHint(theDisp, mainW, &classh);
+ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh, &classh);
+ setWinIconNames(name);
if (nodecor) { /* turn of image window decorations (in MWM) */
Atom mwm_wm_hints;

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-xv_h,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xv.h.orig Tue Sep 21 06:49:20 2004
+++ xv.h Tue Sep 21 06:50:28 2004
@@ -159,7 +159,8 @@
!defined(bsd43) && \
!defined(aux) && \
!defined(__bsdi__) && \
- !defined(sequent)
+ !defined(sequent) && \
+ !defined(__OpenBSD__)
# if defined(hp300) || defined(hp800) || defined(NeXT)
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */

View File

@ -1,127 +0,0 @@
$OpenBSD: patch-xvbmp_c,v 1.2 2004/09/21 18:46:04 sturm Exp $
Handle 16 bit depth BMP files and add some sanity checking.
--- xvbmp.c.orig Thu Sep 16 00:06:37 2004
+++ xvbmp.c Thu Sep 16 00:10:44 2004
@@ -18,7 +18,6 @@
not being able to malloc is a Fatal Error. The program is aborted. */
-
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
@@ -32,6 +31,7 @@
static int loadBMP1 PARM((FILE *, byte *, u_int, u_int));
static int loadBMP4 PARM((FILE *, byte *, u_int, u_int, u_int));
static int loadBMP8 PARM((FILE *, byte *, u_int, u_int, u_int));
+static int loadBMP16 PARM((FILE *, byte *, u_int, u_int));
static int loadBMP24 PARM((FILE *, byte *, u_int, u_int, u_int));
static u_int getshort PARM((FILE *));
static u_int getint PARM((FILE *));
@@ -128,8 +128,10 @@
/* error checking */
if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 &&
- biBitCount!=24 && biBitCount!=32) ||
- biPlanes!=1 || biCompression>BI_RLE4) {
+ biBitCount!= 16 && biBitCount!=24 && biBitCount!=32) ||
+ biPlanes!=1 || biCompression>BI_RLE4 ||
+ biWidth<=0 || biHeight<=0 ||
+ (biClrUsed && biClrUsed > (1 << biBitCount))) {
sprintf(buf,"Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)",
biBitCount, biPlanes, biCompression);
@@ -138,7 +140,7 @@
goto ERROR;
}
- if (((biBitCount==1 || biBitCount==24 || biBitCount==32)
+ if (((biBitCount==1 || biBitCount== 16 || biBitCount==24 || biBitCount==32)
&& biCompression != BI_RGB) ||
(biBitCount==4 && biCompression==BI_RLE8) ||
(biBitCount==8 && biCompression==BI_RLE4)) {
@@ -160,8 +162,11 @@
bPad = bfOffBits - (biSize + 14);
}
+ if (biClrUsed > (1 << biBitCount))
+ biClrUsed = (1 << biBitCount);
+
/* load up colormap, if any */
- if (biBitCount!=24 && biBitCount!=32) {
+ if (biBitCount!=16 && biBitCount!=24 && biBitCount!=32) {
int i, cmaplen;
cmaplen = (biClrUsed) ? biClrUsed : 1 << biBitCount;
@@ -199,7 +204,7 @@
/* create pic8 or pic24 */
- if (biBitCount==24 || biBitCount==32) {
+ if (biBitCount== 16 || biBitCount==24 || biBitCount==32) {
pic24 = (byte *) calloc((size_t) biWidth * biHeight * 3, (size_t) 1);
if (!pic24) return (bmpError(bname, "couldn't malloc 'pic24'"));
}
@@ -216,6 +221,7 @@
biCompression);
else if (biBitCount == 8) rv = loadBMP8(fp,pic8,biWidth,biHeight,
biCompression);
+ else if (biBitCount == 16) rv = loadBMP16(fp,pic24,biWidth,biHeight);
else rv = loadBMP24(fp,pic24,biWidth,biHeight,
biBitCount);
@@ -225,7 +231,7 @@
fclose(fp);
- if (biBitCount == 24 || biBitCount == 32) {
+ if (biBitCount == 16 || biBitCount == 24 || biBitCount == 32) {
pinfo->pic = pic24;
pinfo->type = PIC24;
}
@@ -458,6 +464,43 @@
}
+/*******************************************/
+static int loadBMP16(fp, pic24, w, h)
+ FILE *fp;
+ byte *pic24;
+ u_int w,h;
+{
+ int i,j,padb,rv;
+ byte *pp;
+
+ rv = 0;
+
+ padb = (4 - ((w*2) % 4)) & 0x03; /* # of pad bytes to read at EOscanline */
+
+ for (i=h-1; i>=0; i--) {
+ pp = pic24 + (i * w * 3);
+ if ((i&0x3f)==0) WaitCursor();
+
+ for (j=0; j<w; j++) {
+ byte byte1 = getc(fp);
+ byte byte2 = getc(fp);
+
+ /* 1 bit pad, 5 bits red, 5 bits green, 5 bits blue */
+
+ pp[0] = (byte2 & 0x7c) << 1;
+ pp[1] = ((byte2 & 0x03) << 6) | ((byte1 & 0xe0) >> 2); /* green */
+ pp[2] = (byte1 & 0x1f) << 3; /* blue */
+ pp += 3;
+ }
+
+ for (j=0; j<padb; j++) getc(fp);
+
+ rv = (FERROR(fp));
+ if (rv) break;
+ }
+
+ return rv;
+}
/*******************************************/
static int loadBMP24(fp, pic24, w, h, bits)

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-xvbrowse_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvbrowse.c.orig Tue Sep 21 06:49:17 2004
+++ xvbrowse.c Tue Sep 21 06:50:28 2004
@@ -959,6 +959,7 @@ static void setBrowStr(br, str)
char *str;
{
strncpy(br->dispstr, str, (size_t) 256);
+ br->dispstr[255] = '\0';
drawBrowStr(br);
XFlush(theDisp);
}
@@ -1493,6 +1494,7 @@ static void drawIcon(br, num)
if (StringWidth(str) > ISPACE_WIDE-6) {
int dotpos;
strncpy(tmpstr, str, (size_t) 56);
+ tmpstr[56] = '\0'; /* MR: otherwise it dies on long file names */
dotpos = strlen(tmpstr);
strcat(tmpstr,"...");

View File

@ -1,38 +0,0 @@
$OpenBSD: patch-xvdir_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvdir.c.orig Tue Sep 21 06:49:17 2004
+++ xvdir.c Tue Sep 21 06:50:28 2004
@@ -1213,6 +1213,7 @@ void SetDirFName(st)
char *st;
{
strncpy(deffname, st, (size_t) MAXFNLEN-1);
+ deffname[MAXFNLEN-1] = '\0';
setFName(st);
}
@@ -1620,13 +1621,14 @@ FILE *OpenOutFile(filename)
#else
strcpy(outFName, "[]xvXXXXXX.lis");
#endif
- mktemp(outFName);
+ fp = fdopen(mkstemp(outFName), "w");
dopipe = 1;
}
/* see if file exists (ie, we're overwriting) */
- if (stat(outFName, &st)==0) { /* stat succeeded, file must exist */
+ if (dopipe == 0 &&
+ stat(outFName, &st)==0) { /* stat succeeded, file must exist */
static char *foo[] = { "\nOk", "\033Cancel" };
char str[512];
@@ -1636,7 +1638,8 @@ FILE *OpenOutFile(filename)
/* Open file */
- fp = fopen(outFName, "w");
+ if (dopipe == 0)
+ fp = fopen(outFName, "w");
if (!fp) {
char str[512];
sprintf(str,"Can't write file '%s'\n\n %s.",outFName, ERRSTR(errno));

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-xvfits_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvfits.c.orig Wed Dec 28 08:43:29 1994
+++ xvfits.c Tue Sep 21 06:50:29 2004
@@ -235,7 +235,7 @@ static int splitfits(image, comment, nx,
sprintf(basename, "Sys$Disk:[]xvpgXXXXXX");
#endif
- mktemp(basename);
+ close(mkstemp(basename));
if (basename[0] == '\0') {
SetISTR(ISTR_WARNING, "%s", "Unable to build temporary filename");
return 1;

View File

@ -1,480 +0,0 @@
$OpenBSD: patch-xvimage_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvimage.c.orig Tue Sep 21 06:49:19 2004
+++ xvimage.c Tue Sep 21 06:50:28 2004
@@ -46,7 +46,275 @@ static int doPadPaste PARM((byte
static int ReadImageFile1 PARM((char *, PICINFO *));
+/* The following array represents the pixel values for each shade of
+ * the primary color components.
+ * If 'p' is a pointer to a source image rgb-byte-triplet, we can
+ * construct the output pixel value simply by 'oring' together
+ * the corresponding components:
+ *
+ * unsigned char *p;
+ * unsigned long pixval;
+ *
+ * pixval = screen_rgb[0][*p++];
+ * pixval |= screen_rgb[1][*p++];
+ * pixval |= screen_rgb[2][*p++];
+ *
+ * This is both efficient and generic, since the only assumption
+ * is that the primary color components have separate bits.
+ * The order and distribution of bits does not matter, and we
+ * don't need additional vaiables and shifting/masking code.
+ * The array size is 3 KBytes total and thus very reasonable.
+ */
+static unsigned long screen_rgb[3][256];
+
+/* The following array holds the exact color representations
+ * reported by the system.
+ * This is useful for less than 24 bit deep displays as a base
+ * for additional dithering to get smoother output.
+ */
+
+static byte screen_set[3][256];
+
+/* The following routine initializes the screen_rgb and screen_set
+ * arrays.
+ * Since it is executed only once per program run, it does not need
+ * to be super-efficient.
+ *
+ * The method is to draw points in a pixmap with the specified shades
+ * of primary colors and then get the corresponding XImage pixel
+ * representation.
+ * Thus we can get away with any Bit-order/Byte-Order dependencies.
+ *
+ * The routine uses some global X variables: theDisp, theScreen,
+ * and dispDEEP. Adapt these to your application as necessary.
+ * I've not passed them in as parameters, since for other platforms
+ * than X these may be different (see vfixpix.c), and so the
+ * screen_init() interface is unique.
+ *
+ * BUG: I've read in the "Xlib Programming Manual" from O'Reilly &
+ * Associates, that the DefaultColormap in TrueColor might not
+ * provide the full shade representation in XAllocColor.
+ * In this case one had to provide a 'best' colormap instead.
+ * However, my tests with Xaccel on a Linux-Box with a Mach64
+ * card were fully successful, so I leave that potential problem
+ * to you at the moment and would appreciate any suggestions...
+ */
+
+static void screen_init()
+{
+ static int init_flag; /* assume auto-init as 0 */
+ Pixmap check_map;
+ GC check_gc;
+ XColor check_col;
+ XImage *check_image;
+ int ci, i;
+
+ if (init_flag) return;
+ init_flag = 1;
+
+ check_map = XCreatePixmap(theDisp, RootWindow(theDisp,theScreen),
+ 1, 1, dispDEEP);
+ check_gc = XCreateGC(theDisp, RootWindow(theDisp,theScreen), 0, NULL);
+ for (ci = 0; ci < 3; ci++) {
+ for (i = 0; i < 256; i++) {
+ check_col.flags = DoRed | DoGreen | DoBlue;
+ check_col.red = 0;
+ check_col.green = 0;
+ check_col.blue = 0;
+ /* Do proper upscaling from unsigned 8 bit (image data values)
+ to unsigned 16 bit (X color representation). */
+ ((unsigned short *)&check_col.red)[ci] = (unsigned short)((i << 8) | i);
+ if (!XAllocColor(theDisp, DefaultColormap(theDisp,theScreen), &check_col))
+ FatalError("XAllocColor in screen_init() failed"); /* shouldn't happen */
+ screen_set[ci][i] =
+ (((unsigned short *)&check_col.red)[ci] >> 8) & 0xff;
+ XSetForeground(theDisp, check_gc, check_col.pixel);
+ XDrawPoint(theDisp, check_map, check_gc, 0, 0);
+ check_image = XGetImage(theDisp, check_map, 0, 0, 1, 1,
+ AllPlanes, ZPixmap);
+ if (!check_image) FatalError("XGetImage in screen_init() failed");
+ switch (check_image->bits_per_pixel) {
+ case 8:
+ screen_rgb[ci][i] = *(CARD8 *)check_image->data;
+ break;
+ case 16:
+ screen_rgb[ci][i] = *(CARD16 *)check_image->data;
+ break;
+ case 24:
+ screen_rgb[ci][i] =
+ ((unsigned long)*(CARD8 *)check_image->data << 16) |
+ ((unsigned long)*(CARD8 *)(check_image->data + 1) << 8) |
+ (unsigned long)*(CARD8 *)(check_image->data + 2);
+ break;
+ case 32:
+ screen_rgb[ci][i] = *(CARD32 *)check_image->data;
+ break;
+ }
+ XDestroyImage(check_image);
+ }
+ }
+ XFreeGC(theDisp, check_gc);
+ XFreePixmap(theDisp, check_map);
+}
+
+
+/* The following switch should better be provided at runtime for
+ * comparison purposes.
+ * At the moment it's only compile time, unfortunately.
+ * Who can make adaptions for use as a runtime switch by a menu option?
+ */
+
+#define DO_FIXPIX_SMOOTH
+
+#ifdef DO_FIXPIX_SMOOTH
+
+/* The following code is based in part on:
+ *
+ * jquant1.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains 1-pass color quantization (color mapping) routines.
+ * These routines provide mapping to a fixed color map using equally spaced
+ * color values. Optional Floyd-Steinberg or ordered dithering is available.
+ */
+
+/* Declarations for Floyd-Steinberg dithering.
+ *
+ * Errors are accumulated into the array fserrors[], at a resolution of
+ * 1/16th of a pixel count. The error at a given pixel is propagated
+ * to its not-yet-processed neighbors using the standard F-S fractions,
+ * ... (here) 7/16
+ * 3/16 5/16 1/16
+ * We work left-to-right on even rows, right-to-left on odd rows.
+ *
+ * We can get away with a single array (holding one row's worth of errors)
+ * by using it to store the current row's errors at pixel columns not yet
+ * processed, but the next row's errors at columns already processed. We
+ * need only a few extra variables to hold the errors immediately around the
+ * current column. (If we are lucky, those variables are in registers, but
+ * even if not, they're probably cheaper to access than array elements are.)
+ *
+ * The fserrors[] array is indexed [component#][position].
+ * We provide (#columns + 2) entries per component; the extra entry at each
+ * end saves us from special-casing the first and last pixels.
+ */
+
+typedef INT16 FSERROR; /* 16 bits should be enough */
+typedef int LOCFSERROR; /* use 'int' for calculation temps */
+
+typedef struct { byte *colorset;
+ FSERROR *fserrors;
+ } FSBUF;
+
+/* Floyd-Steinberg initialization function.
+ *
+ * It is called 'fs2_init' since it's specialized for our purpose and
+ * could be embedded in a more general FS-package.
+ *
+ * Returns a malloced FSBUF pointer which has to be passed as first
+ * parameter to subsequent 'fs2_dither' calls.
+ * The FSBUF structure does not need to be referenced by the calling
+ * application, it can be treated from the app like a void pointer.
+ *
+ * The current implementation does only require to free() this returned
+ * pointer after processing.
+ *
+ * Returns NULL if malloc fails.
+ *
+ * NOTE: The FSBUF structure is designed to allow the 'fs2_dither'
+ * function to work with an *arbitrary* number of color components
+ * at runtime! This is an enhancement over the IJG code base :-).
+ * Only fs2_init() specifies the (maximum) number of components.
+ */
+
+static FSBUF *fs2_init(width)
+int width;
+{
+ FSBUF *fs;
+ FSERROR *p;
+
+ fs = (FSBUF *)
+ malloc(sizeof(FSBUF) * 3 + ((size_t)width + 2) * sizeof(FSERROR) * 3);
+ if (fs == 0) return fs;
+
+ fs[0].colorset = screen_set[0];
+ fs[1].colorset = screen_set[1];
+ fs[2].colorset = screen_set[2];
+
+ p = (FSERROR *)(fs + 3);
+ memset(p, 0, ((size_t)width + 2) * sizeof(FSERROR) * 3);
+
+ fs[0].fserrors = p;
+ fs[1].fserrors = p + 1;
+ fs[2].fserrors = p + 2;
+
+ return fs;
+}
+
+/* Floyd-Steinberg dithering function.
+ *
+ * NOTE:
+ * (1) The image data referenced by 'ptr' is *overwritten* (input *and*
+ * output) to allow more efficient implementation.
+ * (2) Alternate FS dithering is provided by the sign of 'nc'. Pass in
+ * a negative value for right-to-left processing. The return value
+ * provides the right-signed value for subsequent calls!
+ * (3) This particular implementation assumes *no* padding between lines!
+ * Adapt this if necessary.
+ */
+
+static int fs2_dither(fs, ptr, nc, num_rows, num_cols)
+FSBUF *fs;
+byte *ptr;
+int nc, num_rows, num_cols;
+{
+ int abs_nc, ci, row, col;
+ LOCFSERROR delta, cur, belowerr, bpreverr;
+ byte *dataptr, *colsetptr;
+ FSERROR *errorptr;
+
+ if ((abs_nc = nc) < 0) abs_nc = -abs_nc;
+ for (row = 0; row < num_rows; row++) {
+ for (ci = 0; ci < abs_nc; ci++, ptr++) {
+ dataptr = ptr;
+ colsetptr = fs[ci].colorset;
+ errorptr = fs[ci].fserrors;
+ if (nc < 0) {
+ dataptr += (num_cols - 1) * abs_nc;
+ errorptr += (num_cols + 1) * abs_nc;
+ }
+ cur = belowerr = bpreverr = 0;
+ for (col = 0; col < num_cols; col++) {
+ cur += errorptr[nc];
+ cur += 8; cur >>= 4;
+ if ((cur += *dataptr) < 0) cur = 0;
+ else if (cur > 255) cur = 255;
+ *dataptr = cur & 0xff;
+ cur -= colsetptr[cur];
+ delta = cur << 1; cur += delta;
+ bpreverr += cur; cur += delta;
+ belowerr += cur; cur += delta;
+ errorptr[0] = (FSERROR)bpreverr;
+ bpreverr = belowerr;
+ belowerr = delta >> 1;
+ dataptr += nc;
+ errorptr += nc;
+ }
+ errorptr[0] = (FSERROR)bpreverr;
+ }
+ ptr += (num_cols - 1) * abs_nc;
+ nc = -nc;
+ }
+ return nc;
+}
+
+#endif /* DO_FIXPIX_SMOOTH */
+
+
#define DO_CROP 0
#define DO_ZOOM 1
@@ -1885,33 +2153,17 @@ XImage *Pic24ToXImage(pic24, wide, high)
/* Non-ColorMapped Visuals: TrueColor, DirectColor */
/************************************************************************/
- unsigned long r, g, b, rmask, gmask, bmask, xcol;
- int rshift, gshift, bshift, bperpix, bperline, border, cshift;
- int maplen;
+ unsigned long xcol;
+ int bperpix, bperline;
byte *imagedata, *lip, *ip, *pp;
- /* compute various shifting constants that we'll need... */
-
- rmask = theVisual->red_mask;
- gmask = theVisual->green_mask;
- bmask = theVisual->blue_mask;
-
- rshift = 7 - highbit(rmask);
- gshift = 7 - highbit(gmask);
- bshift = 7 - highbit(bmask);
-
- maplen = theVisual->map_entries;
- if (maplen>256) maplen=256;
- cshift = 7 - highbit((u_long) (maplen-1));
-
xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0, NULL,
wide, high, 32, 0);
if (!xim) FatalError("couldn't create X image!");
bperline = xim->bytes_per_line;
bperpix = xim->bits_per_pixel;
- border = xim->byte_order;
imagedata = (byte *) malloc((size_t) (high * bperline));
if (!imagedata) FatalError("couldn't malloc imagedata");
@@ -1925,82 +2177,87 @@ XImage *Pic24ToXImage(pic24, wide, high)
FatalError(buf);
}
+ screen_init();
- lip = imagedata; pp = pic24;
- for (i=0; i<high; i++, lip+=bperline) {
- for (j=0, ip=lip; j<wide; j++) {
- r = *pp++; g = *pp++; b = *pp++;
+#ifdef DO_FIXPIX_SMOOTH
+#if 0
+ /* If we wouldn't have to save the original pic24 image data,
+ * the following code would do the dither job by overwriting
+ * the image data, and the normal render code would then work
+ * without any change on that data.
+ * Unfortunately, this approach would hurt the xv assumptions...
+ */
+ if (bperpix < 24) {
+ FSBUF *fs = fs2_init(wide);
+ if (fs) {
+ fs2_dither(fs, pic24, 3, high, wide);
+ free(fs);
+ }
+ }
+#else
+ /* ...so we have to take a different approach with linewise
+ * dithering/rendering in a loop using a temporary line buffer.
+ */
+ if (bperpix < 24) {
+ int alldone = 0;
+ FSBUF *fs = fs2_init(wide);
+ if (fs) {
+ byte *row_buf = malloc((size_t)wide * 3);
+ if (row_buf) {
+ int nc = 3;
+ byte *picp = pic24; lip = imagedata;
+ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
+ memcpy(row_buf, picp, (size_t)wide * 3);
+ nc = fs2_dither(fs, row_buf, nc, 1, wide);
+ for (j=0, ip=lip, pp=row_buf; j<wide; j++) {
- /* shift r,g,b so that high bit of 8-bit color specification is
- * aligned with high bit of r,g,b-mask in visual,
- * AND each component with its mask,
- * and OR the three components together
- */
+ xcol = screen_rgb[0][*pp++];
+ xcol |= screen_rgb[1][*pp++];
+ xcol |= screen_rgb[2][*pp++];
- if (theVisual->class == DirectColor) {
- r = (u_long) directConv[(r>>cshift) & 0xff] << cshift;
- g = (u_long) directConv[(g>>cshift) & 0xff] << cshift;
- b = (u_long) directConv[(b>>cshift) & 0xff] << cshift;
- }
-
-
- /* shift the bits around */
- if (rshift<0) r = r << (-rshift);
- else r = r >> rshift;
-
- if (gshift<0) g = g << (-gshift);
- else g = g >> gshift;
-
- if (bshift<0) b = b << (-bshift);
- else b = b >> bshift;
-
- r = r & rmask;
- g = g & gmask;
- b = b & bmask;
-
- xcol = r | g | b;
-
- if (bperpix == 32) {
- if (border == MSBFirst) {
- *ip++ = (xcol>>24) & 0xff;
- *ip++ = (xcol>>16) & 0xff;
- *ip++ = (xcol>>8) & 0xff;
- *ip++ = xcol & 0xff;
+ switch (bperpix) {
+ case 8:
+ *ip++ = xcol & 0xff;
+ break;
+ case 16:
+ *((CARD16 *)ip)++ = (CARD16)xcol;
+ break;
+ }
+ }
}
- else { /* LSBFirst */
- *ip++ = xcol & 0xff;
- *ip++ = (xcol>>8) & 0xff;
- *ip++ = (xcol>>16) & 0xff;
- *ip++ = (xcol>>24) & 0xff;
- }
+ alldone = 1;
+ free(row_buf);
}
+ free(fs);
+ }
+ if (alldone) return xim;
+ }
+#endif
+#endif
- else if (bperpix == 24) {
- if (border == MSBFirst) {
- *ip++ = (xcol>>16) & 0xff;
- *ip++ = (xcol>>8) & 0xff;
- *ip++ = xcol & 0xff;
- }
- else { /* LSBFirst */
- *ip++ = xcol & 0xff;
- *ip++ = (xcol>>8) & 0xff;
- *ip++ = (xcol>>16) & 0xff;
- }
- }
+ lip = imagedata; pp = pic24;
+ for (i=0; i<high; i++, lip+=bperline) {
+ for (j=0, ip=lip; j<wide; j++) {
- else if (bperpix == 16) {
- if (border == MSBFirst) {
- *ip++ = (xcol>>8) & 0xff;
- *ip++ = xcol & 0xff;
- }
- else { /* LSBFirst */
- *ip++ = xcol & 0xff;
- *ip++ = (xcol>>8) & 0xff;
- }
- }
+ xcol = screen_rgb[0][*pp++];
+ xcol |= screen_rgb[1][*pp++];
+ xcol |= screen_rgb[2][*pp++];
- else if (bperpix == 8) {
- *ip++ = xcol & 0xff;
+ switch (bperpix) {
+ case 8:
+ *ip++ = xcol & 0xff;
+ break;
+ case 16:
+ *((CARD16 *)ip)++ = (CARD16)xcol;
+ break;
+ case 24:
+ *ip++ = (xcol >> 16) & 0xff;
+ *ip++ = (xcol >> 8) & 0xff;
+ *ip++ = xcol & 0xff;
+ break;
+ case 32:
+ *((CARD32 *)ip)++ = (CARD32)xcol;
+ break;
}
}
}
@@ -2699,7 +2956,7 @@ static int doPadBggen(str, wide, high, o
#else
strcpy(fname, "Sys$Disk:[]xvuXXXXXX");
#endif
- mktemp(fname);
+ close(mkstemp(fname));
/* run bggen to generate the background */
sprintf(syscmd, "bggen -g %dx%d %s > %s", wide, high, str, fname);

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-xviris_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
Add some sanity checking in RLE decoding.
--- xviris.c.orig Thu Sep 16 00:21:14 2004
+++ xviris.c Thu Sep 16 00:22:43 2004
@@ -267,6 +267,12 @@ static byte *getimagedata(fp, img)
rlebuflen = 2 * xsize + 10;
tablen = ysize * zsize;
+
+ if (rlebuflen < 0 || tablen < 0 || (tablen * sizeof(long)) < 0) {
+ loaderr = "Bogus IRIS File!";
+ return (byte *)NULL;
+ }
+
starttab = (u_long *) malloc((size_t) tablen * sizeof(long));
lengthtab = (u_long *) malloc((size_t) tablen * sizeof(long));
rledat = (byte *) malloc((size_t) rlebuflen);

View File

@ -1,47 +0,0 @@
--- xvmisc.c.orig Tue Sep 21 06:49:20 2004
+++ xvmisc.c Tue Sep 21 06:50:27 2004
@@ -99,10 +99,18 @@ unsigned long fg, bg;
if (!usesize || !(i&WidthValue)) w = defw;
if (!usesize || !(i&HeightValue)) h = defh;
- hints.flags |= USSize;
+ hints.flags |= USSize | PWinGravity;
- if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
- if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
+ hints.win_gravity = NorthWestGravity;
+ if (i&XValue && i&XNegative) {
+ hints.win_gravity = NorthEastGravity;
+ x = dispWIDE - (w + 2 * bwidth) - abs(x);
+ }
+ if (i&YValue && i&YNegative) {
+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
+ SouthWestGravity : SouthEastGravity;
+ y = dispHIGH - (h + 2 * bwidth) - abs(y);
+ }
#define VROOT_TRANS
@@ -138,19 +146,18 @@ unsigned long fg, bg;
if (!win) return(win); /* leave immediately if couldn't create */
- XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
-
xwmh.input = True;
xwmh.flags = InputHint;
if (iconPix) { xwmh.icon_pixmap = iconPix; xwmh.flags |= IconPixmapHint; }
- XSetWMHints(theDisp, win, &xwmh);
if (clname && strlen(clname)) {
classh.res_name = "xv";
classh.res_class = clname;
- XSetClassHint(theDisp, win, &classh);
StoreDeleteWindowProp(win);
}
+
+ XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
+ clname ? &classh : NULL);
return(win);
}

View File

@ -1,65 +0,0 @@
$OpenBSD: patch-xvpcx_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
Add some sanity checking.
--- xvpcx.c.orig Thu Sep 16 00:24:40 2004
+++ xvpcx.c Thu Sep 16 00:30:36 2004
@@ -222,7 +222,14 @@ static int pcxLoadImage8(fname, fp, pinf
byte *image;
/* note: overallocation to make life easier... */
- image = (byte *) malloc((size_t) (pinfo->h + 1) * pinfo->w + 16);
+ int count = (pinfo->h + 1) * pinfo->w + 16;
+
+ if (count <= 0 || pinfo->h <= 0 || pinfo->w <= 0) {
+ pcxError(fname, "Bogus PCX file!!");
+ return (0);
+ }
+
+ image = (byte *) malloc((size_t) count);
if (!image) FatalError("Can't alloc 'image' in pcxLoadImage8()");
xvbzero((char *) image, (size_t) ((pinfo->h+1) * pinfo->w + 16));
@@ -250,24 +257,38 @@ static int pcxLoadImage24(fname, fp, pin
{
byte *pix, *pic24, scale[256];
int c, i, j, w, h, maxv, cnt, planes, bperlin, nbytes;
+ int count;
w = pinfo->w; h = pinfo->h;
planes = (int) hdr[PCX_PLANES];
bperlin = hdr[PCX_BPRL] + ((int) hdr[PCX_BPRH]<<8);
-
+
+ count = w*h*planes;
+
+ if (count <= 0 || planes <= 0 || w <= 0 || h <= 0) {
+ pcxError(fname, "Bogus PCX file!!");
+ return (0);
+ }
+
/* allocate 24-bit image */
- pic24 = (byte *) malloc((size_t) w*h*planes);
+ pic24 = (byte *) malloc((size_t) count);
if (!pic24) FatalError("couldn't malloc 'pic24'");
- xvbzero((char *) pic24, (size_t) w*h*planes);
+ xvbzero((char *) pic24, (size_t) count);
maxv = 0;
pix = pinfo->pic = pic24;
i = 0; /* planes, in this while loop */
j = 0; /* bytes per line, in this while loop */
nbytes = bperlin*h*planes;
-
+
+ if (nbytes < 0) {
+ pcxError(fname, "Bogus PCX file!!");
+ free(pic24);
+ return (0);
+ }
+
while (nbytes > 0 && (c = getc(fp)) != EOF) {
if ((c & 0xC0) == 0xC0) { /* have a rep. count */
cnt = c & 0x3F;

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-xvpds_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvpds.c.orig Tue Jan 3 22:25:52 1995
+++ xvpds.c Tue Sep 21 06:50:28 2004
@@ -689,7 +689,7 @@ int LoadPDS(fname, pinfo)
#ifndef VMS
sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
- mktemp(pdsuncompfname);
+ close(mkstemp(pdsuncompfname));
sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
#else
strcpy(pdsuncompfname,"sys$disk:[]xvhuffXXXXXX");

View File

@ -1,45 +0,0 @@
$OpenBSD: patch-xvpm_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
Add some sanity checking.
--- xvpm.c.orig Thu Sep 16 00:32:09 2004
+++ xvpm.c Thu Sep 16 00:35:29 2004
@@ -119,6 +119,9 @@ int LoadPM(fname, pinfo)
isize = pm_isize(&thePic);
+ if (isize <= 0)
+ return pmError(bname, "Bogus PM file!!");
+
if (DEBUG)
fprintf(stderr,"%s: LoadPM() - loading a %dx%d %s pic, %d planes\n",
cmd, w, h, (thePic.pm_form==PM_I) ? "PM_I" : "PM_C",
@@ -135,6 +138,8 @@ int LoadPM(fname, pinfo)
return( pmError(bname, "file read error") );
}
+ if (thePic.pm_cmtsize+1 <= 0)
+ return pmError(bname, "Bogus PM file!!");
/* alloc and read in comment, if any */
if (thePic.pm_cmtsize>0) {
@@ -155,6 +160,9 @@ int LoadPM(fname, pinfo)
int *intptr;
byte *pic24, *picptr;
+ if (w*h*3 <= 0)
+ return pmError(bname, "Bogus PM file!!");
+
if ((pic24 = (byte *) malloc((size_t) w*h*3))==NULL) {
if (thePic.pm_cmt) free(thePic.pm_cmt);
return( pmError(bname, "unable to malloc 24-bit picture") );
@@ -189,6 +197,9 @@ int LoadPM(fname, pinfo)
else if (thePic.pm_form == PM_C && thePic.pm_np>1) {
byte *pic24, *picptr, *rptr, *gptr, *bptr;
+
+ if (w*h*3 <= 0)
+ return pmError(bname, "Bogus PM file!!");
if ((pic24 = (byte *) malloc((size_t) w*h*3))==NULL) {
if (thePic.pm_cmt) free(thePic.pm_cmt);

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-xvpopup_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvpopup.c.orig Tue Sep 21 06:49:18 2004
+++ xvpopup.c Tue Sep 21 06:50:28 2004
@@ -560,6 +560,7 @@ static void build1PadList(typstr, vals,
nams[*lenp] = (char *) malloc((size_t) 32);
if (!nams[*lenp]) { free(vals[*lenp]); continue; }
strncpy(nams[*lenp], vals[*lenp], (size_t) 31);
+ nams[*lenp][31] = '\0';
}
if (strlen(nams[*lenp]) > (size_t) 20) { /* fix long names */

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-xvps_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvps.c.orig Tue Sep 21 06:49:19 2004
+++ xvps.c Tue Sep 21 06:50:28 2004
@@ -1552,7 +1552,7 @@ int LoadPS(fname, pinfo, quick)
sprintf(tmpname, "Sys$Scratch:xvpgXXXXXX");
#endif
- mktemp(tmpname);
+ close(mkstemp(tmpname));
if (tmpname[0] == '\0') { /* mktemp() blew up */
sprintf(str,"LoadPS: Unable to create temporary filename???");
ErrPopUp(str, "\nHow unlikely!");

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-xvtext_c,v 1.1 2004/09/21 18:46:04 sturm Exp $
--- xvtext.c.orig Sat Jan 14 00:46:28 1995
+++ xvtext.c Tue Sep 21 06:50:28 2004
@@ -293,6 +293,7 @@ void OpenTextView(text, len, title, free
tv->textlen = len;
tv->freeonclose = freeonclose;
strncpy(tv->title, title, (size_t) TITLELEN-1);
+ tv->title[TITLELEN-1] = '\0';
computeText(tv); /* compute # lines and linestarts array */