Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: Bugs in XFetchBytes/XStoreBytes Message-ID: <8912020014.AA09720@Larry.McRCIM.McGill.EDU> Date: 2 Dec 89 00:14:36 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 27 > Here is a sketch of what XStoreBytes ought to look like: Not to get overly pedantic, but.... (severely edited down) > char *x; > x = /*** source location ***/ ; > while (l > 0) { > x += maxxfer; > } ...the x += maxxfer may cause undefined behavior. Addresses outside of arrays do not have to be even computable (except for the special case of one beyond the last element). Therefore, if the array supplied by the user does not extend far enough past the last element to be sent, this may coredump (or worse), because the addition will generate a pointer outside the array. To be sure, this isn't a problem on sane machines, but not all machines are sane, and X is supposed to be excessively portable. (I must admit, Fred did call this a "sketch".) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu