Re: Patch: 3294 (open password protected word documents)

From: Dom Lachowicz <domlachowicz_at_yahoo.com>
Date: Wed Sep 08 2004 - 20:55:11 CEST

Patch approved. Please check in. I'll release a new wv
in a few days.

Dom

--- Robert Wilhelm <robert.wilhelm@gmx.net> wrote:

>
> Basically we were trying to close streams more than
> one time, because
> we closed them in decrypt9x.c without removing them
> from the list
> of streams to be closed later in wvOLEFree().
>
> Dom, please approve.
>
> Robert
>
>
>
> > Index: decrypt95.c
>
===================================================================
> RCS file: /cvsroot/wv/decrypt95.c,v
> retrieving revision 1.8
> diff -u -r1.8 decrypt95.c
> --- decrypt95.c 11 Apr 2001 00:27:47 -0000 1.8
> +++ decrypt95.c 8 Sep 2004 18:22:00 -0000
> @@ -148,11 +148,12 @@
> wvStream_close (ps->tablefd1);
> wvStream_close (ps->mainfd);
>
> - wvStream_FILE_create (&ps->tablefd, mainfd);
> - wvStream_FILE_create (&ps->tablefd0, mainfd);
> - wvStream_FILE_create (&ps->tablefd1, mainfd);
> wvStream_FILE_create (&ps->mainfd, mainfd);
> - wvStream_rewind (ps->tablefd);
> +
> + ps->tablefd = ps->mainfd;
> + ps->tablefd0 = ps->mainfd;
> + ps->tablefd1 = ps->mainfd;
> +
> wvStream_rewind (ps->mainfd);
> ps->fib.fEncrypted = 0;
> wvGetFIB (&ps->fib, ps->mainfd);
> Index: decrypt97.c
>
===================================================================
> RCS file: /cvsroot/wv/decrypt97.c,v
> retrieving revision 1.12
> diff -u -r1.12 decrypt97.c
> --- decrypt97.c 14 Jun 2002 16:02:22 -0000 1.12
> +++ decrypt97.c 8 Sep 2004 18:22:00 -0000
> @@ -239,28 +239,22 @@
>
> }
>
> -#if 0
> - /* causing us grief on windows */
> if (ps->tablefd0)
> - wvStream_close (ps->tablefd0);
> -#endif
> -
> + wvStream_close (ps->tablefd0);
> if (ps->tablefd1)
> - wvStream_close (ps->tablefd1);
> + wvStream_close (ps->tablefd1);
> + if (ps->summary)
> + wvStream_close (ps->summary);
> +
> wvStream_close (ps->mainfd);
>
> - wvStream_FILE_create(&ps->tablefd, outtable);
> - wvStream_FILE_create(&ps->mainfd, outmain);
> + wvStream_FILE_create(&ps->tablefd0, outtable);
> + wvStream_FILE_create(&ps->mainfd, outmain);
>
> -#if 1
> - wvStream_FILE_create(&ps->tablefd0, outtable);
> - wvStream_FILE_create(&ps->tablefd1, outtable);
> -#else
> - ps->tablefd0 = ps->tablefd;
> - ps->tablefd1 = ps->tablefd;
> -#endif
> + ps->tablefd = ps->tablefd0;
> + ps->tablefd1 = ps->tablefd0;
>
> - wvStream_rewind (ps->tablefd);
> + wvStream_rewind (ps->tablefd0);
> wvStream_rewind (ps->mainfd);
> ps->fib.fEncrypted = 0;
> wvGetFIB (&ps->fib, ps->mainfd);
> Index: support.c
>
===================================================================
> RCS file: /cvsroot/wv/support.c,v
> retrieving revision 1.34
> diff -u -r1.34 support.c
> --- support.c 23 Aug 2003 21:37:52 -0000 1.34
> +++ support.c 8 Sep 2004 18:22:02 -0000
> @@ -72,19 +72,26 @@
>
> extern pps_entry *stream_tree;
> static wvStream_list *streams = NULL;
> +static U32 wvStream_close_stream(wvStream * in);
>
> void
> wvOLEFree (wvParseStruct * ps)
> {
> - wvStream_list *tempList;
> + wvStream_list *tempList = streams;
> +
> + while (tempList != NULL)
> + {
> + wvStream_close(tempList->stream);
> + tempList = tempList->next;
> + }
>
> while (streams != NULL)
> {
> - wvStream_close (streams->stream);
> tempList = streams->next;
> wvFree (streams);
> streams = tempList;
> }
> +
> if (ps->ole_file != NULL)
> {
> ms_ole_destroy (&ps->ole_file);
> @@ -368,8 +375,28 @@
> return size;
> }
>
> +
> U32
> -wvStream_close (wvStream * in)
> +wvStream_close(wvStream * in)
> +{
> + wvStream_list *s;
> + U32 ret;
> +
> + ret = wvStream_close_stream (in);
> +
> + for ( s = streams;s != NULL; s=s->next)
> + {
> + if (s->stream == in)
> + {
> + s->stream = 0;
> + }
> + }
> +
> + return ret;
> +}
> +
> +static U32
> +wvStream_close_stream (wvStream * in)
> {
> if ( !in )
> return 0;
>

                
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
Received on Wed Sep 8 20:55:13 2004

This archive was generated by hypermail 2.1.8 : Wed Sep 08 2004 - 20:55:13 CEST