]>
Commit | Line | Data |
---|---|---|
a5da9fa1 JB |
1 | --- freetype-2.0.4/src/type1/t1load.c.orig Tue Jun 19 10:28:23 2001 |
2 | +++ freetype-2.0.4/src/type1/t1load.c Sat Jun 30 00:00:25 2001 | |
3 | @@ -73,7 +73,7 @@ | |
4 | ||
5 | #include <string.h> /* for strncmp(), strcmp() */ | |
6 | #include <ctype.h> /* for isalnum() */ | |
7 | - | |
8 | +#include <stdlib.h> | |
9 | ||
10 | /*************************************************************************/ | |
11 | /* */ | |
12 | @@ -1116,7 +1116,7 @@ | |
13 | for ( n = 0; n < loader->num_subrs; n++ ) | |
14 | { | |
15 | FT_Int index, size; | |
16 | - FT_Byte* base; | |
17 | + FT_Byte* base, *temp; | |
18 | ||
19 | ||
20 | /* If the next token isn't `dup', we are also done. This */ | |
21 | @@ -1150,12 +1149,18 @@ | |
22 | /* */ | |
23 | if ( face->type1.private_dict.lenIV >= 0 ) | |
24 | { | |
25 | - psaux->t1_decrypt( base, size, 4330 ); | |
26 | + /* decrypt writes to base - make temporary copy */ | |
27 | + if ( (temp=malloc( size )) == NULL ) | |
28 | + return; | |
29 | + MEM_Copy( temp, base, size ); | |
30 | + psaux->t1_decrypt( temp, size, 4330 ); | |
31 | size -= face->type1.private_dict.lenIV; | |
32 | base += face->type1.private_dict.lenIV; | |
33 | + error = T1_Add_Table( table, index, temp+4, size ); | |
34 | + free( temp ); | |
35 | } | |
36 | - | |
37 | + else | |
38 | error = T1_Add_Table( table, index, base, size ); | |
39 | if ( error ) | |
40 | goto Fail; | |
41 | } | |
42 | @@ -1179,7 +1183,7 @@ | |
43 | ||
44 | PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; | |
45 | ||
46 | - FT_Byte* cur; | |
47 | + FT_Byte* cur, *temp; | |
48 | FT_Byte* limit = parser->root.limit; | |
49 | FT_Int n; | |
50 | FT_UInt notdef_index = 0; | |
51 | @@ -1282,12 +1286,18 @@ | |
52 | ||
53 | if ( face->type1.private_dict.lenIV >= 0 ) | |
54 | { | |
55 | - psaux->t1_decrypt( base, size, 4330 ); | |
56 | + /* decrypt writes to base - make temporary copy */ | |
57 | + if ( (temp = malloc( size )) == NULL ) | |
58 | + return; | |
59 | + MEM_Copy( temp, base, size ); | |
60 | + psaux->t1_decrypt( temp, size, 4330 ); | |
61 | size -= face->type1.private_dict.lenIV; | |
62 | base += face->type1.private_dict.lenIV; | |
63 | + error = T1_Add_Table( code_table, n, temp+4, size ); | |
64 | + free( temp ); | |
65 | } | |
66 | - | |
67 | + else | |
68 | error = T1_Add_Table( code_table, n, base, size ); | |
69 | if ( error ) | |
70 | goto Fail; | |
71 |