~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/fb/fbsetsp.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Id: fbsetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
 
3
 *
 
4
 * Copyright � 1998 Keith Packard
 
5
 *
 
6
 * Permission to use, copy, modify, distribute, and sell this software and its
 
7
 * documentation for any purpose is hereby granted without fee, provided that
 
8
 * the above copyright notice appear in all copies and that both that
 
9
 * copyright notice and this permission notice appear in supporting
 
10
 * documentation, and that the name of Keith Packard not be used in
 
11
 * advertising or publicity pertaining to distribution of the software without
 
12
 * specific, written prior permission.  Keith Packard makes no
 
13
 * representations about the suitability of this software for any purpose.  It
 
14
 * is provided "as is" without express or implied warranty.
 
15
 *
 
16
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
18
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
19
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
20
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
21
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
22
 * PERFORMANCE OF THIS SOFTWARE.
 
23
 */
 
24
/* $XFree86: xc/programs/Xserver/fb/fbsetsp.c,v 1.5 2001/05/29 04:54:09 keithp Exp $ */
 
25
 
 
26
#include "fb.h"
 
27
 
 
28
void
 
29
fbSetSpans (DrawablePtr     pDrawable,
 
30
            GCPtr           pGC,
 
31
            char            *src,
 
32
            DDXPointPtr     ppt,
 
33
            int             *pwidth,
 
34
            int             nspans,
 
35
            int             fSorted)
 
36
{
 
37
    FbGCPrivPtr     pPriv = fbGetGCPrivate (pGC);
 
38
    RegionPtr       pClip = fbGetCompositeClip(pGC);
 
39
    FbBits          *dst, *d, *s;
 
40
    FbStride        dstStride;
 
41
    int             dstBpp;
 
42
    int             dstXoff, dstYoff;
 
43
    BoxPtr          pbox;
 
44
    int             n;
 
45
    int             xoff;
 
46
    int             x1, x2;
 
47
    
 
48
#ifdef FB_24_32BIT
 
49
    if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
 
50
    {
 
51
        fb24_32SetSpans (pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
 
52
        return;
 
53
    }
 
54
#endif
 
55
    fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 
56
    while (nspans--)
 
57
    {
 
58
        d = dst + (ppt->y + dstYoff) * dstStride;
 
59
        xoff = (int) (((long) src) & (FB_MASK >> 3));
 
60
        s = (FbBits *) (src - xoff);
 
61
        xoff <<= 3;
 
62
        n = REGION_NUM_RECTS(pClip);
 
63
        pbox = REGION_RECTS (pClip);
 
64
        while (n--)
 
65
        {
 
66
            if (pbox->y1 > ppt->y)
 
67
                break;
 
68
            if (pbox->y2 > ppt->y)
 
69
            {
 
70
                x1 = ppt->x;
 
71
                x2 = x1 + *pwidth;
 
72
                if (pbox->x1 > x1)
 
73
                    x1 = pbox->x1;
 
74
                if (pbox->x2 < x2)
 
75
                    x2 = pbox->x2;
 
76
                if (x1 < x2)
 
77
                    fbBlt ((FbBits *) s,
 
78
                           0,
 
79
                           (x1 - ppt->x) * dstBpp + xoff,
 
80
                           d,
 
81
                           dstStride,
 
82
                           (x1 + dstXoff) * dstBpp,
 
83
 
 
84
                           (x2 - x1) * dstBpp,
 
85
                           1,
 
86
                           pGC->alu,
 
87
                           pPriv->pm,
 
88
                           dstBpp,
 
89
                           
 
90
                           FALSE,
 
91
                           FALSE);
 
92
            }
 
93
        }
 
94
        src += PixmapBytePad (*pwidth, pDrawable->depth);
 
95
        ppt++;
 
96
        pwidth++;
 
97
    }
 
98
    fbValidateDrawable (pDrawable);
 
99
}
 
100