diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:26:33 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:26:33 +0000 |
commit | e9582134862ee8ba07d6c9ced4d233a252b5df39 (patch) | |
tree | 64b238d2517d822416383c6cefbaa56b078e3453 | |
parent | 73b64a056a56cd713af172ef7adc2a5e63909784 (diff) |
merge with XORG-RELEASE-1 (tag XORG-CYGWIN-LAST-MERGE)CYGWIN-RELEASE-1-MERGE
-rw-r--r-- | include/X11/fonts/FSlib.h | 2 | ||||
-rw-r--r-- | src/FSClServ.c | 2 | ||||
-rw-r--r-- | src/FSConnServ.c | 2 | ||||
-rw-r--r-- | src/FSErrHndlr.c | 2 | ||||
-rw-r--r-- | src/FSFontInfo.c | 4 | ||||
-rw-r--r-- | src/FSFtNames.c | 10 | ||||
-rw-r--r-- | src/FSGetCats.c | 10 | ||||
-rw-r--r-- | src/FSListCats.c | 10 | ||||
-rw-r--r-- | src/FSListExt.c | 10 | ||||
-rw-r--r-- | src/FSOpenFont.c | 4 | ||||
-rw-r--r-- | src/FSOpenServ.c | 15 | ||||
-rw-r--r-- | src/FSQGlyphs.c | 18 | ||||
-rw-r--r-- | src/FSQXExt.c | 6 | ||||
-rw-r--r-- | src/FSQXInfo.c | 4 | ||||
-rw-r--r-- | src/FSServName.c | 2 | ||||
-rw-r--r-- | src/FSSetCats.c | 2 | ||||
-rw-r--r-- | src/FSSynchro.c | 2 | ||||
-rw-r--r-- | src/FSlibInt.c | 2 | ||||
-rw-r--r-- | src/FSlibint.h | 2 | ||||
-rw-r--r-- | src/FSlibos.h | 5 |
20 files changed, 80 insertions, 34 deletions
diff --git a/include/X11/fonts/FSlib.h b/include/X11/fonts/FSlib.h index 50bdbbe..c2719f8 100644 --- a/include/X11/fonts/FSlib.h +++ b/include/X11/fonts/FSlib.h @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSlib.h,v 1.7 2001/12/19 21:37:29 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSlib.h,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ /* diff --git a/src/FSClServ.c b/src/FSClServ.c index e5a36a3..704eaac 100644 --- a/src/FSClServ.c +++ b/src/FSClServ.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSClServ.c,v 1.5 2001/12/14 19:53:32 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSClServ.c,v 1.4 2001/01/17 19:41:27 dawes Exp $ */ /* diff --git a/src/FSConnServ.c b/src/FSConnServ.c index 8de4f2e..6d66dbe 100644 --- a/src/FSConnServ.c +++ b/src/FSConnServ.c @@ -50,7 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/FS/FSConnServ.c,v 3.11 2001/12/14 19:53:32 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSConnServ.c,v 3.10 2001/10/28 03:32:27 tsi Exp $ */ #include <stdio.h> #include "FSlibint.h" diff --git a/src/FSErrHndlr.c b/src/FSErrHndlr.c index 40fcccd..2440c4f 100644 --- a/src/FSErrHndlr.c +++ b/src/FSErrHndlr.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSErrHndlr.c,v 1.5 2001/12/14 19:53:32 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSErrHndlr.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* diff --git a/src/FSFontInfo.c b/src/FSFontInfo.c index f27b190..233453a 100644 --- a/src/FSFontInfo.c +++ b/src/FSFontInfo.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFontInfo.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSFontInfo.c,v 1.5tsi Exp $ */ /* @@ -244,8 +244,10 @@ FSListFontsWithXInfo(svr, pattern, maxNames, count, info, pprops, offsets, prop_ pi[i]->num_offsets = local_pi.num_offsets; pi[i]->data_len = local_pi.data_len; +#if SIZE_MAX <= UINT_MAX if (pi[i]->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) goto badmem; +#endif po[i] = (FSPropOffset *) FSmalloc(pi[i]->num_offsets * sizeof(FSPropOffset)); diff --git a/src/FSFtNames.c b/src/FSFtNames.c index 7460d9c..d657181 100644 --- a/src/FSFtNames.c +++ b/src/FSFtNames.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFtNames.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSFtNames.c,v 1.6tsi Exp $ */ /* @@ -78,8 +78,12 @@ FSListFonts(svr, pattern, maxNames, actualCount) (SIZEOF(fsListFontsReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return (char **) 0; - if (rep.nFonts && rep.nFonts <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX >> 2)) { + if (rep.nFonts +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.nFonts <= SIZE_MAX / sizeof(char *) + && rep.length <= (SIZE_MAX >> 2) +#endif + ) { flist = (char **) FSmalloc((unsigned) rep.nFonts * sizeof(char *)); rlen = (rep.length << 2) - SIZEOF(fsListFontsReply); c = (char *) FSmalloc((unsigned) (rlen + 1)); diff --git a/src/FSGetCats.c b/src/FSGetCats.c index a80054d..99f931f 100644 --- a/src/FSGetCats.c +++ b/src/FSGetCats.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSGetCats.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSGetCats.c,v 1.6tsi Exp $ */ /* @@ -72,8 +72,12 @@ FSGetCatalogues(svr, num) SyncHandle(); return (char **) NULL; } - if (rep.num_catalogues && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX >> 2)) { + if (rep.num_catalogues +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.num_catalogues <= SIZE_MAX/sizeof(char *) + && rep.length <= (SIZE_MAX >> 2) +#endif + ) { list = (char **) FSmalloc((unsigned) (rep.num_catalogues * sizeof(char *))); rlen = (rep.length << 2) - SIZEOF(fsGetCataloguesReply); diff --git a/src/FSListCats.c b/src/FSListCats.c index dce37e5..4ab3d20 100644 --- a/src/FSListCats.c +++ b/src/FSListCats.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListCats.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSListCats.c,v 1.6tsi Exp $ */ /* @@ -78,8 +78,12 @@ FSListCatalogues(svr, pattern, maxNames, actualCount) (SIZEOF(fsListCataloguesReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return (char **) 0; - if (rep.num_catalogues && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX>>2)) { + if (rep.num_catalogues +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.num_catalogues <= SIZE_MAX/sizeof(char *) + && rep.length <= (SIZE_MAX>>2) +#endif + ) { clist = (char **) FSmalloc((unsigned) rep.num_catalogues * sizeof(char *)); rlen = (rep.length << 2) - SIZEOF(fsListCataloguesReply); diff --git a/src/FSListExt.c b/src/FSListExt.c index ee87a1c..31ca9ed 100644 --- a/src/FSListExt.c +++ b/src/FSListExt.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListExt.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSListExt.c,v 1.6tsi Exp $ */ /* @@ -73,8 +73,12 @@ FSListExtensions(svr, next) SyncHandle(); return (char **) NULL; } - if (rep.nExtensions && rep.nExtensions <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX>>2)) { + if (rep.nExtensions +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.nExtensions <= SIZE_MAX / sizeof(char *) + && rep.length <= (SIZE_MAX>>2) +#endif + ) { list = (char **) FSmalloc((unsigned)(rep.nExtensions * sizeof(char *))); rlen = (rep.length << 2) - SIZEOF(fsListExtensionsReply); c = (char *) FSmalloc((unsigned) rlen + 1); diff --git a/src/FSOpenFont.c b/src/FSOpenFont.c index 8c137d7..4badef7 100644 --- a/src/FSOpenFont.c +++ b/src/FSOpenFont.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.6tsi Exp $ */ /* @@ -62,7 +62,7 @@ FSOpenBitmapFont(svr, hint, fmask, name, otherid) char *name; Font *otherid; { - unsigned char nbytes; + unsigned int nbytes; fsOpenBitmapFontReq *req; fsOpenBitmapFontReply reply; Font fid; diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c index a992a65..8a3a103 100644 --- a/src/FSOpenServ.c +++ b/src/FSOpenServ.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSOpenServ.c,v 1.8 2003/09/01 20:50:09 herrb Exp $ */ +/* $XFree86: xc/lib/FS/FSOpenServ.c,v 1.8tsi Exp $ */ /* @@ -163,14 +163,20 @@ FSOpenServer(server) _FSRead(svr, (char *) alt_data, setuplength); ad = alt_data; +#if SIZE_MAX <= UINT_MAX if (prefix.num_alternates > SIZE_MAX / sizeof(AlternateServer)) { errno = ENOMEM; + FSfree((char *) alt_data); + FSfree((char *) svr); return (FSServer *) 0; } +#endif + alts = (AlternateServer *) FSmalloc(sizeof(AlternateServer) * prefix.num_alternates); if (!alts) { errno = ENOMEM; + FSfree((char *) alt_data); FSfree((char *) svr); return (FSServer *) 0; } @@ -198,10 +204,11 @@ FSOpenServer(server) svr->num_alternates = prefix.num_alternates; setuplength = prefix.auth_len << 2; - if (prefix.auth_len > (SIZE_MAX>>2) + if (setuplength > (SIZE_MAX>>2) || (auth_data = (char *) (setup = FSmalloc((unsigned) setuplength))) == NULL) { errno = ENOMEM; + FSfree((char *) alts); FSfree((char *) svr); return (FSServer *) NULL; } @@ -210,6 +217,7 @@ FSOpenServer(server) if (prefix.status != AuthSuccess) { fprintf(stderr, "%s: connection to \"%s\" refused by server\r\n%s: ", "FSlib", server, "FSlib"); + FSfree((char *) alts); FSfree((char *) svr); FSfree(setup); return (FSServer *) NULL; @@ -220,6 +228,8 @@ FSOpenServer(server) if ((vendor_string = (char *) FSmalloc((unsigned) conn.vendor_len + 1)) == NULL) { errno = ENOMEM; + FSfree((char *) auth_data); + FSfree((char *) alts); FSfree((char *) svr); return (FSServer *) NULL; } @@ -276,4 +286,3 @@ FSOpenServer(server) return (svr); } - diff --git a/src/FSQGlyphs.c b/src/FSQGlyphs.c index b13bdde..ab1cb75 100644 --- a/src/FSQGlyphs.c +++ b/src/FSQGlyphs.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQGlyphs.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSQGlyphs.c,v 1.5tsi Exp $ */ /* @@ -85,20 +85,24 @@ FSQueryXBitmaps8(svr, fid, format, range_type, str, str_len, offsets, glyphdata) (SIZEOF(fsQueryXBitmaps8Reply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_chars > SIZE_MAX / sizeof(FSOffset)) return FSBadAlloc; +#endif offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); *offsets = offs; if (!offs) return FSBadAlloc; - left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps8Reply) - - (SIZEOF(fsOffset32) * reply.num_chars); +#if (SIZE_MAX >> 2) <= UINT_MAX /* XXX This thest is incomplete */ if (reply.length > (SIZE_MAX >> 2)) { FSfree((char *) offs); return FSBadAlloc; } +#endif + left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps8Reply) + - (SIZEOF(fsOffset32) * reply.num_chars); gd = (unsigned char *) FSmalloc(left); *glyphdata = gd; if (!gd) { @@ -170,19 +174,23 @@ FSQueryXBitmaps16(svr, fid, format, range_type, str, str_len, fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if(reply.num_chars > SIZE_MAX/sizeof(FSOffset)) return FSBadAlloc; +#endif offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); *offsets = offs; if (!offs) return FSBadAlloc; - left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps16Reply) - - (SIZEOF(fsOffset32) * reply.num_chars); +#if (SIZE_MAX >> 2) <= UINT_MAX /* XXX - this test is incomplete */ if (reply.length > (SIZE_MAX>>2)) { FSfree((char *) offs); return FSBadAlloc; } +#endif + left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps16Reply) + - (SIZEOF(fsOffset32) * reply.num_chars); gd = (unsigned char *) FSmalloc(left); *glyphdata = gd; if (!gd) { diff --git a/src/FSQXExt.c b/src/FSQXExt.c index d288acd..38f1095 100644 --- a/src/FSQXExt.c +++ b/src/FSQXExt.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.7 2003/09/01 20:50:09 herrb Exp $ */ +/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.7tsi Exp $ */ /* @@ -93,8 +93,10 @@ FSQueryXExtents8(svr, fid, range_type, str, str_len, extents) fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_extents > SIZE_MAX / sizeof(FSXCharInfo)) return FSBadAlloc; +#endif ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents); *extents = ext; @@ -152,8 +154,10 @@ FSQueryXExtents16(svr, fid, range_type, str, str_len, extents) fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_extents > SIZE_MAX/sizeof(FSXCharInfo)) return FSBadAlloc; +#endif ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents); *extents = ext; diff --git a/src/FSQXInfo.c b/src/FSQXInfo.c index 3ee3449..90ae387 100644 --- a/src/FSQXInfo.c +++ b/src/FSQXInfo.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXInfo.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSQXInfo.c,v 1.5tsi Exp $ */ /* @@ -91,8 +91,10 @@ FSQueryXInfo(svr, fid, info, props, offsets, prop_data) props->num_offsets = local_pi.num_offsets; props->data_len = local_pi.data_len; +#if SIZE_MAX <= UINT_MAX if (props->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) return FSBadAlloc; +#endif /* prepare for prop data */ offset_data = (FSPropOffset *) diff --git a/src/FSServName.c b/src/FSServName.c index 43f806d..f9fa3ea 100644 --- a/src/FSServName.c +++ b/src/FSServName.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSServName.c,v 1.4 2001/12/14 19:53:33 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSServName.c,v 1.3 2001/07/29 05:01:11 tsi Exp $ */ /* diff --git a/src/FSSetCats.c b/src/FSSetCats.c index e73133f..5136478 100644 --- a/src/FSSetCats.c +++ b/src/FSSetCats.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSSetCats.c,v 1.5 2001/12/14 19:53:33 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSSetCats.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* diff --git a/src/FSSynchro.c b/src/FSSynchro.c index 884cfd3..2520971 100644 --- a/src/FSSynchro.c +++ b/src/FSSynchro.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSSynchro.c,v 1.5 2001/12/14 19:53:33 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSSynchro.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* diff --git a/src/FSlibInt.c b/src/FSlibInt.c index bf63794..70167bd 100644 --- a/src/FSlibInt.c +++ b/src/FSlibInt.c @@ -50,7 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/FS/FSlibInt.c,v 3.11 2003/05/23 14:38:26 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSlibInt.c,v 3.10tsi Exp $ */ /* * FSlibInt.c - Internal support routines for the C subroutine diff --git a/src/FSlibint.h b/src/FSlibint.h index 18d0d24..3299acf 100644 --- a/src/FSlibint.h +++ b/src/FSlibint.h @@ -50,7 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/FS/FSlibint.h,v 3.9 2003/09/01 20:50:09 herrb Exp $ */ +/* $XFree86: xc/lib/FS/FSlibint.h,v 3.8 2003/08/29 18:01:12 herrb Exp $ */ /* * FSlib internal decls diff --git a/src/FSlibos.h b/src/FSlibos.h index 5e4fe92..a947ae4 100644 --- a/src/FSlibos.h +++ b/src/FSlibos.h @@ -1,3 +1,4 @@ +/* $XdotOrg: xc/lib/FS/FSlibos.h,v 1.1.4.3.4.1 2004/03/04 17:46:25 eich Exp $ */ /* $Xorg: FSlibos.h,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* @(#)FSlibos.h 4.1 91/05/02 @@ -61,6 +62,10 @@ in this Software without prior written authorization from The Open Group. #ifndef WIN32 +#if defined(SCO) || defined(__USLC__) +#include <stdint.h> /* For SIZE_MAX */ +#endif + /* * makedepend screws up on #undef OPEN_MAX, so we define a new symbol */ |