Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • L libxml2
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 91
    • Issues 91
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • libxml2
  • Issues
  • #378
Closed
Open
Issue created Jul 01, 2022 by scoder@scoder

Empty namespace definition leaks after parsing incorrect input

I was made aware of a data leak between parsed documents in lxml doing the following:

  1. parse the incomplete document <anot xmlns="1">, get a parser error (as expected)
  2. reuse the same parser (i.e. the same libxml2 parser context, after resetting it) to parse the correct document <root></root>
  3. access the supposedly empty namespace mapping of the parsed (second) root element

The expected result is an empty dictionary ({}), but if (and only if) the previous incorrect document has been parsed before, then the result is the (senseless) {None: None}, meaning that it got an nsDef with two NULL values from somewhere.

Apparently, the parser failure in the first run had already prepared the namespace information when the parsing failed, but then that did not get cleaned up with the normal reset of the parser context, so that the second parse passed it on to the second document.

I can reproduce this with libxml2 2.9.14 and 2.9.10, but not with 2.9.9.

Edited Jul 01, 2022 by scoder
Assignee
Assign to
Time tracking