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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.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: jmemsys.c,v 1.4 2001/02/09 02:04:29 xorgcvs Exp $ */
 
2
/* Module jmemsys.c */
 
3
 
 
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
        Gary Rogers, AGE Logic, Inc., October 1993
 
70
        Gary Rogers, AGE Logic, Inc., January 1994
 
71
 
 
72
****************************************************************************/
 
73
/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c,v 3.4 2001/12/14 19:58:39 dawes Exp $ */
 
74
 
 
75
/*
 
76
 * jmemnobs.c  (jmemsys.c)
 
77
 *
 
78
 * Copyright (C) 1992, Thomas G. Lane.
 
79
 * This file is part of the Independent JPEG Group's software.
 
80
 * For conditions of distribution and use, see the accompanying README file.
 
81
 *
 
82
 * This file provides a really simple implementation of the system-
 
83
 * dependent portion of the JPEG memory manager.  This implementation
 
84
 * assumes that no backing-store files are needed: all required space
 
85
 * can be obtained from malloc().
 
86
 * This is very portable in the sense that it'll compile on almost anything,
 
87
 * but you'd better have lots of main memory (or virtual memory) if you want
 
88
 * to process big images.
 
89
 * Note that the max_memory_to_use option is ignored by this implementation.
 
90
 */
 
91
 
 
92
#include "jinclude.h"
 
93
#include "jmemsys.h"
 
94
 
 
95
#ifdef _XIEC_MEMORY
 
96
#include <memory.h>
 
97
#ifdef malloc
 
98
#undef malloc
 
99
#endif
 
100
#ifdef free
 
101
#undef free
 
102
#endif
 
103
#define malloc(size)    XieMalloc(size)
 
104
#define free(ptr)       XieFree(ptr)
 
105
#else
 
106
#ifdef INCLUDES_ARE_ANSI
 
107
#include <stdlib.h>             /* to declare malloc(), free() */
 
108
#else
 
109
extern pointer malloc PP((size_t size));
 
110
extern void free PP(pointer ptr));
 
111
#endif
 
112
#endif  /* _XIEC_MEMORY */
 
113
 
 
114
 
 
115
#ifndef XIE_SUPPORTED
 
116
static external_methods_ptr methods; /* saved for access to error_exit */
 
117
#endif  /* XIE_SUPPORTED */
 
118
 
 
119
/*
 
120
 * Memory allocation and freeing are controlled by the regular library
 
121
 * routines malloc() and free().
 
122
 */
 
123
 
 
124
GLOBAL pointer
 
125
#ifdef XIE_SUPPORTED
 
126
#if NeedFunctionPrototypes
 
127
jget_small (size_t sizeofobject)
 
128
#else
 
129
jget_small (sizeofobject)
 
130
        size_t sizeofobject;
 
131
#endif  /* NeedFunctionPrototypes */
 
132
#else
 
133
jget_small (size_t sizeofobject)
 
134
#endif  /* XIE_SUPPORTED */
 
135
{
 
136
  return (pointer) malloc(sizeofobject);
 
137
}
 
138
 
 
139
GLOBAL void
 
140
#ifdef XIE_SUPPORTED
 
141
#if NeedFunctionPrototypes
 
142
jfree_small (pointer object)
 
143
#else
 
144
jfree_small (object)
 
145
        pointer object;
 
146
#endif  /* NeedFunctionPrototypes */
 
147
#else
 
148
jfree_small (pointer object)
 
149
#endif  /* XIE_SUPPORTED */
 
150
{
 
151
  free(object);
 
152
}
 
153
 
 
154
/*
 
155
 * We assume NEED_FAR_POINTERS is not defined and so the separate entry points
 
156
 * jget_large, jfree_large are not needed.
 
157
 */
 
158
 
 
159
 
 
160
/*
 
161
 * This routine computes the total memory space available for allocation.
 
162
 * Here we always say, "we got all you want bud!"
 
163
 */
 
164
 
 
165
#ifndef XIE_SUPPORTED
 
166
GLOBAL long
 
167
#ifdef XIE_SUPPORTED
 
168
#if NeedFunctionPrototypes
 
169
jmem_available (long min_bytes_needed, long max_bytes_needed)
 
170
#else
 
171
jmem_available (min_bytes_needed, max_bytes_needed)
 
172
        long min_bytes_needed;
 
173
        long max_bytes_needed;
 
174
#endif  /* NeedFunctionPrototypes */
 
175
#else
 
176
jmem_available (long min_bytes_needed, long max_bytes_needed)
 
177
#endif  /* XIE_SUPPORTED */
 
178
{
 
179
  return max_bytes_needed;
 
180
}
 
181
 
 
182
 
 
183
/*
 
184
 * Backing store (temporary file) management.
 
185
 * This should never be called and we just error out.
 
186
 */
 
187
 
 
188
GLOBAL void
 
189
#ifdef XIE_SUPPORTED
 
190
#if NeedFunctionPrototypes
 
191
jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
 
192
#else
 
193
jopen_backing_store (info, total_bytes_needed)
 
194
        backing_store_ptr info;
 
195
        long total_bytes_needed;
 
196
#endif  /* NeedFunctionPrototypes */
 
197
#else
 
198
jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
 
199
#endif  /* XIE_SUPPORTED */
 
200
{
 
201
  ERREXIT(methods, "Backing store not supported");
 
202
}
 
203
#endif   /* XIE_SUPPORTED */
 
204
 
 
205
 
 
206
/*
 
207
 * These routines take care of any system-dependent initialization and
 
208
 * cleanup required.  Keep in mind that jmem_term may be called more than
 
209
 * once.
 
210
 */
 
211
 
 
212
#ifndef XIE_SUPPORTED
 
213
GLOBAL void
 
214
jmem_init (external_methods_ptr emethods)
 
215
{
 
216
  methods = emethods;           /* save struct addr for error exit access */
 
217
  emethods->max_memory_to_use = 0;
 
218
}
 
219
#endif  /* XIE_SUPPORTED */
 
220
 
 
221
GLOBAL void
 
222
#ifdef XIE_SUPPORTED
 
223
#if NeedFunctionPrototypes
 
224
jmem_term (void)
 
225
#else
 
226
jmem_term ()
 
227
#endif  /* NeedFunctionPrototypes */
 
228
#else
 
229
jmem_term (void)
 
230
#endif  /* XIE_SUPPORTED */
 
231
{
 
232
  /* no work */
 
233
}