Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
18e337dd
Commit
18e337dd
authored
Feb 16, 2015
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Do proper input validation to fix for CVE-2011-2895."
This reverts commit
6acafc93
.
parent
26cfe931
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
decompress.c
nx-X11/lib/font/fontfile/decompress.c
+14
-17
No files found.
nx-X11/lib/font/fontfile/decompress.c
View file @
18e337dd
...
...
@@ -99,7 +99,7 @@ static char_type magic_header[] = { "\037\235" }; /* 1F 9D */
#define FIRST 257
/* first free entry */
#define CLEAR 256
/* table clear output code */
#define STACK_SIZE
65300
#define STACK_SIZE
8192
typedef
struct
_compressedFILE
{
BufFilePtr
file
;
...
...
@@ -180,12 +180,14 @@ BufFilePushCompressed (BufFilePtr f)
file
->
tab_suffix
[
code
]
=
(
char_type
)
code
;
}
file
->
free_ent
=
((
file
->
block_compress
)
?
FIRST
:
256
);
file
->
oldcode
=
-
1
;
file
->
clear_flg
=
0
;
file
->
offset
=
0
;
file
->
size
=
0
;
file
->
stackp
=
file
->
de_stack
;
bzero
(
file
->
buf
,
BITS
);
file
->
finchar
=
file
->
oldcode
=
getcode
(
file
);
if
(
file
->
oldcode
!=
-
1
)
*
file
->
stackp
++
=
file
->
finchar
;
return
BufFileCreate
((
char
*
)
file
,
BufCompressedFill
,
0
,
...
...
@@ -230,6 +232,9 @@ BufCompressedFill (BufFilePtr f)
if
(
buf
==
bufend
)
break
;
if
(
oldcode
==
-
1
)
break
;
code
=
getcode
(
file
);
if
(
code
==
-
1
)
break
;
...
...
@@ -238,34 +243,26 @@ BufCompressedFill (BufFilePtr f)
for
(
code
=
255
;
code
>=
0
;
code
--
)
file
->
tab_prefix
[
code
]
=
0
;
file
->
clear_flg
=
1
;
file
->
free_ent
=
FIRST
;
oldcode
=
-
1
;
continue
;
file
->
free_ent
=
FIRST
-
1
;
if
(
(
code
=
getcode
(
file
))
==
-
1
)
/* O, untimely death! */
break
;
}
incode
=
code
;
/*
* Special case for KwKwK string.
*/
if
(
code
>=
file
->
free_ent
)
{
if
(
code
>
file
->
free_ent
||
oldcode
==
-
1
)
{
/* Bad stream. */
return
BUFFILEEOF
;
}
*
stackp
++
=
finchar
;
code
=
oldcode
;
}
+
/*
+ * The above condition ensures that code < free_ent.
+ * The construction of tab_prefixof in turn guarantees that
+ * each iteration decreases code and therefore stack usage is
+ * bound by 1 << BITS - 256.
+ */
/*
* Generate output characters in reverse order
*/
while
(
code
>=
256
)
{
if
(
stackp
-
de_stack
>=
STACK_SIZE
-
1
)
return
BUFFILEEOF
;
*
stackp
++
=
file
->
tab_suffix
[
code
];
code
=
file
->
tab_prefix
[
code
];
}
...
...
@@ -275,7 +272,7 @@ BufCompressedFill (BufFilePtr f)
/*
* Generate the new entry.
*/
if
(
(
code
=
file
->
free_ent
)
<
file
->
maxmaxcode
&&
oldcode
!=
-
1
)
{
if
(
(
code
=
file
->
free_ent
)
<
file
->
maxmaxcode
)
{
file
->
tab_prefix
[
code
]
=
(
unsigned
short
)
oldcode
;
file
->
tab_suffix
[
code
]
=
finchar
;
file
->
free_ent
=
code
+
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment