You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
922 B

  1. From 6088a74bcf7d0c42e24cff4594d804e1d3c9fbca Mon Sep 17 00:00:00 2001
  2. From: Zhipeng Xie <xiezhipeng1@huawei.com>
  3. Date: Tue, 20 Aug 2019 16:33:06 +0800
  4. Subject: [PATCH] Fix memory leak in xmlSchemaValidateStream
  5. When ctxt->schema is NULL, xmlSchemaSAXPlug->xmlSchemaPreRun
  6. alloc a new schema for ctxt->schema and set vctxt->xsiAssemble
  7. to 1. Then xmlSchemaVStart->xmlSchemaPreRun initialize
  8. vctxt->xsiAssemble to 0 again which cause the alloced schema
  9. can not be freed anymore.
  10. Found with libFuzzer.
  11. Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
  12. ---
  13. xmlschemas.c | 1 -
  14. 1 file changed, 1 deletion(-)
  15. --- a/xmlschemas.c
  16. +++ b/xmlschemas.c
  17. @@ -28095,7 +28095,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vc
  18. vctxt->nberrors = 0;
  19. vctxt->depth = -1;
  20. vctxt->skipDepth = -1;
  21. - vctxt->xsiAssemble = 0;
  22. vctxt->hasKeyrefs = 0;
  23. #ifdef ENABLE_IDC_NODE_TABLES_TEST
  24. vctxt->createIDCNodeTables = 1;