0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 7ffcd44d7e6c46704f8af0321d9314cd26e0e18a 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. [import into Buildroot]
  13. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
  14. ---
  15. xmlschemas.c | 1 -
  16. 1 file changed, 1 deletion(-)
  17. diff --git a/xmlschemas.c b/xmlschemas.c
  18. index 301c8449..39d92182 100644
  19. --- a/xmlschemas.c
  20. +++ b/xmlschemas.c
  21. @@ -28090,7 +28090,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
  22. vctxt->nberrors = 0;
  23. vctxt->depth = -1;
  24. vctxt->skipDepth = -1;
  25. - vctxt->xsiAssemble = 0;
  26. vctxt->hasKeyrefs = 0;
  27. #ifdef ENABLE_IDC_NODE_TABLES_TEST
  28. vctxt->createIDCNodeTables = 1;
  29. --
  30. 2.24.1