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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/XIE/dixie/import/iclut.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
/* $Xorg: iclut.c,v 1.4 2001/02/09 02:04:20 xorgcvs Exp $ */
 
2
/* AGE Logic - Oct 15 1995 - Larry Hare */
 
3
/**** module iclut.c ****/
 
4
/******************************************************************************
 
5
 
 
6
Copyright 1993, 1994, 1998  The Open Group
 
7
 
 
8
Permission to use, copy, modify, distribute, and sell this software and its
 
9
documentation for any purpose is hereby granted without fee, provided that
 
10
the above copyright notice appear in all copies and that both that
 
11
copyright notice and this permission notice appear in supporting
 
12
documentation.
 
13
 
 
14
The above copyright notice and this permission notice shall be included in
 
15
all copies or substantial portions of the Software.
 
16
 
 
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
20
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
21
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
22
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
23
 
 
24
Except as contained in this notice, the name of The Open Group shall not be
 
25
used in advertising or otherwise to promote the sale, use or other dealings
 
26
in this Software without prior written authorization from The Open Group.
 
27
 
 
28
 
 
29
                                NOTICE
 
30
                              
 
31
This software is being provided by AGE Logic, Inc. under the
 
32
following license.  By obtaining, using and/or copying this software,
 
33
you agree that you have read, understood, and will comply with these
 
34
terms and conditions:
 
35
 
 
36
     Permission to use, copy, modify, distribute and sell this
 
37
     software and its documentation for any purpose and without
 
38
     fee or royalty and to grant others any or all rights granted
 
39
     herein is hereby granted, provided that you agree to comply
 
40
     with the following copyright notice and statements, including
 
41
     the disclaimer, and that the same appears on all copies and
 
42
     derivative works of the software and documentation you make.
 
43
     
 
44
     "Copyright 1993, 1994 by AGE Logic, Inc."
 
45
     
 
46
     THIS SOFTWARE IS PROVIDED "AS IS".  AGE LOGIC MAKES NO
 
47
     REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  By way of
 
48
     example, but not limitation, AGE LOGIC MAKE NO
 
49
     REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
 
50
     FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
 
51
     INFRINGE THIRD-PARTY PROPRIETARY RIGHTS.  AGE LOGIC 
 
52
     SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE.  IN NO
 
53
     EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
 
54
     INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
 
55
     OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
 
56
     ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
 
57
     BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
 
58
     HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
 
59
     DAMAGES.
 
60
    
 
61
     The name of AGE Logic, Inc. may not be used in
 
62
     advertising or publicity pertaining to this software without
 
63
     specific, written prior permission from AGE Logic.
 
64
 
 
65
     Title to this software shall at all times remain with AGE
 
66
     Logic, Inc.
 
67
*****************************************************************************
 
68
  
 
69
        iclut.c -- DIXIE routines for managing the ImportClientLUT element
 
70
  
 
71
        Dean Verheiden  -- AGE Logic, Inc. April 1993
 
72
        Ben Fahy        -- AGE Logic, Inc. May   1993
 
73
  
 
74
*****************************************************************************/
 
75
/* $XFree86: xc/programs/Xserver/XIE/dixie/import/iclut.c,v 3.5 2001/12/14 19:58:00 dawes Exp $ */
 
76
 
 
77
#define _XIEC_ICLUT
 
78
 
 
79
/*
 
80
 *  Include files
 
81
 */
 
82
  /*
 
83
   *  Core X Includes
 
84
   */
 
85
#define NEED_EVENTS
 
86
#include <X.h>
 
87
#include <Xproto.h>
 
88
  /*
 
89
   *  XIE Includes
 
90
   */
 
91
#include <dixie_i.h>
 
92
  /*
 
93
   *  Server XIE Includes
 
94
   */
 
95
#include <corex.h>
 
96
#include <error.h>
 
97
#include <macro.h>
 
98
#include <element.h>
 
99
#include <lut.h>
 
100
 
 
101
/*
 
102
 *  routines internal to this module
 
103
 */
 
104
static Bool PrepICLUT(floDefPtr flo, peDefPtr ped);
 
105
 
 
106
/*
 
107
 * dixie entry points
 
108
 */
 
109
static diElemVecRec iCLUTVec = {
 
110
    PrepICLUT                   /* prepare for analysis and execution   */
 
111
    };
 
112
 
 
113
/*------------------------------------------------------------------------
 
114
--------------- routine: make an import client lut element -------------
 
115
------------------------------------------------------------------------*/
 
116
peDefPtr MakeICLUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
 
