[gs-cvs] gs/src
Igor Melichev
igor at ghostscript.com
Mon Apr 25 05:28:52 PDT 2005
Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv3093/gs/src
Modified Files:
gdevpdfr.c iscan.c sstring.c sstring.h
Log Message:
Fix (pdfwrite) : Uninitialized variable when encrypting a string from a pdfmark.
DETAILS :
Bug 687809 "pdfwrite: A wrong encryption of bookmarks".
This bug may become another classic example,
which demonstrates a bad coding style.
The function s_PSSD_init incompletely performed the action,
which it is designed for. The reason is that the macro
s_PSSD_init_inline was made especially for optimizing
scan_token, and its name doesn't reflect its action.
When coded s_PSSD_init, its action was forgotten.
As a result we've got an indeterministic behavior.
This fix renames s_PSSD_init_inline into s_PSSD_partially_init_inline
for a better reflection of its action, completes s_PSSD_init,
and makes the letter be public for a regular initialization.
Particularly using it gdevpdfr.c to fix another indeterministic bug,
which persists since the repository was created.
EXPECTED DIFFERENCES :
None.
Index: gdevpdfr.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfr.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gdevpdfr.c 14 Jun 2002 05:53:39 -0000 1.8
+++ gdevpdfr.c 25 Apr 2005 12:28:49 -0000 1.9
@@ -309,7 +309,7 @@
stream_PSSD_state ss;
int status;
- s_PSSD_init_inline(&ss);
+ s_PSSD_init((stream_state *)&ss);
r.ptr = p; /* skip the '(' */
r.limit = end - 1;
w.limit = buf + sizeof(buf) - 1;
Index: iscan.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/iscan.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- iscan.c 18 Nov 2004 02:20:25 -0000 1.19
+++ iscan.c 25 Apr 2005 12:28:49 -0000 1.20
@@ -593,7 +593,7 @@
sstate.s_ss.pssd.from_string =
((pstate->s_options & SCAN_FROM_STRING) != 0) &&
!scan_enable_level2;
- s_PSSD_init_inline(&sstate.s_ss.pssd);
+ s_PSSD_partially_init_inline(&sstate.s_ss.pssd);
sstate.s_ss.st.template = &s_PSSD_template;
goto str;
case '{':
Index: sstring.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/sstring.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sstring.c 21 Feb 2002 22:24:54 -0000 1.4
+++ sstring.c 25 Apr 2005 12:28:49 -0000 1.5
@@ -222,12 +222,13 @@
private_st_PSSD_state();
/* Initialize the state */
-private int
+int
s_PSSD_init(stream_state * st)
{
stream_PSSD_state *const ss = (stream_PSSD_state *) st;
- return s_PSSD_init_inline(ss);
+ ss->from_string = false;
+ return s_PSSD_partially_init_inline(ss);
}
/* Process a buffer */
Index: sstring.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/sstring.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sstring.h 21 Feb 2002 22:24:54 -0000 1.6
+++ sstring.h 25 Apr 2005 12:28:49 -0000 1.7
@@ -61,9 +61,14 @@
#define private_st_PSSD_state() /* in sstring.c */\
gs_private_st_simple(st_PSSD_state, stream_PSSD_state,\
"PSStringDecode state")
-/* We define the initialization procedure here, so that the scanner */
+
+/* Initialize the state */
+int s_PSSD_init(stream_state * st);
+
+/* A special initialization procedure for the scanner */
/* can avoid a procedure call. */
-#define s_PSSD_init_inline(ss)\
+/* Note : it doesn't initialize ss->from_string. */
+#define s_PSSD_partially_init_inline(ss)\
((ss)->depth = 0)
extern const stream_template s_PSSD_template;
More information about the gs-cvs
mailing list