Headline
CVE-2021-42521: Potential NULL pointer dereference : forgetting to check the return value of libxml2 API xmlDocGetRootElement (#17818) · Issues · VTK / VTK · GitLab
There is a NULL pointer dereference vulnerability in VTK, and it lies in IO/Infovis/vtkXMLTreeReader.cxx. The vendor didn’t check the return value of libxml2 API 'xmlDocGetRootElement’, and try to dereference it. It is unsafe as the return value can be NULL and that NULL pointer dereference may crash the application.
This issue lies in the IO/Infovis/vtkXMLTreeReader.cxx:219.
According to the libxml2 API document, the API xmlDocGetRootElement can Returns: the #xmlNodePtr for the root or NULL. However, the fucntion ‘vtkXMLTreeReaderProcessElement’ try to dereference its return value (lies in vtkXMLTreeReader.cxx:92) without checking it at first. This may cause application to crash.