[xslt] Crash in xsltproc



Hi there,

The following patch fixes a crash in xsltproc when the document passed first
on the command-line isn't a stylesheet.

Basically, the 'xsltParseStylesheetProcess(ret, doc)' returns NULL just few
lines above, and the code frees the stylesheet, setting the 'ret' pointer to
NULL. The next line of code references 'ret->errors', but 'ret' is now NULL
and the OS doesn't forgive the lapse :-)

I'll commit the patch shortly.

Ciao,
Igor



RCS file: /cvs/gnome/libxslt/libxslt/xslt.c,v
retrieving revision 1.91
diff -c -r1.91 xslt.c
*** xslt.c      10 May 2003 17:06:57 -0000      1.91
--- xslt.c      31 May 2003 15:17:46 -0000
***************
*** 1983,1994 ****
        xsltFreeStylesheet(ret);
        ret = NULL;
      }
!     if (ret->errors != 0) {
!       ret->doc = NULL;
!       xsltFreeStylesheet(ret);
!       ret = NULL;
      }
!
      return(ret);
  }

--- 1983,1996 ----
        xsltFreeStylesheet(ret);
        ret = NULL;
      }
!     if (ret != NULL) {
!       if (ret->errors != 0) {
!           ret->doc = NULL;
!           xsltFreeStylesheet(ret);
!           ret = NULL;
!       }
      }
!
      return(ret);
  }





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]