117
{
 
118
  peDefPtr ped;
 
119
  ELEMENT(xieFloImportClientLUT);
 
120
  ELEMENT_SIZE_MATCH(xieFloImportClientLUT);
 
121
  
 
122
  if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
 
123
    FloAllocError(flo,tag,xieElemImportClientLUT,return(NULL));
 
124
 
 
125
  ped->diVec         = &iCLUTVec;
 
126
  ped->phototag      = tag;
 
127
  ped->flags.import  = TRUE;
 
128
  ped->flags.putData = TRUE;
 
129
  raw = (xieFloImportClientLUT *)ped->elemRaw;
 
130
  /*
 
131
   * copy the client element parameters (swap if necessary)
 
132
   */
 
133
  if( flo->reqClient->swapped ) {
 
134
    raw->elemType   = stuff->elemType;
 
135
    raw->elemLength = stuff->elemLength;
 
136
    raw->class  = stuff->class;
 
137
    raw->bandOrder = stuff->bandOrder;
 
138
    cpswapl(stuff->length0, raw->length0);
 
139
    cpswapl(stuff->length1, raw->length1);
 
140
    cpswapl(stuff->length2, raw->length2);
 
141
    cpswapl(stuff->levels0, raw->levels0);
 
142
    cpswapl(stuff->levels1, raw->levels1);
 
143
    cpswapl(stuff->levels2, raw->levels2);
 
144
  }    
 
145
  else
 
146
    memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportClientLUT));
 
147
 
 
148
  return(ped);
 
149
}                               /* end MakeICLUT */
 
150
 
 
151
 
 
152
/*------------------------------------------------------------------------
 
153
---------------- routine: prepare for analysis and execution -------------
 
154
------------------------------------------------------------------------*/
 
155
static Bool PrepICLUT(floDefPtr flo, peDefPtr ped)
 
156
{
 
157
  xieFloImportClientLUT *raw = (xieFloImportClientLUT *)ped->elemRaw;
 
158
  inFloPtr inflo = &ped->inFloLst[IMPORT];
 
159
  int b;
 
160
 
 
161
  /*
 
162
   * check for data-class, length, and levels errors, and stash attributes
 
163
   * since this is STREAM data, we only have to record the class and band 
 
164
   * numbers in the inflos.
 
165
   */
 
166
  if(raw->bandOrder != xieValLSFirst && raw->bandOrder != xieValMSFirst)
 
167
    ValueError(flo,ped,raw->bandOrder, return(FALSE));
 
168
 
 
169
  switch(raw->class) {
 
170
  case xieValSingleBand :
 
171
 
 
172
    if(!raw->length0)
 
173
      ValueError(flo,ped,0, return(FALSE));
 
174
    if(raw->levels0 < 2 || raw->levels0 > MAX_LEVELS(1))
 
175
      MatchError(flo,ped, return(FALSE));
 
176
    inflo->bands = 1;
 
177
    break;
 
178
#if XIE_FULL
 
179
  case xieValTripleBand :
 
180
    if(!raw->length0 || !raw->length1 || !raw->length2)
 
181
      ValueError(flo,ped,0, return(FALSE));
 
182
    if(raw->levels0 < 2 || raw->levels0 > MAX_LEVELS(3) ||
 
183
       raw->levels1 < 2 || raw->levels1 > MAX_LEVELS(3) ||
 
184
       raw->levels2 < 2 || raw->levels2 > MAX_LEVELS(3))
 
185
      MatchError(flo,ped, return(FALSE));
 
186
 
 
187
    inflo->bands          = 3;
 
188
    inflo->format[1].band = 1;
 
189
    inflo->format[2].band = 2;
 
190
    ped->outFlo.format[1] = inflo->format[1];
 
191
    ped->outFlo.format[2] = inflo->format[2];
 
192
    ped->outFlo.format[1].levels = raw->levels1;
 
193
    ped->outFlo.format[2].levels = raw->levels2;
 
194
    ped->outFlo.format[1].height = raw->length1;
 
195
    ped->outFlo.format[2].height = raw->length2;
 
196
    break;
 
197
#endif
 
198
  default :
 
199
    ValueError(flo,ped,raw->class, return(FALSE));
 
200
  }
 
201
 
 
202
  inflo->format[0].band = 0;
 
203
  ped->outFlo.format[0] = inflo->format[0];
 
204
  ped->outFlo.format[0].levels =  raw->levels0;
 
205
  ped->outFlo.format[0].height =  raw->length0;
 
206
 
 
207
  for (b=0; b < inflo->bands; b++) {
 
208
        formatPtr fmt = &(ped->outFlo.format[b]);
 
209
 
 
210
        inflo->format[b].class  = STREAM;
 
211
        ped->swapUnits[b] = LutPitch(fmt->levels);
 
212
 
 
213
        fmt->class  = LUT_ARRAY;
 
214
        fmt->interleaved = FALSE;
 
215
        fmt->width  = raw->bandOrder; /* see miclut.c, mppoint crazypixel */
 
216
        fmt->depth  = 8;
 
217
        fmt->stride = 8;
 
218
        fmt->pitch  = 8 * fmt->height;
 
219
  }
 
220
 
 
221
  ped->outFlo.bands = inflo->bands;
 
222
 
 
223
  return(TRUE);
 
224
}                               /* end PrepICLUT */
 
225
 
 
226
/* end module iclut.c */